Skip to content

Commit

Permalink
Merge pull request #314 from c0d3z3r0/for-upstream/fake-tristate-relax
Browse files Browse the repository at this point in the history
i2c: relax the bus after epilog in fake-tristate mode
  • Loading branch information
eblot authored Aug 12, 2023
2 parents e0342f5 + 051ccb2 commit 9914488
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyftdi/i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,12 @@ def _clk_lo_data_lo(self) -> Tuple[int]:
self._gpio_low,
self.I2C_DIR | (self._gpio_dir & 0xFF))

@property
def _clk_input_data_input(self) -> Tuple[int]:
return (Ftdi.SET_BITS_LOW,
self._gpio_low,
(self._gpio_dir & 0xFF))

@property
def _idle(self) -> Tuple[int]:
return (Ftdi.SET_BITS_LOW,
Expand Down Expand Up @@ -1037,6 +1043,9 @@ def _do_prolog(self, i2caddress: int) -> None:
def _do_epilog(self) -> None:
self.log.debug(' epilog')
cmd = bytearray(self._stop)
if self._fake_tristate:
# SCL high-Z, SDA high-Z
cmd.extend(self._clk_input_data_input)
self._ftdi.write_data(cmd)
# be sure to purge the MPSSE reply
self._ftdi.read_data_bytes(1, 1)
Expand Down

0 comments on commit 9914488

Please sign in to comment.