Skip to content

Commit 9bfdcf8

Browse files
authored
Merge pull request #18 from fourstix/b_revert
Reverted write_then_readinto() to write() followed by read().
2 parents 1cb13f2 + 271d51b commit 9bfdcf8

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,23 @@ Usage Example
160160
# cs.direction = digitalio.Direction.OUTPUT
161161
# as3935 = QwiicAS3935_SPI(spi, cs)
162162
163+
Upgrading
164+
=========
165+
On supported GNU/Linux systems like the Raspberry Pi, you can upgrade the driver
166+
to the latest published version.
167+
168+
To upgrade for current user:
169+
170+
.. code-block:: shell
171+
172+
pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
173+
174+
To upgrade system-wide (this may be required in some cases):
175+
176+
.. code-block:: shell
177+
178+
sudo pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
179+
163180
Contributing
164181
============
165182

sparkfun_qwiicas3935.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,12 @@ def _read_register(self, register):
598598
# In the original commments, Phil Fenstermacher (pcfens) says this
599599
# trick is required because smbus doesn't support repeated I2C
600600
# starts to read the registers directly (singularly) on the sensor.
601+
i2c.write(bytes([0x00]))
601602
result = bytearray(9)
602-
i2c.write_then_readinto(bytes([0x00]), result)
603+
# write_then_readinto() does not work reliably,
604+
# so do explicit write followed by read into
605+
# i2c.write_then_readinto(bytes([0x00]), result)
606+
i2c.readinto(result)
603607
if self._debug:
604608
print([hex(i) for i in result])
605609
print("$%02X => %s" % (register, hex(result[register])))
@@ -621,8 +625,12 @@ def _read_byte(self, register):
621625
# In the original commments, Phil Fenstermacher (pcfens) says this
622626
# trick is required because smbus doesn't support repeated I2C
623627
# starts to read the registers directly (singularly) on the sensor.
628+
i2c.write(bytes([0x00]))
624629
result = bytearray(0x3E)
625-
i2c.write_then_readinto(bytes([0x00]), result)
630+
# write_then_readinto() does not work reliably,
631+
# so do explicit write followed by read into
632+
# i2c.write_then_readinto(bytes([0x00]), result)
633+
i2c.readinto(result)
626634
if self._debug:
627635
print([hex(i) for i in result])
628636
print("$%02X => %s" % (register, hex(result[register])))

0 commit comments

Comments
 (0)