allow application to enter OTA DFU with soft reset

This commit is contained in:
hathach committed 2017-03-16 22:22:09 +07:00
1 parent feb63dc062
commit a7329b9ea0
6 files changed
+1335 -1307

No files matched your search

File diff suppressed because it is too large. Load diff
+6 -4
View File
@@ -25,7 +25,8 @@
extern "C" {
#endif
#define BOOTLOADER_DFU_SERIAL_MAGIC 0x4e
#define BOOTLOADER_DFU_SERIAL_MAGIC 0x4e
#define BOOTLOADER_DFU_OTA_FULLRESET_MAGIC 0xA8
void init( void )
{
@@ -42,15 +43,16 @@ void init( void )
NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
}
void enterSerialDFU(void)
void enterSerialDfu(void)
{
NRF_POWER->GPREGRET = BOOTLOADER_DFU_SERIAL_MAGIC;
NVIC_SystemReset();
}
void enterOtaDFU(void)
void enterOTADfu(void)
{
NRF_POWER->GPREGRET = BOOTLOADER_DFU_OTA_FULLRESET_MAGIC;
NVIC_SystemReset();
}
+2 -2
View File
@@ -24,8 +24,8 @@ extern "C" {
extern void init(void);
extern void enterSerialDFU(void);
extern void enterOtaDFU(void);
extern void enterSerialDfu(void);
extern void enterOTADfu(void);
#ifdef __cplusplus
}
@@ -0,0 +1,26 @@
/*********************************************************************
This is an example for our nRF52 based Bluefruit LE modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
MIT license, check LICENSE for more information
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/
#include <Arduino.h>
void setup()
{
enterOTADfu();
}
void loop()
{
}
@@ -17,7 +17,7 @@
void setup()
{
enterSerialDFU();
enterSerialDfu();
}
@@ -33,7 +33,6 @@ byte note_sequence[] = {
void setup()
{
Serial.begin(115200);
Serial.println("Adafruit Bluefruit52 MIDI over Bluetooth LE Example");