inv-sw-32u4/src/inverter.c
Marco 3fd547f2ea Toggle PD6 instead of PC7 when timer compare interrupt occurs.
Move timer interrupt routine to timer.c
Change timer parameters
2022-05-13 01:24:38 +02:00

33 lines
474 B
C

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