Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port TensorFlow Lite Motion Kit project #658

Merged
merged 24 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
10f51fb
Bluefruit.setName() from example to use default board name from USB_P…
hathach Jun 3, 2021
cf004e0
update cmsis from 5.4.0 to 5.7.0, enable dsp libmath
hathach Jun 3, 2021
c5727ee
implement BLEUuid from string style like ArduinoBLE
hathach Jun 4, 2021
10ad828
advertise ok, have issue with IMU begin
hathach Jun 7, 2021
a58a9c9
IMU init Ok with LSM6DSOX
hathach Jun 7, 2021
e732631
add BLECharacteristic constructor with properties
hathach Jun 7, 2021
3995b42
add BLECharacteristic constructor with max_len and fixed len
hathach Jun 8, 2021
97fad97
bump nRFCrypto, log clean up
hathach Jun 8, 2021
b28bba7
mimic version, data provider, data provider label
hathach Jun 8, 2021
e29a324
add most of the ble char
hathach Jun 8, 2021
a4679bd
add Char readFloat() and writeFloat()
hathach Jun 8, 2021
68b04d4
convert all write callback
hathach Jun 8, 2021
bbef3eb
got adv device name
hathach Jun 8, 2021
f152527
port ble file transfer
hathach Jun 8, 2021
1ce065e
add BLEUuid toString()
hathach Jun 8, 2021
1661be0
able to add ble file transfer chars
hathach Jun 8, 2021
1f83e4c
port the whole tf4 sketch
hathach Jun 8, 2021
ec4713f
temporarily comment out mag field in data provider
hathach Jun 8, 2021
74b64da
complete motion trainer with magnetic sensor
hathach Jun 9, 2021
76579e4
fix warning
hathach Jun 9, 2021
b5820b0
add example doc
hathach Jun 9, 2021
0e1357d
normalize sensor orientation for feather sense and clue
hathach Jun 14, 2021
5a98e4b
add local display for CLUE for AirSnare and FingerUserInterface
hathach Jun 14, 2021
556f36d
clean up
hathach Jun 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cores/nRF5/common_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
#define PRINT_HEX(x) \
do {\
PRINTF("%s: %d: " #x " = 0x", __PRETTY_FUNCTION__, __LINE__);\
char fmt[] = "%00X\n";\
char fmt[] = "%00X\r\n";\
fmt[2] += 2*sizeof(x); /* Hex with correct size */\
PRINTF(fmt, (x) );\
}while(0)
Expand All @@ -197,14 +197,14 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
if (i%16 == 0) PRINTF("\n"); \
PRINTF("%02x ", p8[i]); \
}\
PRINTF("\n");\
PRINTF("\r\n");\
}while(0)

#define ADALOG(tag, ...) \
do { \
if ( tag ) PRINTF("[%-6s] ", tag);\
PRINTF(__VA_ARGS__);\
PRINTF("\n");\
PRINTF("\r\n");\
}while(0)

#define ADALOG_BUFFER(_tag, _buf, _n) \
Expand Down
24 changes: 12 additions & 12 deletions cores/nRF5/utility/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint
sprintf(buffer, "%lu", top-bottom);
}

PRINTF("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer);
PRINTF("| %-5s| 0x%04X - 0x%04X | %-19s |\r\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer);
}

void dbgMemInfo(void)
{
PRINTF(" ______________________________________________\n");
PRINTF("| Name | Addr 0x2000xxxx | Usage |\n");
PRINTF("| ---------------------------------------------|\n");
PRINTF(" ______________________________________________\r\n");
PRINTF("| Name | Addr 0x2000xxxx | Usage |\r\n");
PRINTF("| ---------------------------------------------|\r\n");

// Pritn SRAM used for Stack executed by Softdevice and ISR
printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), dbgStackUsed() );
Expand All @@ -128,7 +128,7 @@ void dbgMemInfo(void)
// Print SRAM Used by SoftDevice
printMemRegion("SD", (uint32_t) __data_start__, 0x20000000, 0);

PRINTF("|______________________________________________|\n");
PRINTF("|______________________________________________|\r\n");
PRINTF("\n");

// Print Task list
Expand All @@ -137,20 +137,20 @@ void dbgMemInfo(void)

vTaskList(buf);

PRINTF("Task State Prio StackLeft Num\n");
PRINTF("-----------------------------------\n");
PRINTF("Task State Prio StackLeft Num\r\n");
PRINTF("-----------------------------------\r\n");
PRINTF(buf);
PRINTF("\n");
rtos_free(buf);
}

