Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add address parameter
  • Loading branch information
caternuson committed Jan 17, 2020
commit 0de54c1c9a37b7c5429304b63018cdfc8cd515e4
7 changes: 5 additions & 2 deletions adafruit_character_lcd/character_lcd_i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ class Character_LCD_I2C(Character_LCD_Mono):
i2c = busio.I2C(board.SCL, board.SDA)
lcd = Character_LCD_I2C(i2c, 16, 2)
"""
def __init__(self, i2c, columns, lines, backlight_inverted=False):
def __init__(self, i2c, columns, lines, address=None, 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.
"""
from adafruit_mcp230xx.mcp23008 import MCP23008
mcp = MCP23008(i2c)
if address:
mcp = MCP23008(i2c, address=address)
else:
mcp = MCP23008(i2c)
super().__init__(mcp.get_pin(1),
mcp.get_pin(2),
mcp.get_pin(3),
Expand Down
7 changes: 5 additions & 2 deletions adafruit_character_lcd/character_lcd_rgb_i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ class Character_LCD_RGB_I2C(Character_LCD_RGB):
lcd = Character_LCD_RGB_I2C(i2c, 16, 2)

"""
def __init__(self, i2c, columns, lines):
def __init__(self, i2c, columns, lines, address=None):
# pylint: disable=too-many-locals
"""Initialize RGB character LCD connected to shield using I2C connection
on the specified I2C bus with the specified number of columns and lines
on the display.
"""
from adafruit_mcp230xx.mcp23017 import MCP23017
mcp = MCP23017(i2c)
if address:
mcp = MCP23017(i2c, address=address)
else:
mcp = MCP23017(i2c)

self._left_button = mcp.get_pin(4)
self._up_button = mcp.get_pin(3)
Expand Down