possible improvements?
Great idea, really cleans up event-loop code!
Was wondering if the following ideas might improve it a little?
-
volatile T(for interrupt handlers) - replace
msSinceLastAssignbymsLastChange?
(I guess my main use-case so far is just switch debouncing in software though.)
Hey thank for your suggestion. volatile for interrupt handlers is something I haven't thought about so far, thanks for bringing it up.
Regarding the naming of 'msSinceLastAssign'. The thing that I wanted to avoid is that it would be seen as functionally equivalent to 'changed()' just with the added info when the last change happened. This function just tracks the last assignment, whether the value actually changed or stayed the same.
I could drop the 'since' though, it may be clear enough without that.