X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=firmware%2Fmain.c;h=ea3bb69d1384dd5840c5e6a90066dda0807a229c;hb=64a3d3a699cd60b7a6b4b06c5c38689975a3d460;hp=25ea829511781e3e365c282a9bc0ae0e4357b8c3;hpb=b0e6a5b47836a04116631e3a5427b8a508fc5cbf;p=bike-lights.git diff --git a/firmware/main.c b/firmware/main.c index 25ea829..ea3bb69 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -7,7 +7,7 @@ #include "lights.h" -void hw_setup() +static void hw_setup() { wdt_enable(WDTO_1S); init_battery(); @@ -24,7 +24,7 @@ void hw_setup() set_sleep_mode(SLEEP_MODE_IDLE); } -void hw_suspend() +static void hw_suspend() { susp_pwm(); susp_adc(); @@ -39,6 +39,7 @@ void power_down() uint16_t wake_count = 0; unsigned char btn; + hw_suspend(); sleep_again: // enable PCINT14, so that user can wake up later GIMSK |= _BV(PCIE1); @@ -87,12 +88,13 @@ ISR(PCINT_vect) int main(void) { log_init(); + power_usi_disable(); // Once for lifetime + ACSRA |= _BV(ACD); // disable analog comparator log_set_state(3); hw_setup(); - hw_suspend(); power_down(); sei();