inv-sw-32u4/src/inverter.c

33 lines
474 B
C
Raw Normal View History

#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "include/uart.h"
#include "include/timer.h"
2022-05-12 02:46:38 +00:00
#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) {
2022-05-12 02:46:38 +00:00
if ((PORTB & (1<<PB2))>1) {
_delay_us(1);
2022-05-12 02:46:38 +00:00
PORTB &= ~(1<<PB2);
}
}
return 0;
}