-
Notifications
You must be signed in to change notification settings - Fork 52
Refactor complete! #19
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
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3e6a1a6
I2C working, SPI needs testing
kattni 9027f16
SPI pin change.
kattni 7fa1519
Add I2C to RGB, get_pin() to 74HC595
kattni 287864b
Current status: functional.
kattni de93de2
Backlight now a property.
kattni b5adf5e
Needs test: RPi, M0, standalone LCDs
kattni 80f8222
Example rename for rpi
kattni 97a57fe
Updated example named, added RGB I2C
kattni 645da5f
Update package init
kattni 70f673e
Moved imports to speed up on M0
kattni e490b7f
Removed __init__.py, updated import method to resolve M0 mem issue
kattni ee9544a
RGB subclass currently functional.
kattni 6e064f9
I2C not currently functional.
kattni 95a9f14
SPI working, I2C not.
kattni 8fe9cf2
Removing superfluous rgb.py file
kattni 1258c47
Refactored, updated examples, appeased Sphinx.
kattni af6e023
Remove self.backlight_inverted, use property
kattni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
SPI working, I2C not.
- Loading branch information
commit 95a9f14c8d2518ac0610068903a25b2f6b1e3b2d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| from adafruit_character_lcd.character_lcd import Character_LCD_Mono | ||
|
|
||
|
|
||
| class Character_LCD_I2C(Character_LCD_Mono): | ||
| """Character LCD connected to I2C/SPI backpack using its I2C connection. | ||
| This is a subclass of Character_LCD and implements all of the same | ||
| functions and functionality. | ||
|
|
||
| To use, import and initialise as follows: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import board | ||
| import busio | ||
| import adafruit_character_lcd.character_lcd_mono as character_lcd | ||
|
|
||
| i2c = busio.I2C(board.SCL, board.SDA) | ||
| lcd = character_lcd.Character_LCD_I2C(i2c, 16, 2) | ||
| """ | ||
| def __init__(self, i2c, columns, lines, backlight_inverted=False): | ||
| """Initialize character LCD connected to backpack using I2C connection | ||
| on the specified I2C bus with the specified number of columns and | ||
| lines on the display. Optionally specify if backlight is inverted. | ||
| """ | ||
| import adafruit_mcp230xx | ||
| self._mcp = adafruit_mcp230xx.MCP23008(i2c) | ||
| reset = self._mcp.get_pin(1) | ||
| enable = self._mcp.get_pin(2) | ||
| db4 = self._mcp.get_pin(3) | ||
| db5 = self._mcp.get_pin(4) | ||
| db6 = self._mcp.get_pin(5) | ||
| db7 = self._mcp.get_pin(6) | ||
| backlight_pin = self._mcp.get_pin(7) | ||
| self.backlight_inverted = backlight_inverted | ||
| super().__init__(reset, enable, db4, db5, db6, db7, columns, lines, | ||
| backlight_pin=backlight_pin, backlight_inverted=backlight_inverted) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| from adafruit_character_lcd.character_lcd import Character_LCD_Mono | ||
|
|
||
|
|
||
| class Character_LCD_SPI(Character_LCD_Mono): | ||
| """Character LCD connected to I2C/SPI backpack using its SPI connection. | ||
| This is a subclass of Character_LCD and implements all of the same | ||
| functions and functionality. | ||
|
|
||
| To use, import and initialise as follows: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| import board | ||
| import busio | ||
| import digitalio | ||
| import adafruit_character_lcd.character_lcd_mono as character_lcd | ||
|
|
||
| spi = busio.SPI(board.SCK, MOSI=board.MOSI) | ||
| latch = digitalio.DigitalInOut(board.D5) | ||
| lcd = character_lcd.Character_LCD_SPI(spi, latch, 16, 2) | ||
| """ | ||
|
|
||
| def __init__(self, spi, latch, columns, lines, backlight_inverted=False): | ||
| # pylint: disable=too-many-arguments | ||
| """Initialize character LCD connected to backpack using SPI connection | ||
| on the specified SPI bus and latch line with the specified number of | ||
| columns and lines on the display. Optionally specify if backlight is | ||
| inverted. | ||
| """ | ||
| # pylint: enable=too-many-arguments | ||
| import adafruit_74hc595 | ||
| self._shift_register = adafruit_74hc595.ShiftRegister74HC595(spi, latch) | ||
| reset = self._shift_register.get_pin(1) | ||
| enable = self._shift_register.get_pin(2) | ||
| db4 = self._shift_register.get_pin(6) | ||
| db5 = self._shift_register.get_pin(5) | ||
| db6 = self._shift_register.get_pin(4) | ||
| db7 = self._shift_register.get_pin(3) | ||
| backlight_pin = self._shift_register.get_pin(7) | ||
| self.backlight_inverted = backlight_inverted | ||
| super().__init__(reset, enable, db4, db5, db6, db7, columns, lines, | ||
| backlight_pin=backlight_pin, backlight_inverted=backlight_inverted) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.