MAGIC value for powerReason should be stored in RTC backup on Horus (#7096)

- Allows the radio main application to start correctly when coming from an app in RAM
- Refactoring of the `UNEXPECTED_SHUTDOWN()` process
- Saves the RTC battery as BACKUP RAM is not needed on normal shutdown
- On PWR OFF on an ALERT, the radio won't show the next alert before shutting down
- Bootloader flashable through the SD Manager
This commit is contained in:
Bertrand Songis
2019-11-21 11:50:33 +01:00
committed by GitHub
parent 103534bdcf
commit 4cdd17f0d7
41 changed files with 235 additions and 190 deletions
+5 -5
View File
@@ -218,7 +218,7 @@ void stop_trainer_capture();
// Write Flash driver
#define FLASH_PAGESIZE 256
void flashWrite(uint32_t * address, uint32_t * buffer);
void flashWrite(uint32_t * address, const uint32_t * buffer);
// Keys driver
uint32_t switchState(uint8_t index);
@@ -259,12 +259,12 @@ extern "C" {
// WDT driver
#if !defined(WATCHDOG) || defined(SIMU)
#define wdt_enable(x)
#define wdt_reset()
#define WDG_ENABLE(x)
#define WDG_RESET()
#define IS_RESET_REASON_WATCHDOG() false
#else
#define wdt_enable(x) WDT->WDT_MR = 0x3FFF207F
#define wdt_reset() WDT->WDT_CR = 0xA5000001
#define WDG_ENABLE(x) WDT->WDT_MR = 0x3FFF207F
#define WDG_RESET() WDT->WDT_CR = 0xA5000001
#define IS_RESET_REASON_WATCHDOG() ((ResetReason & RSTC_SR_RSTTYP) == (2 << 8))
#endif
+1 -1
View File
@@ -22,7 +22,7 @@
uint32_t (*IAP_Function)(uint32_t, uint32_t);
void flashWrite(uint32_t *address, uint32_t *buffer) // size is 256 bytes
void flashWrite(uint32_t * address, const uint32_t * buffer) // size is 256 bytes
{
uint32_t FlashSectorNum;
uint32_t flash_cmd = 0;
+1 -1
View File
@@ -120,7 +120,7 @@ void lcdInit()
TC0->TC_CHANNEL[0].TC_CCR = 5; // Enable clock and trigger it (may only need trigger)
while ( TC0->TC_CHANNEL[0].TC_CV < 36000 ) {
// Value depends on MCK/2 (used 18MHz) give 2mS delay
wdt_reset(); // Wait
WDG_RESET(); // Wait
}
}
}