diff --git a/src/timer.c b/src/timer.c index b91619a..c04ad11 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,6 +1,9 @@ #include #include +#include +#include + #include "include/timer.h" void initCtcTimer0(void) @@ -11,7 +14,7 @@ void initCtcTimer0(void) /* Enable Counter0 Compare Match A Interrupt */ TIMSK0 |= (1 << OCIE0A); - /* Select clock. Prescaler of 8 */ + /* Select clock. Prescaler of 1024 */ TCCR0B |= (1 << CS02) | (1 << CS00); /* Use CTC Mode */ @@ -20,7 +23,7 @@ void initCtcTimer0(void) /* * OCR0A contains TOP value for counter: */ - OCR0A = 100; + OCR0A = 255; } void initOverflowTimer0(void) @@ -38,7 +41,15 @@ void initOverflowTimer1(void) TIMSK1 |= (1< 0) { + printf("%.2lf\n\r", sin(sin_op)); + sin_op = ((sin_op + 0.01) > 2*M_PI) ? 0.0 : sin_op + .01; + wait_cnt = 0; + } + wait_cnt++; }