@@ -83,32 +83,34 @@ 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 = MCP23017 (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
98
for pin in self ._buttons :
108
99
pin .switch_to_input (pull = digitalio .Pull .UP )
109
100
110
- super ().__init__ (reset , enable , db4 , db5 , db6 , db7 , columns , lines , red , green , blue ,
111
- read_write )
101
+ super ().__init__ (mcp .get_pin (15 ),
102
+ mcp .get_pin (13 ),
103
+ mcp .get_pin (12 ),
104
+ mcp .get_pin (11 ),
105
+ mcp .get_pin (10 ),
106
+ mcp .get_pin (9 ),
107
+ columns ,
108
+ lines ,
109
+ mcp .get_pin (6 ),
110
+ mcp .get_pin (7 ),
111
+ mcp .get_pin (8 ),
112
+ mcp .get_pin (14 ))
113
+
112
114
113
115
@property
114
116
def left_button (self ):
0 commit comments