Skip to content

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

Merged
merged 5 commits into from
Jan 5, 2019
Merged

Trying this again #1

merged 5 commits into from
Jan 5, 2019

Conversation

dastels
Copy link
Collaborator

@dastels dastels commented Jan 4, 2019

No description provided.

@kattni kattni requested a review from a team January 4, 2019 22:28
Copy link
Contributor

@kattni kattni left a 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!

@kattni
Copy link
Contributor

kattni commented Jan 4, 2019

The Travis error is a Sphinx issue. My first suggestion: try adding microcontroller to docs/conf.py in the autodoc_mock_imports line.

@kattni kattni requested a review from a team January 4, 2019 23:03
@dastels
Copy link
Collaborator Author

dastels commented Jan 4, 2019

Right. It does import microcontroller.

@kattni
Copy link
Contributor

kattni commented Jan 4, 2019

In theory, everything this relies on should be in requirements.txt. However, that means Travis will try to install it and if it can't be found, may fail at that point. So if it's not on PyPI, it needs to go into the automock line.

Copy link
Collaborator

@sommersoft sommersoft left a 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...

pin = digitalio.DigitalInOut(pin_or_predicate)
pin.direction = digitalio.Direction.INPUT
if mode is not None:
pin.pull = mode
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

self.interval = interval


def __set_state(self, bits):
Copy link
Collaborator

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?

Copy link
Collaborator Author

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".


DEBOUNCED_STATE = 0x01
UNSTABLE_STATE = 0x02
CHANGED_STATE = 0x04
Copy link
Collaborator

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
>>> 

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Done.

@kattni kattni merged commit 124b408 into adafruit:master Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants