mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-24 07:04:01 -06:00
i2ccmds: Pass the i2c address as a 7-bit number (0-127)
The sam3 i2c code and the linux code use a 7-bit i2c address, while the avr, lpc176x, and samd21 i2c code uses an 8-bit address with the least significant bit always zero. A similar issue occurred in the host code (sx1509.py and replicape.py use 7-bit addresses while uc1701.py and mcp4451.py use 8-bit addresses). Consistently use 7-bit addresses in all the code. This breaks compatibility between host and mcu software, so make a change to the config_i2c command to force users to synchronize software updates. This also breaks common Smoothieboard configs, so update the mcp4451 code to validate the i2c_address. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f2f54290e8
commit
e26d1a3567
10 changed files with 28 additions and 17 deletions
|
@ -41,8 +41,9 @@ class SX1509(object):
|
|||
REG_INPUT_DISABLE : 0, REG_ANALOG_DRIVER_ENABLE : 0}
|
||||
self.reg_i_on_dict = {reg : 0 for reg in REG_I_ON}
|
||||
def _build_config(self):
|
||||
self._mcu.add_config_cmd("config_i2c oid=%d bus=%d rate=%d addr=%d" % (
|
||||
self._oid, self._bus, self._freq, self._chip_address))
|
||||
self._mcu.add_config_cmd(
|
||||
"config_i2c oid=%d bus=%d rate=%d address=%d" % (
|
||||
self._oid, self._bus, self._freq, self._chip_address))
|
||||
# Reset the chip
|
||||
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%02x" % (
|
||||
self._oid, REG_RESET, 0x12))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue