Hello,
I want to write a simple library for the PCA9685, of course I didn't successfully run the board.
Tested it with Adafruit library and it worked, just to be sure that it's actually working and nothing wrong with the chip.
So, my code is not properly initialized, and I think I misunderstood of how to use the configuration registers.
Here's my code, I don't know if my coding is right! Well, it isn't actually, since the board isn't working
void pca9685_init(void){
uint8_t i,val[]={0x20,0x04};
i2c_start(PCA9685_BASE_WR);
i2c_tx(PCA9685_MODE1);
for(i=0;i<2;i++)i2c_tx(val[i]);
i2c_stop();
}
void pca9685_all_on(void){
uint8_t i,val[]={0x00,0x10};
i2c_start(PCA9685_BASE_WR);
i2c_tx(PCA9685_ALL_LED_ON_L);
for(i=0;i<2;i++)i2c_tx(val[i]);
i2c_stop();
}
void pca9685_all_off(void){
uint8_t i,val[]={0x00,0x10};
i2c_start(PCA9685_BASE_WR);
i2c_tx(PCA9685_ALL_LED_OFF_L);
for(i=0;i<2;i++)i2c_tx(val[i]);
i2c_stop();
}
Maybe I didn't understand what does all_on and all_off mean?