Skip to content

Automatically detect CPX in examples #30

@Sigafoos

Description

@Sigafoos

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions