Skip to content

Second try to push changes #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,23 @@ Usage Example
# cs.direction = digitalio.Direction.OUTPUT
# as3935 = QwiicAS3935_SPI(spi, cs)

Upgrading
=========
On supported GNU/Linux systems like the Raspberry Pi, you can upgrade the driver
to the latest published version.

To upgrade for current user:

.. code-block:: shell

pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick

To upgrade system-wide (this may be required in some cases):

.. code-block:: shell

sudo pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick

Contributing
============

Expand Down
12 changes: 10 additions & 2 deletions sparkfun_qwiicas3935.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,12 @@ def _read_register(self, register):
# In the original commments, Phil Fenstermacher (pcfens) says this
# trick is required because smbus doesn't support repeated I2C
# starts to read the registers directly (singularly) on the sensor.
i2c.write(bytes([0x00]))
result = bytearray(9)
i2c.write_then_readinto(bytes([0x00]), result)
# write_then_readinto() does not work reliably,
# so do explicit write followed by read into
# i2c.write_then_readinto(bytes([0x00]), result)
i2c.readinto(result)
if self._debug:
print([hex(i) for i in result])
print("$%02X => %s" % (register, hex(result[register])))
Expand All @@ -621,8 +625,12 @@ def _read_byte(self, register):
# In the original commments, Phil Fenstermacher (pcfens) says this
# trick is required because smbus doesn't support repeated I2C
# starts to read the registers directly (singularly) on the sensor.
i2c.write(bytes([0x00]))
result = bytearray(0x3E)
i2c.write_then_readinto(bytes([0x00]), result)
# write_then_readinto() does not work reliably,
# so do explicit write followed by read into
# i2c.write_then_readinto(bytes([0x00]), result)
i2c.readinto(result)
if self._debug:
print([hex(i) for i in result])
print("$%02X => %s" % (register, hex(result[register])))
Expand Down