File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 3939# pylint: disable=bad-whitespace
4040_MCP23008_ADDRESS = const (0x20 )
4141_MCP23008_IODIR = const (0x00 )
42+ _MCP23008_IPOL = const (0x01 )
43+ _MCP23008_GPINTEN = const (0x02 )
44+ _MCP23008_DEFVAL = const (0x03 )
45+ _MCP23008_INTCON = const (0x04 )
46+ _MCP23008_IOCON = const (0x05 )
4247_MCP23008_GPPU = const (0x06 )
48+ _MCP23008_INTF = const (0x07 )
49+ _MCP23008_INTCAP = const (0x08 )
4350_MCP23008_GPIO = const (0x09 )
4451
4552
@@ -50,11 +57,11 @@ class MCP23008(MCP230XX):
5057
5158 def __init__ (self , i2c , address = _MCP23008_ADDRESS ):
5259 super ().__init__ (i2c , address )
53- # Reset device state to all pins as inputs (safest option).
54- with self . _device as device :
55- # Write to MCP23008_IODIR register 0xFF followed by 9 zeros
56- # for defaults of other registers.
57- device . write ( ' \x00 \xFF \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 ' )
60+
61+ # Reset to all inputs with no pull-ups and no inverted polarity.
62+ self . iodir = 0xFF
63+ self . gppu = 0x00
64+ self . _write_u8 ( _MCP23008_IPOL , 0x00 )
5865
5966 @property
6067 def gpio (self ):
You can’t perform that action at this time.
0 commit comments