1 of 1 people found this helpful
mia_xyzKeepstateN() only provides 32 bits (of which keep state 0, bit 0 is reserved, leaving the app 31 bits) of storage in deep sleep/hid-off. Anything stored here will be lost on power cycle (unlike with a real NV store). So you can do something like this:
void app_enter_deep_sleep(UINT 8 keep_this)
// Store value in keep state 1 and ender deep sleep.
// Enter deep sleep here using your favorite mechanism.
// Do some app init here.
// Then read keep state register to see what was stored before entering deep sleep and
// do something.
// Do something if 1 was stored by app_enter_deep_sleep before entering deep sleep last time.
This is great information, thanks a lot.
The fact that a power outage could cause data loss is indeed a problem. People could throw the device we are building and the battery could become disconnected for a few tens of milliseconds, then it becomes a question of whether the 250µF capacitor bank we have on board can buffer the power loss. Oh, it should do so for 40s, this is nice I have to test this some day.
I do have other issues with the bleprofile_ReadNVRAM() function but I will start another thread for it.