Closed
Description
Hi @dastels, didn't have a chance to review this before today. Just a couple of comments;
-
Why check for
interval is None
in the constructor if it already has a default value? I thinkself._interval = interval
would be sufficient. -
Do
from micropython import const
...
_DEBOUNCED_STATE = const(0x01)
_UNSTABLE_STATE = const(0x02)
_CHANGED_STATE = const(0x04)
This will, at compile time, substitute the integer values for the names. This speeds up the code and makes it smaller. The underscored names will actually disappear from the compiled code because they aren't exeternally available. See
http://docs.micropython.org/en/latest/reference/speed_python.html#the-const-declaration
and
http://docs.micropython.org/en/latest/library/micropython.html?highlight=const#micropython.const
Metadata
Metadata
Assignees
Labels
No labels