-
Notifications
You must be signed in to change notification settings - Fork 23
Added examples folder and examples file #7
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! Thanks @mrmcwethy !
adafruit_is31fl3731.py
Outdated
# Tony DiCola | ||
# The MIT License (MIT) | ||
# | ||
# Copyright (c) 2017 Toni DiCola |
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.
Tony
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.
ok
adafruit_is31fl3731.py
Outdated
* `Adafruit 16x9 Charlieplexed PWM LED Matrix Driver - IS31FL3731 <https://www.adafruit.com/product/2946>`_ | ||
* `Adafruit 15x7 CharliePlex LED Matrix Display FeatherWings <https://www.adafruit.com/product/2965>`_ | ||
|
||
* Author(s): Toni DiCola |
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.
Tony
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.
ok
|
||
__version__ = "0.0.0-auto.0" | ||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731.git" |
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.
You can break long strings just like in C:
__repo__ = ("https://github.com/adafruit/"
"Adafruit_CircuitPython_IS31FL3731.git")
and then you don't have to disable the line too long warning.
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.
pylint was complaining about the module description line length
* `Adafruit 16x9 Charlieplexed PWM LED Matrix Driver - IS31FL3731 <https://www.adafruit.com/product/2946>`_
* `Adafruit 15x7 CharliePlex LED Matrix Display FeatherWings <https://www.adafruit.com/product/2965>`_
I didn't know how to split a quoted doc string, i decided to allow long lines in this comment area.
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.
You can just put a newline in place of any space, and indent the new line the same as the previous one.
if frame is None: | ||
return self._frame | ||
if not 0 <= frame <= 8: | ||
raise ValueError("Frame out of range") | ||
self._frame = frame | ||
if show: | ||
self._register(_CONFIG_BANK, _FRAME_REGISTER, frame); | ||
self._register(_CONFIG_BANK, _FRAME_REGISTER, frame) |
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.
Add return None
here at the end to get rid of the "inconsistent return statement" warning.
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.
ok
@@ -173,6 +240,11 @@ def blink(self, rate=None): | |||
self._register(_CONFIG_BANK, _BLINK_REGISTER, rate & 0x07 | 0x08) |
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.
ditto
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.
ok
adafruit_is31fl3731.py
Outdated
:param color: brightness value 0->255 | ||
:param blink: True to blink | ||
:param frame: the frame to set the pixel | ||
""" | ||
if not 0 <= x <= self.width: | ||
return |
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.
Change this to return None
to get rid of the "inconsistent return statement" warning
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.
ok
adafruit_is31fl3731.py
Outdated
:param color: brightness value 0->255 | ||
:param blink: True to blink | ||
:param frame: the frame to set the pixel | ||
""" | ||
if not 0 <= x <= self.width: | ||
return | ||
if not 0 <= y <= self.height: | ||
return |
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.
ditto
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.
ok
@@ -218,13 +300,18 @@ def pixel(self, x, y, color=None, blink=None, frame=None): | |||
else: | |||
bits &= ~(1 << bit) | |||
self._register(frame, _BLINK_OFFSET + addr, 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.
add return None
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.
ok
adafruit_is31fl3731.py
Outdated
@@ -193,15 +265,25 @@ def fill(self, color=None, blink=None, frame=None): | |||
for col in range(18): | |||
self._register(frame, _BLINK_OFFSET + col, data) | |||
|
|||
def _pixel_addr(self, x, y): | |||
def pixel_addr(self, x, y): #pylint: disable-msg=no-self-use |
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.
you can use @staticmethod
here and drop the self
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.
ok
adafruit_is31fl3731.py
Outdated
width = 15 | ||
height = 7 | ||
|
||
def _pixel_addr(self, x, y): | ||
def pixel_addr(self, x, y): #pylint: disable-msg=no-self-use |
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.
also @staticmethod
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.
ok
Thank you! It looks good, except for some nitpicks, and some possible fixes for the linter. |
@deshipu if you like my changes, can you merge it? |
adafruit_is31fl3731.py
Outdated
@@ -67,24 +108,28 @@ def _i2c_write_reg(self, reg, data): | |||
self.i2c.writeto(self.address, buf) | |||
finally: | |||
self.i2c.unlock() | |||
return None |
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.
This one is not needed, since there is no return in that function.
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.
yes, oops
adafruit_is31fl3731.py
Outdated
@@ -115,8 +169,17 @@ def autoplay(self, delay=0, loops=0, frames=0): | |||
self._register(_CONFIG_BANK, _AUTOPLAY1_REGISTER, loops << 4 | frames) | |||
self._register(_CONFIG_BANK, _AUTOPLAY2_REGISTER, delay % 64) | |||
self._mode(_AUTOPLAY_MODE | self._frame) | |||
return | |||
|
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.
This not is not needed either, since the return is empty.
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.
ok
adafruit_is31fl3731.py
Outdated
@@ -162,17 +234,26 @@ def audio_play(self, sample_rate, audio_gain=0, | |||
self._register(_CONFIG_BANK, _GAIN_REGISTER, | |||
bool(agc_enable) << 3 | bool(agc_fast) << 4 | audio_gain) | |||
self._mode(_AUDIOPLAY_MODE) | |||
return |
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.
This one is not needed too.
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.
ok
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.
@deshipu ok, one more time.
Thank you! Sorry for all the nitpicking. |
No reason to be sorry, its better with your comment. i should have done the return stuff instead of the #pylint: disable-msg |
Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 2.1.0 from 1.0.0: > Added examples folder and examples file (adafruit/Adafruit_CircuitPython_IS31FL3731#7) > [adafruit/Adafruit_CircuitPython_IS31FL3731#3] Remove "TODO" and add description with supported hardware. > [adafruit/Adafruit_CircuitPython_IS31FL3731#3] Enable Python syntax highlighting in README examples. > [adafruit/Adafruit_CircuitPython_IS31FL3731#3] Remove "TODO" from README. Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP9808 to 3.1.0 from 3.0.0: > added examples folder and .py file Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 2.1.0 from 2.0.2: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#15 from mrmcwethy/examples Updating https://github.com/adafruit/Adafruit_CircuitPython_HID to 2.1.0 from 2.0.0: > Merge pull request adafruit/Adafruit_CircuitPython_HID#9 from Sigafoos/examples Updating https://github.com/adafruit/Adafruit_CircuitPython_Register to 1.1.0 from 1.0.3: > Merge pull request adafruit/Adafruit_CircuitPython_Register#8 from mrmcwethy/examples > Merge pull request adafruit/Adafruit_CircuitPython_Register#7 from tannewt/lint Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.0.0 from 0.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#1 from mrmcwethy/addexamples Updating https://github.com/adafruit/Adafruit_CircuitPython_Waveform to 1.1.0 from 1.0.0: > added demos for square and sine, fixed square per comment > added a square waveform generator
#adafruit/circuitpython#493
These examples work with the currently released library.
Added examples files for frame.py, blink.py, simple.py, text.py, wave.py
Also linted project.