avr/power-management/main.c

21 lines
460 B
C
Raw Normal View History

2022-07-30 04:33:46 +00:00
#include <dio.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);
}
}