You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need to implement a better way of doing callbacks in the HAL. Currently we have some callbacks for interrupt handlers and for high priority trigger that either:
must use a global function, or
must pass the object the method thereof we want to call, as in the case of communications channels
What we want to do is to be able to pass a generic callback that may also encapsulate a reference to the object upon which it is called. * the caller should not have to be aware of the object's class
there shouldn't have to be global instances of objects
The goal here is to further decouple dependencies. The interrupt implementation should not have to be aware of or hard-code who it is calling on to handle the interrupts. The handlers should not have to refer to any global objects nor possibly even singletons. It should be possible to bind these dependencies in a flexible way at a pretty high level - main.cpp or main_loop.*.
How do you know it has to be done
This is still a stumbling block for decoupling generic libraries from the ICD/computing hardware definitions, because instantiation/initialization of the high priority trigger requires selection of specific channels and timers. We need this done so we can have interchangeable configurations for different hardware setups without having many ifdefs scattered throughout many source files, which makes the code hard to maintain and audit.
Need to implement a better way of doing callbacks in the HAL. Currently we have some callbacks for interrupt handlers and for high priority trigger that either:
What we want to do is to be able to pass a generic callback that may also encapsulate a reference to the object upon which it is called. * the caller should not have to be aware of the object's class
The goal here is to further decouple dependencies. The interrupt implementation should not have to be aware of or hard-code who it is calling on to handle the interrupts. The handlers should not have to refer to any global objects nor possibly even singletons. It should be possible to bind these dependencies in a flexible way at a pretty high level -
main.cpp
ormain_loop.*
.How do you know it has to be done
This is still a stumbling block for decoupling generic libraries from the ICD/computing hardware definitions, because instantiation/initialization of the high priority trigger requires selection of specific channels and timers. We need this done so we can have interchangeable configurations for different hardware setups without having many ifdefs scattered throughout many source files, which makes the code hard to maintain and audit.
Starting points
Using
<functional>
is not an option, as it brings instdlib
and heap memory. Possible solutions:https://codereview.stackexchange.com/questions/152031/simple-callback-wrapper-for-an-embedded-c-app
https://stackoverflow.com/questions/61304132/embedded-c11-member-function-callback
The text was updated successfully, but these errors were encountered: