Invoke pwm module in main()

This commit is contained in:
Marco 2022-05-31 00:11:44 +02:00
parent a7f54de603
commit ebd763cbe7

View File

@ -1,11 +1,13 @@
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h> #include <util/delay.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <math.h>
#include "uart.h" #include "uart.h"
#include "timer.h" #include "timer.h"
#include "commands.h" #include "commands.h"
#include "pins.h" #include "pins.h"
#include "pwm.h"
int main() int main()
{ {
@ -14,12 +16,22 @@ int main()
/* With this MCU frequency (8MHz), 12 is a baudrate of 38.4k baud */ /* With this MCU frequency (8MHz), 12 is a baudrate of 38.4k baud */
uart_init(12); uart_init(12);
initPwmTimer1(); pwm_init();
timer_initT1();
DDRB |= (1 << DDB5);
DDRD |= (1 << DDD7);
printf("Up and running.\n\r");
while (1) { while (1) {
/* We handle terminated commands here. /* We handle terminated commands here.
Outside of the context of the UART receive interrupt. */ Outside of the context of the UART receive interrupt. */
cmd_handle(cmd_getcommand()); cmd_handle(cmd_getcommand());
pwm_worker();
} }
return 0; return 0;