i2cdevlib
i2cdevlib copied to clipboard
Feature Request: I2Cdev Example for Seeed Studio's PCA9685
Hi all,
Jeff Rowberg wrote a library based on I2Cdev in 2012 to support
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
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