From da6274657f1f62c8b15c4d94c9faa1bf37ff1ba4 Mon Sep 17 00:00:00 2001 From: VG Date: Mon, 5 Oct 2015 21:07:45 +0200 Subject: fix code to compile it --- synology-autopoweron/main.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'synology-autopoweron') diff --git a/synology-autopoweron/main.c b/synology-autopoweron/main.c index 698a887..6b0acf0 100644 --- a/synology-autopoweron/main.c +++ b/synology-autopoweron/main.c @@ -1,6 +1,7 @@ #include #include #include +#include /* Pinout used: * ----- @@ -68,25 +69,10 @@ static void reset_sleep_time(void) sleep_time = 0; } -static void button_pushed() -{ - PORTB &= ~(1 << PB3); /* make sure reset line is disabled */ - PORTB |= (1 << PB4); /* activate plug modules set */ -} - -static void button_normal() -{ - /* be sure set line is not active before doing a reset else both coil will - * be energized at the same time and thus the behaviour may be - * unpredictable. */ - plug_unset(); - /* activate module reset */ - PORTB |= (1 << PB3); -} - int main() { cli(); + PORTB = 0; // outputs set to low and input not set to internal pull-up init_timer(); sei(); @@ -95,16 +81,14 @@ int main() for (;;) { reset_sleep_time(); - PORTB = 0; // outputs set to low and input not set to internal pull-up - // digital output, pull-down for a time then go to default PB0 = Hi-Z DDRB |= (1 << PB0); while (get_sleep_time() <= SLEPT_TIMEOUT); DDRB &= ~(1 << PB0); /* set low power mode */ - power_all_disable(); // disable all peripherals - set_sleep_mode(); // sleep mode + power_all_disable(); // disable all peripherals + set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode sleep_enable(); // set register to enable sleep sleep_bod_disable(); // disable bod to consume even less //sei(); // normally set sei to ensure wakeup but I do -- cgit v1.2.3