Adafruit_ZeroTimer | happy wrappers for TC modules 3,4,5 on SAMD21 | Audio Utils library
kandi X-RAY | Adafruit_ZeroTimer Summary
kandi X-RAY | Adafruit_ZeroTimer Summary
simple wrappers for TC modules 3,4,5 on SAMD21 and SAMD51.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Adafruit_ZeroTimer
Adafruit_ZeroTimer Key Features
Adafruit_ZeroTimer Examples and Code Snippets
Community Discussions
Trending Discussions on Adafruit_ZeroTimer
QUESTION
I'am working with this library, as you can see setCallback
as a protoype like this void Adafruit_ZeroTimer::setCallback(boolean enable, tc_callback cb_type,void (*callback_func)(void)){
I would like to know if it's possible to pass arguments to callback function?
Should I change the library to accomplish that by something like that void (*callback_func)(int n)
and create in my sketch void my_function_callback(int n){...}
and when I create my timer my_timer.zerotimer.setCallback(true, TC_CALLBACK_CC_CHANNEL0, my_function_callback(10))
?
ANSWER
Answered 2021-May-31 at 13:02Adding argument to the type of callback function for the argument like void (*callback_func)(int n)
is right way.
Calling function in argument instead of passing the function like my_timer.zerotimer.setCallback(true, TC_CALLBACK_CC_CHANNEL0, my_function_callback(10))
is wrong way. You should simply pass the function without calling that like my_timer.zerotimer.setCallback(true, TC_CALLBACK_CC_CHANNEL0, my_function_callback)
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Adafruit_ZeroTimer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page