working tlc59116 implementation for z1

This commit is contained in:
Jelmer Tiete 2013-05-23 17:52:02 +02:00
parent 8b61492152
commit cc2567b988
3 changed files with 25 additions and 9 deletions

View file

@ -43,6 +43,15 @@
#include "tlc59116.h"
#include "i2cmaster.h"
#if 0
#include <stdio.h>
#define PRINTFDEBUG(...) printf(__VA_ARGS__)
#else
#define PRINTFDEBUG(...)
#endif
/*---------------------------------------------------------------------------*/
/* Write to a register.
args:
@ -142,11 +151,11 @@ tlc59116_read_stream(uint8_t reg, uint8_t len, uint8_t *whereto) {
void
tlc59116_led(uint8_t led, uint8_t pwm) {
if (led<1 | led>16) {
if (led<0 | led>15) {
PRINTFDEBUG("TLC59116: wrong led value.");
}
tlc59116_write_reg(led, pwm);
}//else{
tlc59116_write_reg(led+TLC59116_PWM0, pwm);
// }
}
/*---------------------------------------------------------------------------*/

View file

@ -96,8 +96,8 @@ void tlc59116_led(uint8_t led, uint8_t pwm);
/* -------------------------------------------------------------------------- */
/* Reference definitions, should not be changed */
/* TLC59116 slave address */
#define TLC59116_ADDR 0xC0 //adress with all adress pins pulled to ground
#define TLC59116_ALLCALL 0xD0
#define TLC59116_ADDR 0x60 //7bit adress 0xC0 8bit adress; adress with all adress pins pulled to ground
//#define TLC59116_ALLCALL 0xD0
#define TLC59116_LEDOUT_PWM 0xAA // LDRx = 01 -> PWM, 4 leds per reg: 01010101 -> 0xAA
/* TLC59116 registers */