-
Notifications
You must be signed in to change notification settings - Fork 50
enable non-PWM pins for backlight color, add kattni's pi-specific simpletest #16
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
Rationale: pulseio isn't available on CPython Linux systems (i.e. the Pi), this mimics the design of the original Adafruit_Python_CharLCD. Adds `enable_pwm` parameter to Character_LCD_RGB constructor, and conditionalizes handling of the color pins on this value. It's entirely possible I've messed something up here, so close review is appreciated.
rather than enabling pwm, check the attrs? |
yeah, i wasn't super comfortable with the |
i know kattni's done a lot more of this with analog/pwm pins - i'll defer to her wisdom :D |
I'm not super keen on this setup. We've discussed a couple of options such as creating a subclass for non-pwm pins or checking the object types (which also isn't great). Adding CircuitPython LIbrarians. |
Why no love for |
i've gotten a "that's how you do that but you shouldn't want to do that" vibe every time i've googled this in the past, but if it doesn't raise alarm bells for people more steeped in Python Aesthetic than i am, i'll just go that route. threading a bunch of logic around that sort of type check can get weird, but i guess we're not dealing with all that complex a piece of code here... |
I would say |
wrote the |
I like it. Do you need the check in |
yeah, it at least needs to discern there between being a |
# Assume a digitalio.DigitalInOut or compatible interface: | ||
pin.direction = digitalio.Direction.OUTPUT | ||
else: | ||
if not hasattr(pin, 'duty_cycle'): |
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.
Super minor but this can be:
elif not hasattr(pin, 'duty_cycle'):
|
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.
Thanks for the input everyone! Looks great!
Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 2.4.0 from 2.3.2: > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#16 from adafruit/pi_rgb_toggle > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#15 from kattni/rpi-example > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#14 from adafruit/kattni-patch-1 > ignore the board module imports in .pylintrc
Rationale: pulseio isn't available on CPython Linux systems (i.e. the Pi), this mimics the design of the original Adafruit_Python_CharLCD.
Adds
enable_pwm
parameter (defaults toTrue
) to Character_LCD_RGB constructor, and conditionalizes handling of the color pins on this value. If PWM is disabled, pins should beDigitalInOut
instances.It's entirely possible I've messed something up here, so close review is appreciated.