4 * (c) 2013 Martin Mares <mj@ucw.cz>
8 * Pin assignment (component side view; "*" marks inverted signals)
10 * +-------------------+
12 * diagnostic LED* | PB3 SCK |
13 * output RESET* | PB4 MISO |
15 * +-------------------+
18 #define F_CPU 1200000UL
21 #include <avr/sleep.h>
22 #include <util/delay.h>
26 #define B(x) (1U<<(x))
28 static void sleep(uint16_t millisec)
38 PORTB &= ~B(PB4); // PB4: tri-stated
39 DDRB |= B(PB3); // PB3: output
41 for (byte i=0; i<5; i++) {
49 DDRB |= B(PB4); // PB4: output 0
51 DDRB &= ~B(PB4); // PB4: tri-state
52 DDRB &= ~B(PB3); // PB3: tri-state to save power
55 set_sleep_mode(SLEEP_MODE_PWR_DOWN);