Chaining PWM driver PCA9635

Hello, I want to chain the PCA9635 in i2C.

This IC is very similar to the PCA9685 from adafruit. The only difference is that It has a fixed frequency of 97KHz compared to the PCA9685 with 1.6KHz.

The only library that I was able to get the PCA9635 to work is by rambo:

I don’t have an option to set different boards compared to the adafruit library PCA9685

The code on the adafruit looks pretty simple where I can set my object and then call it:

Adafruit_PWMServoDriver pwm1 = Adafruit_PWMServoDriver(0x40);
Adafruit_PWMServoDriver pwm2 = Adafruit_PWMServoDriver(0x41);

void setup() {
Serial.begin(9600);
pwm1.begin();
pwm2.begin();
}

void loop() {
pwm1.setPWM(0, 0, 1000) //(output channel for board, time when HIGH, time when LOW)
pwm2.setPWM(0, 0, 1000)
}

However, for the PCA9635 library, I am unable to figure out how to do this.

// Get this from https://github.com/rambo/I2C
#include <I2C.h> // For some weird reason including this in the relevant .h file does not work
#include <i2c_device.h> // For some weird reason including this in the relevant .h file does not work
#include <pca9635.h>
#define I2C_DEVICE_DEBUG
// Container for the device
pca9635 driver;

void setup()  {
    Serial.begin(115200);
    // Use the SW-Reset address to reset all pca9635 ICs on the bus
    // Initialize I2C library manually
    I2c.begin();
    I2c.timeOut(500);
    PCA9635.reset(); // Incidentally this global name is a pca9635 instance bound to the generla "all-call" address so it can be used to set global parameters
    // Wake oscillators on all-call
    PCA9635.set_sleep(0x0);
    delayMicroseconds(500);
    // Enable PWM controls for all leds on all-call
    PCA9635.set_led_mode(2);
PCA9635.set_driver_mode(0xff);  
    // Set device address and call I2c.begin() (note: your need to change the address to correspond to your device)
driver.begin(0x70, false); // ******** You need to change the device address here, 0x70 is the 7-bit ALL-CALL address for PCA9635 ***********
}

void loop() {
PCA9635.set_led_pwm(0, 50); // (output channel from 0~15, duty cycle from 0~255)
delay(500);
PCA9635.set_led_pwm(0, 100);
delay(500);
}

I tried comparing the .cpp files for a few hours to see if I can get it to work with no luck.

Here is the beginning of the adafruit .cpp file:

#include <Adafruit_PWMServoDriver.h>
#include <Wire.h>
#if defined(ARDUINO_SAM_DUE)
 #define WIRE Wire1
#else
 #define WIRE Wire
#endif


// Set to true to print some debug messages, or false to disable them.
#define ENABLE_DEBUG_OUTPUT false

Adafruit_PWMServoDriver::Adafruit_PWMServoDriver(uint8_t addr) {
  _i2caddr = addr;
}

void Adafruit_PWMServoDriver::begin(void) {
 WIRE.begin();
 reset();
}

void Adafruit_PWMServoDriver::reset(void) {
 write8(PCA9685_MODE1, 0x0);
}

And the beginning of the PCA9635 .cpp file:

#include "pca9635.h"

// Constructor
pca9635::pca9635()
{
    device_address = 0x70; // Default to the all-call address
    autoincrement_bits = 0x80; // Autoincrement all
}

void pca9635::begin(byte dev_addr, boolean wire_begin, boolean init)
{
    i2c_device::begin(dev_addr, wire_begin);
    if (init)
    {
        this->set_sleep(0x0); // Wake up oscillators
        delayMicroseconds(500); // Wait for the oscillators to stabilize
        this->set_led_mode(3); // Default to full PWM mode for all drivers
    }
}

void pca9635::begin(byte dev_addr, boolean wire_begin)
{
    pca9635::begin(dev_addr, wire_begin, false);
}

I attached both libraries for reference.
also a link: http://puu.sh/wTdaD/407c827de2.zip

I would really appreciate it if I could have any kind of advice or lead into doing this. Thank you so much!

PCA lib.zip (4.41 KB)