From 3fd547f2ea87a71ba97d93636d1ebf9027f42c1e Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 13 May 2022 01:24:38 +0200 Subject: [PATCH] Toggle PD6 instead of PC7 when timer compare interrupt occurs. Move timer interrupt routine to timer.c Change timer parameters --- src/commands.c | 4 ++-- src/inverter.c | 10 +++------- src/timer.c | 13 ++++++++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/commands.c b/src/commands.c index 3fae5a5..0608257 100644 --- a/src/commands.c +++ b/src/commands.c @@ -97,8 +97,8 @@ void cmd_handle_switch(void) { int state = 0; - PORTC ^= (1< +#include + #include "include/timer.h" void initCtcTimer0(void) @@ -10,7 +12,7 @@ void initCtcTimer0(void) TIMSK0 |= (1 << OCIE0A); /* Select clock. Prescaler of 8 */ - TCCR0B |= (1 << CS01); + TCCR0B |= (1 << CS02) | (1 << CS00); /* Use CTC Mode */ TCCR0A |= (1 << WGM01); @@ -18,7 +20,7 @@ void initCtcTimer0(void) /* * OCR0A contains TOP value for counter: */ - OCR0A = 25; + OCR0A = 100; } void initOverflowTimer0(void) @@ -34,4 +36,9 @@ void initOverflowTimer1(void) { TCCR1B |= (1<