aboutsummaryrefslogtreecommitdiffstats
path: root/synology-autopoweron
diff options
context:
space:
mode:
authorVG <vg@devys.org>2015-10-05 21:07:45 +0200
committerVG <vg@devys.org>2015-10-05 21:07:45 +0200
commitda6274657f1f62c8b15c4d94c9faa1bf37ff1ba4 (patch)
tree7590ae69d5f79bef6f8372bca2b6783742e4d2e3 /synology-autopoweron
parent21a6c53bfb10d51a72f5b3135c65b8fd7440ac28 (diff)
downloadavr-da6274657f1f62c8b15c4d94c9faa1bf37ff1ba4.tar.gz
avr-da6274657f1f62c8b15c4d94c9faa1bf37ff1ba4.tar.bz2
avr-da6274657f1f62c8b15c4d94c9faa1bf37ff1ba4.zip
fix code to compile it
Diffstat (limited to 'synology-autopoweron')
-rw-r--r--synology-autopoweron/main.c24
1 files changed, 4 insertions, 20 deletions
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 <avr/io.h>
#include <avr/interrupt.h>
#include <avr/power.h>
+#include <avr/sleep.h>
/* 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(<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