Skip to content
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

Feature Request: I2Cdev Example for Seeed Studio's PCA9685 #714

Open
Scoeerg opened this issue Oct 4, 2022 · 0 comments
Open

Feature Request: I2Cdev Example for Seeed Studio's PCA9685 #714

Scoeerg opened this issue Oct 4, 2022 · 0 comments

Comments

@Scoeerg
Copy link

Scoeerg commented Oct 4, 2022

Hi all,

Jeff Rowberg wrote a library based on I2Cdev in 2012 to support

Seeed Studio's PCA9685

for Arduino (Download Link!). I would guess it's rather simple to port to Raspberry based on the existing code in this repo, but holy s*it I am lost.

There exists two files used as the library for Arduino PCA9685.cpp and PCA9685.h which are the actual drivers for the board. They in turn will

#include "I2Cdev.h"

which (kind of) exists in this repo for Pi as well. The PCA9685 library only uses three methods from I2Cdev which are

writeByte
writeBytes
readByte

but which are implemented completely differently for Arduino and Pi, but are defined very similarly:

// Arduino I2Cdev.h
static bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data);
static bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t* data);
static int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t* data, uint16_t timeout = I2Cdev::readTimeout);

Raspberry Pi I2Cdev.h:

// Raspberry Pi I2Cdev.h 
static bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data);
static bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data);
static int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data);

Any starting point would be appreciated.

Greetings

Eric

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

1 participant