mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-26 01:52:48 +00:00
add nrf52 DFU app helper
This commit is contained in:
parent
ca03110932
commit
db11d9280c
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
@ -12,8 +12,9 @@
|
|||||||
"type": "platformio-debug",
|
"type": "platformio-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "PIO Debug",
|
"name": "PIO Debug",
|
||||||
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf",
|
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/bare/firmware.elf",
|
||||||
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-gccarmnoneeabi/bin",
|
||||||
|
"svdPath": "/home/kevinh/.platformio/platforms/nordicnrf52/misc/svd/nrf52840.svd",
|
||||||
"preLaunchTask": {
|
"preLaunchTask": {
|
||||||
"type": "PlatformIO",
|
"type": "PlatformIO",
|
||||||
"task": "Pre-Debug"
|
"task": "Pre-Debug"
|
||||||
@ -24,8 +25,9 @@
|
|||||||
"type": "platformio-debug",
|
"type": "platformio-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "PIO Debug (skip Pre-Debug)",
|
"name": "PIO Debug (skip Pre-Debug)",
|
||||||
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf",
|
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/bare/firmware.elf",
|
||||||
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-gccarmnoneeabi/bin",
|
||||||
|
"svdPath": "/home/kevinh/.platformio/platforms/nordicnrf52/misc/svd/nrf52840.svd",
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = tbeam
|
default_envs = bare
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
; common is not currently used
|
; common is not currently used
|
||||||
|
@ -14,6 +14,7 @@ BLECharacteristic bslc = BLECharacteristic(UUID16_CHR_BODY_SENSOR_LOCATION);
|
|||||||
|
|
||||||
BLEDis bledis; // DIS (Device Information Service) helper class instance
|
BLEDis bledis; // DIS (Device Information Service) helper class instance
|
||||||
BLEBas blebas; // BAS (Battery Service) helper class instance
|
BLEBas blebas; // BAS (Battery Service) helper class instance
|
||||||
|
BLEDfu bledfu; // DFU software update helper service
|
||||||
|
|
||||||
uint8_t bps = 0;
|
uint8_t bps = 0;
|
||||||
|
|
||||||
@ -171,6 +172,8 @@ void NRF52Bluetooth::setup()
|
|||||||
blebas.begin();
|
blebas.begin();
|
||||||
blebas.write(42); // FIXME, report real power levels
|
blebas.write(42); // FIXME, report real power levels
|
||||||
|
|
||||||
|
bledfu.begin(); // Install the DFU helper
|
||||||
|
|
||||||
// Setup the Heart Rate Monitor service using
|
// Setup the Heart Rate Monitor service using
|
||||||
// BLEService and BLECharacteristic classes
|
// BLEService and BLECharacteristic classes
|
||||||
DEBUG_MSG("Configuring the Heart Rate Monitor Service\n");
|
DEBUG_MSG("Configuring the Heart Rate Monitor Service\n");
|
||||||
@ -205,3 +208,34 @@ void loop()
|
|||||||
delay(1000);
|
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;
|
||||||
|
}
|
||||||
|
*/
|
Loading…
Reference in New Issue
Block a user