56 tlc59116_write_reg(uint8_t reg, uint8_t val)
58 uint8_t tx_buf[] = { reg, val };
60 i2c_transmitinit(TLC59116_ADDR);
62 PRINTFDEBUG(
"I2C Ready to TX\n");
64 i2c_transmit_n(2, tx_buf);
66 PRINTFDEBUG(
"WRITE_REG 0x%02X @ reg 0x%02X\n", val, reg);
79 tlc59116_write_stream(uint8_t len, uint8_t * data)
81 i2c_transmitinit(TLC59116_ADDR);
83 PRINTFDEBUG(
"I2C Ready to TX(stream)\n");
85 i2c_transmit_n(len, data);
87 PRINTFDEBUG(
"WRITE_STR %u B to 0x%02X\n", len, data[0]);
98 tlc59116_read_reg(uint8_t reg)
103 PRINTFDEBUG(
"READ_REG 0x%02X\n", reg);
106 i2c_transmitinit(TLC59116_ADDR);
108 i2c_transmit_n(1, &rtx);
112 i2c_receiveinit(TLC59116_ADDR);
114 i2c_receive_n(1, &retVal);
129 tlc59116_read_stream(uint8_t reg, uint8_t len, uint8_t * whereto)
133 PRINTFDEBUG(
"READ_STR %u B from 0x%02X\n", len, reg);
136 i2c_transmitinit(TLC59116_ADDR);
138 i2c_transmit_n(1, &rtx);
142 i2c_receiveinit(TLC59116_ADDR);
144 i2c_receive_n(len, whereto);
156 tlc59116_led(uint8_t led, uint8_t pwm)
158 if(led < 0 | led > 15) {
159 PRINTFDEBUG(
"TLC59116: wrong led value.");
161 tlc59116_write_reg(led + TLC59116_PWM0, pwm);
177 tlc59116_write_reg(TLC59116_MODE1, TLC59116_MODE1_DEFAULT);
178 tlc59116_write_reg(TLC59116_MODE2, TLC59116_MODE2_DEFAULT);
183 { TLC59116_PWM0_AUTOINCR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
184 tlc59116_write_stream(17, &tx_buf);
187 tlc59116_write_reg(TLC59116_LEDOUT0, TLC59116_LEDOUT_PWM);
188 tlc59116_write_reg(TLC59116_LEDOUT1, TLC59116_LEDOUT_PWM);
189 tlc59116_write_reg(TLC59116_LEDOUT2, TLC59116_LEDOUT_PWM);
190 tlc59116_write_reg(TLC59116_LEDOUT3, TLC59116_LEDOUT_PWM);