File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 37
37
__version__ = "0.0.0-auto.0"
38
38
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx.git"
39
39
40
+ # pylint: disable=bad-whitespace
40
41
_MCP23008_ADDRESS = const (0x20 )
41
42
_MCP23008_IODIR = const (0x00 )
42
43
_MCP23008_GPPU = const (0x06 )
43
44
_MCP23008_GPIO = const (0x09 )
44
45
45
46
46
47
class MCP23008 (MCP230XX ):
47
- """Initialize MCP23008 instance on specified I2C bus and optionally
48
+ """Supports MCP23008 instance on specified I2C bus and optionally
48
49
at the specified I2C address.
49
50
"""
50
51
51
52
def __init__ (self , i2c , address = _MCP23008_ADDRESS ):
52
- self . _device = i2c_device . I2CDevice (i2c , address )
53
+ super (). __init__ (i2c , address )
53
54
# Reset device state to all pins as inputs (safest option).
54
55
with self ._device as device :
55
56
# Write to MCP23008_IODIR register 0xFF followed by 9 zeros
Original file line number Diff line number Diff line change 37
37
__version__ = "0.0.0-auto.0"
38
38
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx.git"
39
39
40
+ # pylint: disable=bad-whitespace
40
41
_MCP23017_ADDRESS = const (0x20 )
41
42
_MCP23017_IODIRA = const (0x00 )
42
43
_MCP23017_IODIRB = const (0x01 )
52
53
53
54
54
55
class MCP23017 (MCP230XX ):
55
- """Initialize MCP23017 instance on specified I2C bus and optionally
56
+ """Supports MCP23017 instance on specified I2C bus and optionally
56
57
at the specified I2C address.
57
58
"""
58
59
59
60
def __init__ (self , i2c , address = _MCP23017_ADDRESS ):
60
- self . _device = i2c_device . I2CDevice (i2c , address )
61
+ super (). __init__ (i2c , address )
61
62
# Reset to all inputs with no pull-ups and no inverted polarity.
62
63
self .iodir = 0xFFFF
63
64
self .gppu = 0x0000
Original file line number Diff line number Diff line change 38
38
_BUFFER = bytearray (3 )
39
39
40
40
class MCP230XX :
41
+ """Base class for MCP230xx devices."""
42
+
43
+ def __init__ (self , i2c , address ):
44
+ self ._device = i2c_device .I2CDevice (i2c , address )
41
45
42
46
def _read_u16le (self , register ):
43
47
# Read an unsigned 16 bit little endian value from the specified 8-bit
You can’t perform that action at this time.
0 commit comments