From 99b58d1e20a3d9afbd549c3eaa17a15cbf81e4f6 Mon Sep 17 00:00:00 2001 From: nighteagle2000 Date: Sat, 4 Jul 2015 07:37:33 +0300 Subject: [PATCH] prescaler always is integer in AVRs prescaler always is integer in AVRs --- MsTimer2.cpp | 59 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/MsTimer2.cpp b/MsTimer2.cpp index 0ab0c04..c6dbbf6 100644 --- a/MsTimer2.cpp +++ b/MsTimer2.cpp @@ -46,8 +46,8 @@ static IntervalTimer itimer; #endif void MsTimer2::set(unsigned long ms, void (*f)()) { - float prescaler = 0.0; - +// float prescaler = 0.0; + int prescaler=0; if (ms == 0) msecs = 1; else @@ -65,15 +65,18 @@ void MsTimer2::set(unsigned long ms, void (*f)()) { if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 TCCR2B |= (1< 16Mhz, prescaler set to 128 TCCR2B |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 TCCR2 |= (1< 16Mhz, prescaler set to 128 TCCR2 |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 TCCR2 |= ((1< 16Mhz, prescaler set to 256 TCCR2 |= (1<= 16000000L) { TCCR4B = (1<= 8000000L) { TCCR4B = (1<= 4000000L) { TCCR4B = (1<= 2000000L) { TCCR4B = (1<= 1000000L) { TCCR4B = (1<= 500000L) { TCCR4B = (1<