Skip to content

Automatically detect CPX in examples #30

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

Closed
Sigafoos opened this issue Mar 19, 2018 · 1 comment
Closed

Automatically detect CPX in examples #30

Sigafoos opened this issue Mar 19, 2018 · 1 comment
Assignees

Comments

@Sigafoos
Copy link
Collaborator

The examples here currently default to hardware I2C with commented-out code for CPX, software I2C and hardware SPI.

It would be relatively simple enough to default to "CPX or hardware I2C":


if hasattr(board, 'ACCELEROMETER_SCL'):
    i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
else:
    i2c = busio.I2C(board.SCL, board.SDA)
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19)

This way the two most likely scenarios will Just Work™

(it would obviously need better documentation too)

Sigafoos added a commit to Sigafoos/Adafruit_CircuitPython_LIS3DH that referenced this issue Mar 19, 2018
@kattni
Copy link
Contributor

kattni commented Apr 27, 2018

Fixed by #31

@kattni kattni closed this as completed Apr 27, 2018
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

No branches or pull requests

2 participants