Stator icon indicating copy to clipboard operation
Stator copied to clipboard

possible improvements?

Open jscrane opened this issue 6 years ago • 1 comments

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 msSinceLastAssign by msLastChange?

(I guess my main use-case so far is just switch debouncing in software though.)

jscrane avatar May 13 '19 10:05 jscrane

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.

timonsku avatar May 13 '19 13:05 timonsku