[Taranis X9E] Second version for the startup procedure

This commit is contained in:
bsongis
2015-07-10 09:15:18 +02:00
parent bfb72bb0a9
commit e4698d10a3
+22 -1
View File
@@ -123,7 +123,7 @@ void boardInit()
init5msTimer();
__enable_irq();
#if defined(REV9E)
#if 0 // first version
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
while (pwrPressed());
@@ -134,6 +134,27 @@ void boardInit()
}
#endif
#if defined(REV9E) // second version
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
tmr10ms_t duration = 0;
uint8_t pwr_on = 0;
while (pwrPressed()) {
duration = get_tmr10ms() - start;
if (duration >= 300) {
turnBacklightOff();
}
else if (duration > 80 && pwr_on != 1) {
backlightInit();
pwr_on = 1;
}
}
if (duration < 80 || duration >= 300) {
pwrOff();
}
}
#endif
keysInit();
adcInit();
delaysInit();