|
8 | 8 | # registers |
9 | 9 | _EXPANDER_REG_INPUTS = const(0x04) |
10 | 10 | _EXPANDER_REG_ANALOG = const(0x06) |
11 | | -_EXPANDER_REG_LCD_BRIGHTNESS = const(0x10) |
12 | | -_EXPANDER_REG_DEBUG_LED = const(0x12) |
13 | | -_EXPANDER_REG_CONFIG = const(0x14) |
| 11 | +_EXPANDER_REG_LCD_BRIGHTNESS = const(0x12) |
| 12 | +_EXPANDER_REG_DEBUG_LED = const(0x14) |
| 13 | +_EXPANDER_REG_CONFIG = const(0x16) |
14 | 14 |
|
15 | 15 | _EXPANDER_I2CADDR_DEFAULT = const(0x50) |
16 | 16 |
|
@@ -38,10 +38,9 @@ def __init__( |
38 | 38 | def int_callback(self, p): |
39 | 39 | self.i2c.readfrom_mem_into(self.address, _EXPANDER_REG_INPUTS, self._rx_mv) |
40 | 40 |
|
41 | | - @property |
42 | | - def analog(self) -> tuple[int, int, int, int, int]: |
43 | | - """Read the analog inputs: ain1, battery_monitor, usb_monitor, joystick_y, joystick_x""" |
44 | | - return self._read("<HHHHH", _EXPANDER_REG_ANALOG, 10) |
| 41 | + def analog(self) -> tuple[int, int, int, int, int, int]: |
| 42 | + """Read the analog inputs: ain1, ain0, battery_monitor, usb_monitor, joystick_y, joystick_x""" |
| 43 | + return self._read("<HHHHHH", _EXPANDER_REG_ANALOG, 12) |
45 | 44 |
|
46 | 45 | @property |
47 | 46 | def digital( |
@@ -77,10 +76,10 @@ def debug_led(self, value: int): |
77 | 76 | self._write(_EXPANDER_REG_DEBUG_LED, struct.pack("<H", value)) |
78 | 77 |
|
79 | 78 | @property |
80 | | - def config(self) -> tuple[bool, bool, bool, bool, bool, bool]: |
81 | | - """Read the configuration bits: ain0_pd, lora_reset, remap, reboot, lcd_reset, aux_power""" |
| 79 | + def config(self) -> tuple[bool, bool, bool]: |
| 80 | + """Read the configuration bits: reboot, lcd_reset, aux_power""" |
82 | 81 | config = self._read("B", _EXPANDER_REG_CONFIG, 1)[0] |
83 | | - return tuple([bool(int(digit)) for digit in "{:08b}".format(config)[2:]]) |
| 82 | + return tuple([bool(int(digit)) for digit in "{:08b}".format(config)[5:]]) |
84 | 83 |
|
85 | 84 | @config.setter |
86 | 85 | def config(self, value: int): |
|
0 commit comments