@ -17,6 +17,31 @@
# include "MicroBit.h"
# include "ble/UUID.h"
# if !defined(__arm)
# pragma GCC diagnostic ignored "-Wunused-function"
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# endif
/*
* The underlying Nordic libraries that support BLE do not compile cleanly with the stringent GCC settings we employ
* If we ' re compiling under GCC , then we suppress any warnings generated from this code ( but not the rest of the DAL )
* The ARM cc compiler is more tolerant . We don ' t test __GNUC__ here to detect GCC as ARMCC also typically sets this
* as a compatability option , but does not support the options used . . .
*/
extern " C " {
# include "dfu_app_handler.h"
}
/*
* Return to our predefined compiler settings .
*/
# if !defined(__arm)
# pragma GCC diagnostic pop
# endif
/**
* Constructor .
* Create a representation of a MicroBit device .
@ -121,7 +146,17 @@ void MicroBitDFUService::onDataWritten(const GattWriteCallbackParams *params)
# if CONFIG_ENABLED(MICROBIT_DBG)
uBit . serial . printf ( " ACTIVATING BOOTLOADER. \n " ) ;
# endif
bootloader_start ( ) ;
// Call bootloader_start implicitly trough a event handler call
// it is a work around for bootloader_start not being public in sdk 8.1
ble_dfu_t p_dfu ;
ble_dfu_evt_t p_evt ;
p_dfu . conn_handle = params - > connHandle ;
p_evt . ble_dfu_evt_type = BLE_DFU_START ;
dfu_app_on_dfu_evt ( & p_dfu , & p_evt ) ;
}
break ;