Skip to content

Coerce led_current to be between 4-258mA. #4

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

Closed
wants to merge 3 commits into from

Conversation

DaveLangstaff
Copy link

Signed-off-by: Dave Langstaff dpl@aber.ac.uk

Signed-off-by: Dave Langstaff <dpl@aber.ac.uk>
@ladyada ladyada requested a review from siddacious December 15, 2020 15:52
Signed-off-by: DaveLangstaff <dpl@aber.ac.uk>
@DaveLangstaff
Copy link
Author

Apologies - got min and max sawpped, ok and tested better now.

@@ -616,7 +615,9 @@ def led_current(self):
@led_current.setter
@_low_bank
def led_current(self, led_curent):
new_current = int((led_curent - 4) / 2)
"""coerce led_curent to be between 4 & 258, then calculate value
to be put into register on chip"""
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment will not be rendered in the documentation because only the docstring for the getter/@property is rendered. That said, I'm OK with leaving it as a explanation of the code below it. It could also be a comment.

Please edit the setter docstring to mention the range of valid values, and to add something like "invalid values will be rounded to the closest valid number". No need to get overly specific. People who care about the nitty gritty details can read the source ;)

Please keep in mind that we try to talk about properties as nouns and not verbs. led_current doesn't do something, it is something. Apologies if this sounds a bit pedantic, but we try our best to remain consistent in style.

For more info you can see the design guide here:
https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html

@@ -11,7 +11,7 @@

* Author(s): Bryan Siepert

Implementation Notes
Implementation NotesF
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix this typo

@caternuson caternuson mentioned this pull request Jan 22, 2021
@caternuson
Copy link
Contributor

Closing. Fixed with #9.

@ladyada ladyada closed this Jan 24, 2021
@caternuson
Copy link
Contributor

🤦 thanks. must have hit the wrong button.

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