PaulStoffregen / TimerOne

TimerOne Library with optimization and expanded hardware support
http://www.pjrc.com/teensy/td_libs_TimerOne.html
470 stars 209 forks source link

cyles not calculated correctly if FCPU > 2000000 #32

Closed holymoly closed 6 years ago

holymoly commented 6 years ago

Description

The Cycles calculation in TimerOne.h line 183 does not work if the FCPU is smaller 2MHz. As this calculation is only for Integers the calculation will end up being 0. F_CPU / 2000000 != 0,5 F_CPU / 2000000 = 0

Steps To Reproduce Problem

Use an FCPU of 1MHz

Hardware & Software

Arduino IDE 1.8.3 Board is a diy Arduino clone -> https://github.com/casartar/MacherDaachBadgeFirmware

Arduino Sketch

none

Errors or Incorrect Output

If cycles is 0 the interuppt does not work correctly.