3 ms·
Splitting of work to dedicated functions is done as usual. General functions, which don't impact state, should be free-standing. Non-trivial independent functio
by jononor 10y ago
Splitting of work to dedicated functions is done as usual. General functions, which don't impact state, should be free-standing. Non-trivial independent functionality should be in separate functions, passing down the relevant state (subsets of the overall state).
As long as there are no side-effects, can do as much higher-order functions as desired.
Sleeping is not affected? Can trigger that whenever you want. Only difference is that there is no 'implicit' sleeping from registering a callback.
But if using an exisiting RTOS, there might be serious impedance mismatch causing this approach to not worth it.
- dllthomas 10y agoI think the concern around sleeping is that you don't know how long you can safely sleep for without knowing to inspect state.toggleLedTime (and every similar value - potentially error prone).