main: sleep instead of busy-loop

This commit is contained in:
Puck Meerburg
2026-02-08 00:04:14 +00:00
parent 63ec27d6e2
commit b66cab7029
2 changed files with 13 additions and 1 deletions

View File

@@ -45,6 +45,9 @@ int main()
TMR0_ITCfg(ENABLE, TMR0_3_IT_CYC_END);
PFIC_EnableIRQ(TMR0_IRQn);
TMR1_TimerInit((FREQ_SYS / 1000));
TMR1_ITCfg(ENABLE, TMR0_3_IT_CYC_END);
TMR3_TimerInit(FREQ_SYS / 200);
TMR3_ITCfg(ENABLE, TMR0_3_IT_CYC_END);
PFIC_EnableIRQ(TMR3_IRQn);
@@ -58,6 +61,9 @@ int main()
screen_push(&badge_screen);
// set SEVONPEND
PFIC->SCTLR |= (1 << 4);
while (1) {
WWDG_SetCounter(0x7F);
static int btldr_timer = 0;
@@ -108,6 +114,11 @@ int main()
TMOS_SystemProcess();
cdc_tick();
hid_tick();
DelayMs(1);
while (!TMR1_GetITFlag(TMR0_3_IT_CYC_END)) {
__SEV();
__asm__ volatile("wfi");
}
TMR1_ClearITFlag(TMR0_3_IT_CYC_END);
}
}