void dbgPrintVersion(void)
{
PRINTF("\n");
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\n");
PRINTF("Bootloader : %s\n", getBootloaderVersion());
PRINTF("Serial No : %s\n", getMcuUniqueID());
PRINTF("\n");
PRINTF("\r\n");
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\r\n");
PRINTF("Bootloader : %s\r\n", getBootloaderVersion());
PRINTF("Serial No : %s\r\n", getMcuUniqueID());
PRINTF("\r\n");
}

/******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion cores/nRF5/verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern "C"
{
PRINTF("0x%lX (%ld)", _status, _status);
}
PRINTF("\n");
PRINTF("\r\n");
}
#else
#define VERIFY_MESS(_status, _funcstr)
Expand Down
2 changes: 1 addition & 1 deletion libraries/Adafruit_nRFCrypto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ void setup()
// SRAM usage required by SoftDevice will increase with number of connections
Bluefruit.begin(1, 1);
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52 duo");

// Callbacks for Peripheral
Bluefruit.Periph.setConnectCallback(prph_connect_callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,6 @@ void setup()
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);

Bluefruit.begin();
Bluefruit.setName("Bluefruit52");
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values

// try to go as fast as possible, could be rejected by some central, increase it if needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ char nibble_to_hex(uint8_t nibble) { // convert a 4-bit nibble to a hexadecimal

void setup()
{
Serial.begin(115200);
while ( !Serial ) delay(10); // for nrf52840 with native usb
// Serial.begin(115200);
// while ( !Serial ) delay(10);

Serial.println("Bluefruit52 Color Advertising Example");
Serial.println("----------------------------------------\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Set up and start advertising
startAdv();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void setup()
// off Blue LED for lowest power consumption
Bluefruit.autoConnLed(false);
Bluefruit.setTxPower(0); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Manufacturer ID is required for Manufacturer Specific Data
beacon.setManufacturer(MANUFACTURER_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void setup()
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);

Bluefruit.begin();
Bluefruit.setName("Bluefruit52 MIDI");
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values

// Setup the on board blue LED to be enabled on CONNECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");
//Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void setup()
// Initialize Bluefruit with max concurrent connections as Peripheral = 2, Central = 0
Bluefruit.begin(MAX_PRPH_CONNECTION, 0);
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// To be consistent OTA DFU should be added first if it exists
bledfu.begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ void setup()
Bluefruit.begin();
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
Bluefruit.setName(DEVICE_NAME);
//Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void setup(void)

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// To be consistent OTA DFU should be added first if it exists
bledfu.begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ void setup()
Serial.println("Initialise the Bluefruit nRF52 module");
Bluefruit.begin();

// Set the advertised device name (keep it short!)
Serial.println("Setting Device Name to 'Feather52 HRM'");
Bluefruit.setName("Bluefruit52 HRM");

// Set the connect/disconnect callback handlers
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ void setup()
// Initialise the Bluefruit module
Serial.println("Initialise the Bluefruit nRF52 module");
Bluefruit.begin();
Bluefruit.setName("Bluefruit52");

// Set the connect/disconnect callback handlers
Bluefruit.Periph.setConnectCallback(connect_callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Setup the advertising packet
startAdv();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Configure and start DIS (Device Information Service)
bledis.setManufacturer("Adafruit Industries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Configure and Start Device Information Service
bledis.setManufacturer("Adafruit Industries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Configure and Start Device Information Service
bledis.setManufacturer("Adafruit Industries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void setup()
// HID Device can have a min connection interval of 9*1.25 = 11.25 ms
Bluefruit.Periph.setConnInterval(9, 16); // min = 9*1.25=11.25 ms, max = 16*1.25=20ms
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

// Configure and Start Device Information Service
bledis.setManufacturer("Adafruit Industries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
Bluefruit.Periph.setConnInterval(6, 12); // 7.5 - 15 ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
Bluefruit.Periph.setConnInterval(6, 12); // 7.5 - 15 ms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void setup()
// Init Bluefruit
Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Bluefruit.Periph.setConnectCallback(connect_callback);

// Configure and Start Device Information Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void setup()
// Init Bluefruit
Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Bluefruit.Periph.setConnectCallback(connect_callback);

// To be consistent OTA DFU should be added first if it exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");

Serial.println("Setting pairing PIN to: " PAIRING_PIN);
Bluefruit.Security.setPIN(PAIRING_PIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void setup()

Bluefruit.begin();
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
Bluefruit.setName("Bluefruit52");
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

Expand Down
Loading