19 i2c_bus->
lock(i2c_address);
31 i2c_bus->
unlock(i2c_address);
35 if (frequency_hz > 1526)
37 if (frequency_hz < 25)
42 uint8_t prescale = round(25000000 / (4096 * frequency_hz)) - 1;
67 freq = round(25000000 / (4096 * prescale)) - 1;
73 duty = round(duty / 65535 * 4095);
95 uint16_t
duty = round(off / 4095 * 65535);
104 on = buff[0] | buff[1] >> 8;
105 off = buff[2] | buff[3] >> 8;
err_t _set_duty(uint16_t duty) override
const std::map< err_t, char * > err_to_char
err_t read(uint8_t address, uint8_t reg, uint8_t *buffer, size_t buffer_size)
Read data from I²C slave.
err_t is_connected()
Is the PCA9685 connected to the I²C bus.
PCA9685(uint8_t led, I2C_master *i2c_bus, uint8_t i2c_address=default_i2c_address)
PCA9685 pwm object for every LED.
static aruna::log::channel_t log
err_t _set_frequency(uint32_t frequency_hz) override
err_t set_duty(float duty_percentage)
Set the duty cycle on time in percentage.
err_t write(uint8_t address, uint8_t reg, uint8_t *data, size_t data_size)
Write data to the I²C bus.
err_t lock(uint8_t i2c_address)
const uint8_t i2c_address
err_t set_duty(uint16_t on, uint16_t off)
Set the on and off timing of the PCA9685 led.
int error(const char *format,...)
log error message
err_t unlock(uint8_t i2c_address)