@@ -83,32 +83,31 @@ def __init__(self, i2c, columns, lines):
83
83
on the specified I2C bus with the specified number of columns and lines
84
84
on the display.
85
85
"""
86
- import adafruit_mcp230xx
87
- self ._mcp = adafruit_mcp230xx .MCP23017 (i2c )
88
- reset = self ._mcp .get_pin (15 )
89
- read_write = self ._mcp .get_pin (14 )
90
- enable = self ._mcp .get_pin (13 )
91
- db4 = self ._mcp .get_pin (12 )
92
- db5 = self ._mcp .get_pin (11 )
93
- db6 = self ._mcp .get_pin (10 )
94
- db7 = self ._mcp .get_pin (9 )
95
- red = self ._mcp .get_pin (6 )
96
- green = self ._mcp .get_pin (7 )
97
- blue = self ._mcp .get_pin (8 )
98
- self ._left_button = self ._mcp .get_pin (4 )
99
- self ._up_button = self ._mcp .get_pin (3 )
100
- self ._down_button = self ._mcp .get_pin (2 )
101
- self ._right_button = self ._mcp .get_pin (1 )
102
- self ._select_button = self ._mcp .get_pin (0 )
86
+ from adafruit_mcp230xx .mcp23017 import MCP23017
87
+ mcp = MCP2317 (i2c )
88
+
89
+ self ._left_button = mcp .get_pin (4 )
90
+ self ._up_button = mcp .get_pin (3 )
91
+ self ._down_button = mcp .get_pin (2 )
92
+ self ._right_button = mcp .get_pin (1 )
93
+ self ._select_button = mcp .get_pin (0 )
103
94
104
95
self ._buttons = [self ._left_button , self ._up_button , self ._down_button , self ._right_button ,
105
96
self ._select_button ]
106
97
107
- for pin in self ._buttons :
108
- pin .switch_to_input (pull = digitalio .Pull .UP )
98
+ super ().__init__ (mcp .get_pin (15 ),
99
+ mcp .get_pin (13 ),
100
+ mcp .get_pin (12 ),
101
+ mcp .get_pin (11 ),
102
+ mcp .get_pin (10 ),
103
+ mcp .get_pin (9 ),
104
+ columns ,
105
+ lines ,
106
+ mcp .get_pin (6 ),
107
+ mcp .get_pin (7 ),
108
+ mcp .get_pin (8 ),
109
+ mcp .get_pin (14 ))
109
110
110
- super ().__init__ (reset , enable , db4 , db5 , db6 , db7 , columns , lines , red , green , blue ,
111
- read_write )
112
111
113
112
@property
114
113
def left_button (self ):
0 commit comments