add nrf52 DFU app helper

pull/111/head
geeksville 2020-04-24 21:04:10 -07:00
rodzic ca03110932
commit db11d9280c
3 zmienionych plików z 41 dodań i 5 usunięć

10
.vscode/launch.json vendored
Wyświetl plik

@ -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"
}
]

Wyświetl plik

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = tbeam
default_envs = bare
[common]
; common is not currently used

Wyświetl plik

@ -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;
}
*/