X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=tinyboard.git;a=blobdiff_plain;f=projects%2Fstep-up%2Fmain.c;fp=projects%2Fstep-up%2Fmain.c;h=c1ee381453a334bf43493ddb93e287f9fa2bea62;hp=e5141024d74f214e08e75162cc7f25f824289ed5;hb=0c777e2b120ebdb407cc5cbbd29dda16353cd931;hpb=fbbdcc41a590e41e87a05d3cac31f893cb52f8cb diff --git a/projects/step-up/main.c b/projects/step-up/main.c index e514102..c1ee381 100644 --- a/projects/step-up/main.c +++ b/projects/step-up/main.c @@ -71,7 +71,18 @@ int main(void) sei(); #if 1 while (1) { - sleep_mode(); + cli(); + if (pwm_running) { + set_sleep_mode(SLEEP_MODE_IDLE); + } else if (adc_running) { + set_sleep_mode(SLEEP_MODE_ADC); + } else { + set_sleep_mode(SLEEP_MODE_PWR_DOWN); + } + // keep BOD active, no sleep_bod_disable(); + sei(); + sleep_cpu(); + sleep_disable(); } #endif