Skip to content

Commit e29a324

Browse files
committed
add most of the ble char
1 parent b28bba7 commit e29a324

File tree

3 files changed

+50
-50
lines changed

3 files changed

+50
-50
lines changed

cores/nRF5/utility/debug.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint
107107
sprintf(buffer, "%lu", top-bottom);
108108
}
109109

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

113113
void dbgMemInfo(void)
114114
{
115-
PRINTF(" ______________________________________________\n");
116-
PRINTF("| Name | Addr 0x2000xxxx | Usage |\n");
117-
PRINTF("| ---------------------------------------------|\n");
115+
PRINTF(" ______________________________________________\r\n");
116+
PRINTF("| Name | Addr 0x2000xxxx | Usage |\r\n");
117+
PRINTF("| ---------------------------------------------|\r\n");
118118

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

131-
PRINTF("|______________________________________________|\n");
131+
PRINTF("|______________________________________________|\r\n");
132132
PRINTF("\n");
133133

134134
// Print Task list
@@ -137,20 +137,20 @@ void dbgMemInfo(void)
137137

138138
vTaskList(buf);
139139

140-
PRINTF("Task State Prio StackLeft Num\n");
141-
PRINTF("-----------------------------------\n");
140+
PRINTF("Task State Prio StackLeft Num\r\n");
141+
PRINTF("-----------------------------------\r\n");
142142
PRINTF(buf);
143143
PRINTF("\n");
144144
rtos_free(buf);
145145
}
146146

147147
void dbgPrintVersion(void)
148148
{
149-
PRINTF("\n");
150-
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\n");
151-
PRINTF("Bootloader : %s\n", getBootloaderVersion());
152-
PRINTF("Serial No : %s\n", getMcuUniqueID());
153-
PRINTF("\n");
149+
PRINTF("\r\n");
150+
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\r\n");
151+
PRINTF("Bootloader : %s\r\n", getBootloaderVersion());
152+
PRINTF("Serial No : %s\r\n", getMcuUniqueID());
153+
PRINTF("\r\n");
154154
}
155155

156156
/******************************************************************************/

cores/nRF5/verify.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extern "C"
6767
{
6868
PRINTF("0x%lX (%ld)", _status, _status);
6969
}
70-
PRINTF("\n");
70+
PRINTF("\r\n");
7171
}
7272
#else
7373
#define VERIFY_MESS(_status, _funcstr)

libraries/Bluefruit52Lib/examples/Peripheral/tf4micro-motion-kit/tf4micro-motion-kit.ino

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,27 @@ Adafruit_NeoPixel neopixels = Adafruit_NeoPixel(NEOPIXEL_NUM, PIN_NEOPIXEL, NEO_
7272

7373
#define UUID_GEN(val) ("81c30e5c-" val "-4f7d-a886-de3e90749161")
7474

75-
BLEService service (UUID_GEN("0000"));
76-
77-
BLECharacteristic dataProviderTxChar (UUID_GEN("1001"), BLERead | BLENotify, 9 * FLOAT_BYTE_SIZE);
78-
BLECharacteristic dataProviderLabelsTxChar (UUID_GEN("1002"), BLERead, 128);
79-
BLECharacteristic versionTxChar (UUID_GEN("1003"), BLERead, 1, true);
80-
//BLECharacteristic inferenceTxChar (UUID_GEN("1004"), BLERead | BLENotify, 3);
81-
//
82-
//BLEUnsignedCharCharacteristic numClassesRxChar (UUID_GEN("2001"), BLEWrite);
83-
//BLEIntCharacteristic numSamplesRxChar (UUID_GEN("2002"), BLEWrite);
84-
//BLEIntCharacteristic captureDelayRxChar (UUID_GEN("2003"), BLEWrite);
85-
//BLEFloatCharacteristic thresholdRxChar (UUID_GEN("2004"), BLEWrite);
86-
//BLEBoolCharacteristic disableMagnetometerRx (UUID_GEN("2005"), BLEWrite);
87-
//
88-
//BLEUnsignedCharCharacteristic stateRxChar (UUID_GEN("3001"), BLEWrite);
89-
//BLEUnsignedCharCharacteristic stateTxChar (UUID_GEN("3002"), BLERead | BLENotify);
90-
//BLEUnsignedCharCharacteristic fileTransferTypeRxChar (UUID_GEN("3003"), BLEWrite);
91-
//BLEBoolCharacteristic hasModelTxChar (UUID_GEN("3004"), BLERead | BLENotify);
92-
//
93-
//// Meta is for future-proofing, we can use it to store and read any 64 bytes
94-
//BLECharacteristic metaRxChar (UUID_GEN("4001"), BLEWrite, 64);
95-
//BLECharacteristic metaTxChar (UUID_GEN("4002"), BLERead, 64);
75+
BLEService service (UUID_GEN("0000"));
76+
77+
BLECharacteristic dataProviderTxChar (UUID_GEN("1001") , BLERead | BLENotify , 9 * FLOAT_BYTE_SIZE);
78+
BLECharacteristic dataProviderLabelsTxChar (UUID_GEN("1002") , BLERead , 128);
79+
BLECharacteristic versionTxChar (UUID_GEN("1003") , BLERead , 1 , true);
80+
BLECharacteristic inferenceTxChar (UUID_GEN("1004") , BLERead | BLENotify , 3 , true);
81+
82+
BLECharacteristic numClassesRxChar (UUID_GEN("2001") , BLEWrite , 1 , true);
83+
BLECharacteristic numSamplesRxChar (UUID_GEN("2002") , BLEWrite , 4 , true);
84+
BLECharacteristic captureDelayRxChar (UUID_GEN("2003") , BLEWrite , 4 , true);
85+
BLECharacteristic thresholdRxChar (UUID_GEN("2004") , BLEWrite , 4 , true);
86+
BLECharacteristic disableMagnetometerRx (UUID_GEN("2005") , BLEWrite , 1 , true);
87+
88+
BLECharacteristic stateRxChar (UUID_GEN("3001") , BLEWrite , 1 , true);
89+
BLECharacteristic stateTxChar (UUID_GEN("3002") , BLERead | BLENotify , 1 , true);
90+
BLECharacteristic fileTransferTypeRxChar (UUID_GEN("3003") , BLEWrite , 1 , true);
91+
BLECharacteristic hasModelTxChar (UUID_GEN("3004") , BLERead | BLENotify , 1 , true);
92+
93+
// Meta is for future-proofing, we can use it to store and read any 64 bytes
94+
BLECharacteristic metaRxChar (UUID_GEN("4001") , BLEWrite , 64);
95+
BLECharacteristic metaTxChar (UUID_GEN("4002") , BLERead , 64);
9696

9797
/************************************************************************
9898
* Model file transfer
@@ -421,6 +421,7 @@ void setup()
421421
}
422422

423423
Bluefruit.autoConnLed(true);
424+
Bluefruit.configUuid128Count(20);
424425
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
425426
Bluefruit.begin();
426427
Bluefruit.setTxPower(4);
@@ -430,24 +431,23 @@ void setup()
430431
versionTxChar.begin();
431432
dataProviderTxChar.begin();
432433
dataProviderLabelsTxChar.begin();
433-
434-
#if 0
435-
service.addCharacteristic(inferenceTxChar);
436-
437-
service.addCharacteristic(numClassesRxChar);
438-
service.addCharacteristic(numSamplesRxChar);
439-
service.addCharacteristic(captureDelayRxChar);
440-
service.addCharacteristic(thresholdRxChar);
441-
service.addCharacteristic(disableMagnetometerRx);
442-
443-
service.addCharacteristic(stateRxChar);
444-
service.addCharacteristic(stateTxChar);
445-
service.addCharacteristic(fileTransferTypeRxChar);
446-
service.addCharacteristic(hasModelTxChar);
434+
inferenceTxChar.begin();
435+
436+
numClassesRxChar.begin();
437+
numSamplesRxChar.begin();
438+
captureDelayRxChar.begin();
439+
thresholdRxChar.begin();
440+
disableMagnetometerRx.begin();
441+
442+
stateRxChar.begin();
443+
stateTxChar.begin();
444+
fileTransferTypeRxChar.begin();
445+
hasModelTxChar.begin();
447446

448-
service.addCharacteristic(metaRxChar);
449-
service.addCharacteristic(metaTxChar);
447+
metaRxChar.begin();
448+
metaTxChar.begin();
450449

450+
#if 0
451451
// Event driven reads.
452452
numClassesRxChar.setEventHandler(BLEWritten, handleNumClassesRxWritten);
453453
numSamplesRxChar.setEventHandler(BLEWritten, handleNumSamplesRxWritten);

0 commit comments

Comments
 (0)