Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit f56782b

Browse files
authored
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](khoih-prog/TimerInterrupt_Generic#11) 2. Prevent overflow of TCx by flagging error 3. Modify all examples 4. Update `Packages_Patches`
1 parent 22df0e3 commit f56782b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/SAMDTimerInterrupt_Impl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,12 @@
273273
{
274274
TISR_LOGDEBUG1(F("_timerNumber ="), _timerNumber);
275275

276-
// (65536 * 1024) / 48 = 1,398,101.33us
277-
if (_period > 1398101.3f)
276+
// maxPermittedPeriod = 1,398,101.33us for 48MHz clock
277+
float maxPermittedPeriod = (65536.0f * 1024) / (F_CPU / 1000000.0f );
278+
279+
if (_period > maxPermittedPeriod )
278280
{
279-
TISR_LOGERROR1(F("Max permissible _period = 1,398,101.33us, current _period ="), _period);
281+
TISR_LOGERROR3(F("Max permissible _period (us) ="), maxPermittedPeriod, F(", current _period (us) ="), _period);
280282
return false;
281283
}
282284

0 commit comments

Comments
 (0)