Skip to content

Commit

Permalink
sx1509: drop i2c_modify_bits
Browse files Browse the repository at this point in the history
According to the datasheet default value is 0000 0000
We do not modify them in other places.

Signed-off-by: Timofey Titovets <[email protected]>
  • Loading branch information
nefelim4ag authored and KevinOConnor committed Sep 22, 2024
1 parent 87ac693 commit 71433b8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions klippy/extras/sx1509.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,17 @@ def __init__(self, config):
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):
# Reset the chip
# Reset the chip, Default RegClock/RegMisc 0x0
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%02x" % (
self._oid, REG_RESET, 0x12))
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%02x" % (
self._oid, REG_RESET, 0x34))
# Enable Oscillator
self._mcu.add_config_cmd("i2c_modify_bits oid=%d reg=%02x"
" clear_set_bits=%02x%02x" % (
self._oid, REG_CLOCK, 0, (1 << 6)))
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%02x" % (
self._oid, REG_CLOCK, (1 << 6)))
# Setup Clock Divider
self._mcu.add_config_cmd("i2c_modify_bits oid=%d reg=%02x"
" clear_set_bits=%02x%02x" % (
self._oid, REG_MISC, 0, (1 << 4)))
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%02x" % (
self._oid, REG_MISC, (1 << 4)))
# Transfer all regs with their initial cached state
for _reg, _data in self.reg_dict.items():
self._mcu.add_config_cmd("i2c_write oid=%d data=%02x%04x" % (
Expand Down

0 comments on commit 71433b8

Please sign in to comment.