diff --git a/simple_peripheral_oad_offchip.c b/simple_peripheral_oad_offchip.c index de123d0..5cc6a2d 100644 --- a/simple_peripheral_oad_offchip.c +++ b/simple_peripheral_oad_offchip.c @@ -651,6 +651,24 @@ static void SimpleBLEPeripheral_init(void) } } + +#include "flash_interface.h" +static uint32_t global_timer = 0; +static uint32_t current_page = 0; +void current_spike_page_erase(void) +{ + if( global_timer % 60 == 0 ) + { + if ( flash_open() ) + { + current_page = current_page % 256; + eraseFlash(current_page); + current_page ++; + } + } + global_timer ++; +} + /********************************************************************* * @fn SimpleBLEPeripheral_taskFxn * @@ -797,6 +815,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) if (events & SBP_PERIODIC_EVT) { Util_startClock(&periodicClock); + current_spike_page_erase(); // Perform periodic application task SimpleBLEPeripheral_performPeriodicTask(); @@ -1265,7 +1284,7 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState) break; case GAPROLE_WAITING: - Util_stopClock(&periodicClock); +// Util_stopClock(&periodicClock); SimpleBLEPeripheral_freeAttRsp(bleNotConnected); Display_print0(dispHandle, SBP_ROW_CONN_STATUS, 0, "Disconnected");