2022-05-11 18:38:02 +00:00
|
|
|
#include <avr/io.h>
|
|
|
|
#include <util/delay.h>
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
#include "include/uart.h"
|
|
|
|
#include "include/timer.h"
|
2022-05-12 02:46:38 +00:00
|
|
|
#include "include/commands.h"
|
2022-05-11 18:38:02 +00:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2022-05-11 20:21:00 +00:00
|
|
|
/* With this MCU frequency, it is 38,4k baud */
|
|
|
|
uart_init(12);
|
2022-05-11 18:38:02 +00:00
|
|
|
|
2022-05-12 23:24:38 +00:00
|
|
|
printf("Starting up!\r\n");
|
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
/* Make PB2 an output pin */
|
2022-05-11 18:38:02 +00:00
|
|
|
DDRB |= (1 << DDB2);
|
2022-05-12 23:24:38 +00:00
|
|
|
DDRD |= (1 << DDD6);
|
2022-05-11 18:38:02 +00:00
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
initCtcTimer0();
|
2022-05-11 18:38:02 +00:00
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
sei();
|
2022-05-11 18:38:02 +00:00
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
while (1) {
|
2022-05-12 02:46:38 +00:00
|
|
|
if ((PORTB & (1<<PB2))>1) {
|
2022-05-12 16:25:38 +00:00
|
|
|
_delay_us(1);
|
2022-05-12 02:46:38 +00:00
|
|
|
PORTB &= ~(1<<PB2);
|
2022-05-11 20:21:00 +00:00
|
|
|
}
|
2022-05-11 18:38:02 +00:00
|
|
|
}
|
|
|
|
|
2022-05-11 20:21:00 +00:00
|
|
|
return 0;
|
2022-05-11 18:38:02 +00:00
|
|
|
}
|