-
Notifications
You must be signed in to change notification settings - Fork 15
Trying this again #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Will merge once Travis passes!
The Travis error is a Sphinx issue. My first suggestion: try adding |
Right. It does import microcontroller. |
In theory, everything this relies on should be in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More questions, than bona fide changes...
adafruit_debouncer.py
Outdated
pin = digitalio.DigitalInOut(pin_or_predicate) | ||
pin.direction = digitalio.Direction.INPUT | ||
if mode is not None: | ||
pin.pull = mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been standard practice so far to have the user create these objects (busio
, digitalio
, etc), and pass them in. This will drive associated changes to the simpletests, if changed.
@adafruit/circuitpythonlibrarians thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair. And it removed the dependency on microcontroller.
adafruit_debouncer.py
Outdated
self.interval = interval | ||
|
||
|
||
def __set_state(self, bits): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not so much a request for a change; more of an "enquiring mind wants to know".
Why the choice of double underscores to prefix these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know better when I wrote the code originally, months ago. Changed to single underscore, which I believe is the correct way to denote a member as "private".
adafruit_debouncer.py
Outdated
|
||
DEBOUNCED_STATE = 0x01 | ||
UNSTABLE_STATE = 0x02 | ||
CHANGED_STATE = 0x04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be moved up to the module level? They are only used internally, but are exposed at the class level.
Adafruit CircuitPython 3.0.2 on 2018-09-14; Adafruit Feather M0 Express with samd21g18
>>> class Test():
... ONE = 0
... TWO = 1
... def hi():
... return "Hello"
...
>>> a = Test()
>>> dir(a)
['__qualname__', 'TWO', '__module__', 'hi', 'ONE']
>>> a.ONE
0
>>> a.ONE = 15
>>> a.ONE
15
>>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Done.
No description provided.