Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update I2C transceive #17

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
May 22, 2020
Merged

Update I2C transceive #17

merged 1 commit into from
May 22, 2020

Conversation

caternuson
Copy link
Contributor

This should fix:
adafruit/Adafruit_CircuitPython_TCA9548A#19

The TCA9548 library switches all channels "off" at the exit of a context manager, which calls unlock():
https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A/blob/687a11e6ea197da3722e3202d2eda93ad75d3fc9/adafruit_tca9548a.py#L71
As a result, an I2C STOP is generated.

This PR consolidates two context managers which was causing an I2C STOP to be generated between to the separate I2C write and reads in one branch of the _transceive() code.

Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit ItsyBitsy M4 Express with samd51g19
>>> import board, busio, adafruit_mlx90393, adafruit_tca9548a
>>> tca = adafruit_tca9548a.TCA9548A(board.I2C())
>>> mlx = adafruit_mlx90393.MLX90393(tca[7])
>>> mlx.magnetic
(-300.15, 40.95, 181.016)
>>> mlx.magnetic
(1960.95, -3556.95, 7551.12)
>>>

@caternuson caternuson requested a review from a team May 22, 2020 20:41
Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops good catch!

@caternuson caternuson merged commit d6396ea into adafruit:master May 22, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants