#include <avr/interrupt.h>
#include <avr/io.h>
#define DEBUG_DDR DDRB
#define DEBUG_PIN 5
#define DEBUG_PORT PORTB
#include "debug.h"
#include "serial.h"
#include "timer.h"
int main (void)
{
debug_init();
serial_init(SERIAL_BAUD_9600, SERIAL_PARITY_N, SERIAL_STOPBITS_1);
timer_init();
// init
char c = '.';
unsigned short timeout = 8000;
debug_set();
sei();
// start
while (true) {
if (timer_sleep(timeout)) {
c = '.';
} else if ((c = serial_read())) {
} else {
c = '?';
}
debug_toggle();
// out
serial_write(c);
}
}