Skip to content

I2c package needs to be update to work on bookworm #1177

@Ezward

Description

@Ezward

Users have indicated that PCA9685 is not working on RaspberryPi OS Bookworm. This is likely because we are using a very old an deprecated library that was not updated to handle the change in how gpio is addressed in RaspberryPi OS.

The old dependency is Adafruit_PCA9685, which is marked as deprecated and suggests using Adafruit_CircuitPython_PCA9685.

Adafruit_CircuitPython_PCA9685 has two pieces we need, the PCA9685 class which initialized the PCA9685 bus, address and frequency, and the PWMChannel class, which controls a specific servo channel on the board.

We need to update the code in two places to use the new classes. The first is in the pin specifiers code, pins.py. The pins.py:PCA9685 class should now import the Adafruit_CircuitPython_PCA9685:PCA9685 class to initialize the board. Then for each pin that is created, it will instantiate a [Adafruit_CircuitPython_PCA9685:PWMChannel]((https://github.com/adafruit/Adafruit_CircuitPython_PCA9685/blob/874545d908077baed0be8055cbbc63280a00c034/adafruit_pca9685.py#L51C7-L51C17) to control the pin.

The other place to update is the legacy donkeycar/parts/actuator.py:PCA9685 actuator class. Here we can eliminate duplication by instantiating a pwm pin using the pin providers PwmPinPCA9685 function, calling it with the pca9685 factory method to get the shared driver. If we do that then all the PCA9685 code is in one place.

Metadata

Metadata

Assignees

Labels

actuatorsChange that affects the steering and throttle drivers, generally in actuators.py or pins.pybugdependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions