Capturing variables for timer callbacks? #1146
Unanswered
BostonBoston
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Is lambda created locally? not sure how it works and where it must leave. it should not stay in the stack. Also, |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my application I wanted to create a non blocking way to pulse a relay for a specified duration, my initial though was to capture the pin data needed to pulse and give it to a timer callback, looking something like this:
The idea being that I set the relay, then when the timer expires it toggles the state, this does not work, I think related to a note I read in the docs about
etl::delegate
being non owning.Is there anything I can do to accomplish what I wish? Or will I need to create a free function for each relay and assign them through control flow.
Beta Was this translation helpful? Give feedback.
All reactions