diff --git a/.vscode/launch.json b/.vscode/launch.json index 914831d68..77b1fb363 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,8 +12,9 @@ "type": "platformio-debug", "request": "launch", "name": "PIO Debug", - "executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf", - "toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin", + "executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/bare/firmware.elf", + "toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-gccarmnoneeabi/bin", + "svdPath": "/home/kevinh/.platformio/platforms/nordicnrf52/misc/svd/nrf52840.svd", "preLaunchTask": { "type": "PlatformIO", "task": "Pre-Debug" @@ -24,8 +25,9 @@ "type": "platformio-debug", "request": "launch", "name": "PIO Debug (skip Pre-Debug)", - "executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf", - "toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin", + "executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/bare/firmware.elf", + "toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-gccarmnoneeabi/bin", + "svdPath": "/home/kevinh/.platformio/platforms/nordicnrf52/misc/svd/nrf52840.svd", "internalConsoleOptions": "openOnSessionStart" } ] diff --git a/platformio.ini b/platformio.ini index ffcff4735..37ae10d3c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = tbeam +default_envs = bare [common] ; common is not currently used diff --git a/src/bare/NRF52Bluetooth.cpp b/src/bare/NRF52Bluetooth.cpp index 676065a12..9cf6e3708 100644 --- a/src/bare/NRF52Bluetooth.cpp +++ b/src/bare/NRF52Bluetooth.cpp @@ -14,6 +14,7 @@ BLECharacteristic bslc = BLECharacteristic(UUID16_CHR_BODY_SENSOR_LOCATION); BLEDis bledis; // DIS (Device Information Service) helper class instance BLEBas blebas; // BAS (Battery Service) helper class instance +BLEDfu bledfu; // DFU software update helper service uint8_t bps = 0; @@ -171,6 +172,8 @@ void NRF52Bluetooth::setup() blebas.begin(); blebas.write(42); // FIXME, report real power levels + bledfu.begin(); // Install the DFU helper + // Setup the Heart Rate Monitor service using // BLEService and BLECharacteristic classes DEBUG_MSG("Configuring the Heart Rate Monitor Service\n"); @@ -204,4 +207,35 @@ void loop() // Only send update once per second delay(1000); } +*/ + +/* +examples of advanced characteristics. use setReadAuthorizeCallback to prepare data for reads by others + +err_t BLEDfu::begin(void) +{ + // Invoke base class begin() + VERIFY_STATUS( BLEService::begin() ); + + // No need to keep packet & revision characteristics + BLECharacteristic chr_packet(UUID128_CHR_DFU_PACKET); + chr_packet.setTempMemory(); + chr_packet.setProperties(CHR_PROPS_WRITE_WO_RESP); + chr_packet.setMaxLen(20); + VERIFY_STATUS( chr_packet.begin() ); + + _chr_control.setProperties(CHR_PROPS_WRITE | CHR_PROPS_NOTIFY); + _chr_control.setMaxLen(23); + _chr_control.setWriteAuthorizeCallback(bledfu_control_wr_authorize_cb); + VERIFY_STATUS( _chr_control.begin() ); + + BLECharacteristic chr_revision(UUID128_CHR_DFU_REVISON); + chr_revision.setTempMemory(); + chr_revision.setProperties(CHR_PROPS_READ); + chr_revision.setFixedLen(2); + VERIFY_STATUS( chr_revision.begin()); + chr_revision.write16(DFU_REV_APPMODE); + + return ERROR_NONE; +} */ \ No newline at end of file