Closed sdetweil closed 3 years ago
and then theres this
// Interval in microsecs ... then the comment says micro if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_MS * 1000, TimerHandler)) // but this seems to imply 1 second
or it means you want Millisecond interval, but the timer is microseconds in which case I would change the constant to
and take the multiply out
just trying to understand the words
using either TCC or TC3 both work
thank you for a great library!
Thanks for your interest in the library, and I'm glad to have chance to work with a SAMD-related person here ;-)
You're using NANO_33_IOT, which is using SAMD21 MCU and you can use both TC3 and TCC timers. You have to pick the timer not being used by the core or other libraries, you have to read or try to know.
define HW_TIMER_INTERVAL_MS 1L // so I think MS means Mili-seconds as Micro is usually codes uS
// Interval in microsecs ... then the comment says micro if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_MS * 1000, TimerHandler)) // but this seems to imply 1 second
The timer count unit in
ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_MS * 1000, TimerHandler);
is in microseconds (which in HW or SW, we use uS, while ms is for miilisecond).
So if you're using HW_TIMER_INTERVAL_MS
in ms, you have to multiply to 1000 to convert to uS.
Or if you're defining in uS, you can use it directly
ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler);
Thanks and happy exploring,
Best Regards,
I am using NANO IOT, SAMD board all I want is a timer2 isr routine to count so I can replace millis() which uses timer 0 and I have to use low power sleep which kills timer 0.
but I am missing some terminology, and haven't found a place to get it. from the sample
what is the difference between SAMD21 or SAMD51 and what is TCC and TC3 and why would I pick one of the other and how does all this relate to timer2?
I have written ISR in just about every language on just about every hardware type, so all of the process is not the problem
your library looks like it encapsulates all the prescaler and other technical goop I don't want to know about, which is wonderful. just need to get over the hump somehow.
(and my name is Sam D... which is pretty coincidental)