avr/power-management/main.c

21 lines
461 B
C
Raw Permalink Normal View History

#include <base.h>
#define TIMEOUT 1
int main(void) {
dio_t power = { .ddr = &DDRB, .pin = &PINB, .port = &PORTB, .addr = 3 };
dio_set_direction(&power, LINE_OUT);
int timeout_seconds = TIMEOUT;
while (1) {
if (timeout_seconds <= 0) {
dio_set(&power, 1);
_delay_ms(50);
dio_set(&power, 0);
timeout_seconds = TIMEOUT;
}
timeout_seconds--;
_delay_ms(1000);
}
}