From f56782bb87bdbd1f9b1cd2feeefada03c3248089 Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Thu, 29 Sep 2022 00:03:49 -0400 Subject: [PATCH] v1.10.0 to avoid conflict with `Servo library` ### Releases v1.10.0 1. Avoid conflict with Servo library. Check [Cannot use TimerInterrupt_Generic Library in the same time than Servo Library #11](https://github.com/khoih-prog/TimerInterrupt_Generic/discussions/11) 2. Prevent overflow of TCx by flagging error 3. Modify all examples 4. Update `Packages_Patches` --- src/SAMDTimerInterrupt_Impl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SAMDTimerInterrupt_Impl.h b/src/SAMDTimerInterrupt_Impl.h index f7a2482..d958f01 100644 --- a/src/SAMDTimerInterrupt_Impl.h +++ b/src/SAMDTimerInterrupt_Impl.h @@ -273,10 +273,12 @@ { TISR_LOGDEBUG1(F("_timerNumber ="), _timerNumber); - // (65536 * 1024) / 48 = 1,398,101.33us - if (_period > 1398101.3f) + // maxPermittedPeriod = 1,398,101.33us for 48MHz clock + float maxPermittedPeriod = (65536.0f * 1024) / (F_CPU / 1000000.0f ); + + if (_period > maxPermittedPeriod ) { - TISR_LOGERROR1(F("Max permissible _period = 1,398,101.33us, current _period ="), _period); + TISR_LOGERROR3(F("Max permissible _period (us) ="), maxPermittedPeriod, F(", current _period (us) ="), _period); return false; }