Skip to content

Commit 6e064f9

Browse files
committed
I2C not currently functional.
1 parent ee9544a commit 6e064f9

File tree

2 files changed

+38
-75
lines changed

2 files changed

+38
-75
lines changed

adafruit_character_lcd/character_lcd.py

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -687,78 +687,3 @@ def color(self, color):
687687
# 0 (on) to pin for any value greater than 0, or 1 (off) for 0:
688688
pin.value = 0 if color[number] > 0 else 1
689689

690-
691-
class Character_LCD_I2C(Character_LCD):
692-
"""Character LCD connected to I2C/SPI backpack using its I2C connection.
693-
This is a subclass of Character_LCD and implements all of the same
694-
functions and functionality.
695-
696-
To use, import and initialise as follows:
697-
698-
.. code-block:: python
699-
700-
import board
701-
import busio
702-
import adafruit_character_lcd.character_lcd_mono as character_lcd
703-
704-
i2c = busio.I2C(board.SCL, board.SDA)
705-
lcd = character_lcd.Character_LCD_I2C(i2c, 16, 2)
706-
"""
707-
def __init__(self, i2c, columns, lines, backlight_inverted=False):
708-
"""Initialize character LCD connectedto backpack using I2C connection
709-
on the specified I2C bus with the specified number of columns and
710-
lines on the display. Optionally specify if backlight is inverted.
711-
"""
712-
import adafruit_mcp230xx
713-
self._mcp = adafruit_mcp230xx.MCP23008(i2c)
714-
reset = self._mcp.get_pin(1)
715-
enable = self._mcp.get_pin(2)
716-
db4 = self._mcp.get_pin(3)
717-
db5 = self._mcp.get_pin(4)
718-
db6 = self._mcp.get_pin(5)
719-
db7 = self._mcp.get_pin(6)
720-
backlight_pin = self._mcp.get_pin(7)
721-
self.backlight_inverted = backlight_inverted
722-
super().__init__(reset, enable, db4, db5, db6, db7, columns, lines,
723-
backlight_pin=backlight_pin, backlight_inverted=backlight_inverted)
724-
725-
726-
class Character_LCD_SPI(Character_LCD):
727-
"""Character LCD connected to I2C/SPI backpack using its SPI connection.
728-
This is a subclass of Character_LCD and implements all of the same
729-
functions and functionality.
730-
731-
To use, import and initialise as follows:
732-
733-
.. code-block:: python
734-
735-
import board
736-
import busio
737-
import digitalio
738-
import adafruit_character_lcd.character_lcd_mono as character_lcd
739-
740-
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
741-
latch = digitalio.DigitalInOut(board.D5)
742-
lcd = character_lcd.Character_LCD_SPI(spi, latch, 16, 2)
743-
"""
744-
745-
def __init__(self, spi, latch, columns, lines, backlight_inverted=False):
746-
# pylint: disable=too-many-arguments
747-
"""Initialize character LCD connected to backpack using SPI connection
748-
on the specified SPI bus and latch line with the specified number of
749-
columns and lines on the display. Optionally specify if backlight is
750-
inverted.
751-
"""
752-
# pylint: enable=too-many-arguments
753-
import adafruit_74hc595
754-
self._shift_register = adafruit_74hc595.ShiftRegister74HC595(spi, latch)
755-
reset = self._shift_register.get_pin(1)
756-
enable = self._shift_register.get_pin(2)
757-
db4 = self._shift_register.get_pin(6)
758-
db5 = self._shift_register.get_pin(5)
759-
db6 = self._shift_register.get_pin(4)
760-
db7 = self._shift_register.get_pin(3)
761-
backlight_pin = self._shift_register.get_pin(7)
762-
self.backlight_inverted = backlight_inverted
763-
super().__init__(reset, enable, db4, db5, db6, db7, columns, lines,
764-
backlight_pin=backlight_pin, backlight_inverted=backlight_inverted)

adafruit_character_lcd/rgb_i2c.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from adafruit_character_lcd.character_lcd import Character_LCD_RGB
2+
3+
4+
class Character_LCD_I2C_RGB(Character_LCD_RGB):
5+
"""RGB Character LCD connected to I2C shield using I2C connection.
6+
This is a subclass of Character_LCD_RGB and implements all of the same
7+
functions and functionality.
8+
9+
To use, import and initialise as follows:
10+
11+
.. code-block:: python
12+
13+
import board
14+
import busio
15+
import adafruit_character_lcd.character_lcd_rgb as character_lcd
16+
17+
i2c = busio.I2C(board.SCL, board.SDA)
18+
lcd = character_lcd.Character_LCD_I2C_RGB(i2c, 16, 2)
19+
"""
20+
def __init__(self, i2c, columns, lines):
21+
"""Initialize RGB character LCD connected to shield using I2C connection
22+
on the specified I2C bus with the specified number of columns and lines
23+
on the display.
24+
"""
25+
import adafruit_mcp230xx
26+
self._mcp = adafruit_mcp230xx.MCP23017(i2c)
27+
reset = self._mcp.get_pin(15)
28+
read_write = self._mcp.get_pin(14)
29+
enable = self._mcp.get_pin(13)
30+
db4 = self._mcp.get_pin(12)
31+
db5 = self._mcp.get_pin(11)
32+
db6 = self._mcp.get_pin(10)
33+
db7 = self._mcp.get_pin(9)
34+
red = self._mcp.get_pin(6)
35+
green = self._mcp.get_pin(7)
36+
blue = self._mcp.get_pin(8)
37+
super().__init__(reset, enable, db4, db5, db6, db7, columns, lines, red, green, blue,
38+
read_write)

0 commit comments

Comments
 (0)