@@ -82,7 +82,7 @@ def __init__(self, busnum=-1, addr=0x20, debug=False):
82
82
83
83
# I2C is relatively slow. MCP output port states are cached
84
84
# so we don't need to constantly poll-and-change bit states.
85
- self .porta , self .portb , self .ddrb = 0 , 0 , 0b00010000
85
+ self .porta , self .portb , self .ddrb = 0 , 0 , 0b00000010
86
86
87
87
# Set MCP23017 IOCON register to Bank 0 with sequential operation.
88
88
# If chip is already set for Bank 0, this will just write to OLATB,
@@ -187,7 +187,7 @@ def write(self, value, char_mode=False):
187
187
""" Send command/data to LCD """
188
188
189
189
# If pin D7 is in input state, poll LCD busy flag until clear.
190
- if self .ddrb & 0b00010000 :
190
+ if self .ddrb & 0b00000010 :
191
191
lo = (self .portb & 0b00000001 ) | 0b01000000
192
192
hi = lo | 0b00100000 # E=1 (strobe)
193
193
self .i2c .bus .write_byte_data (
@@ -204,7 +204,7 @@ def write(self, value, char_mode=False):
204
204
self .portb = lo
205
205
206
206
# Polling complete, change D7 pin to output
207
- self .ddrb &= 0b11101111
207
+ self .ddrb &= 0b11111101
208
208
self .i2c .bus .write_byte_data (self .i2c .address ,
209
209
self .MCP23017_IODIRB , self .ddrb )
210
210
@@ -249,7 +249,7 @@ def write(self, value, char_mode=False):
249
249
# If a poll-worthy instruction was issued, reconfigure D7
250
250
# pin as input to indicate need for polling on next call.
251
251
if (not char_mode ) and (value in self .pollables ):
252
- self .ddrb |= 0b00010000
252
+ self .ddrb |= 0b00000010
253
253
self .i2c .bus .write_byte_data (self .i2c .address ,
254
254
self .MCP23017_IODIRB , self .ddrb )
255
255
0 commit comments