Hi.
i'm working with pca9533 i2c led dimmer. Looking at the linux driver drivers/leds/leds-pca9532.c, i have some doubts about the define of the control register:
/* m = num_leds*/
#define PCA9532_REG_INPUT(i) ((i) >> 3)
#define PCA9532_REG_OFFSET(m) ((m) >> 4)
#define PCA9532_REG_PSC(m, i) (PCA9532_REG_OFFSET(m) + 0x1 + (i) * 2)
#define PCA9532_REG_PWM(m, i) (PCA9532_REG_OFFSET(m) + 0x2 + (i) * 2)
#define LED_REG(m, led) (PCA9532_REG_OFFSET(m) + 0x5 + (led >> 2))
#define LED_NUM(led) (led & 0x3)
#define LED_SHIFT(led) (LED_NUM(led) * 2)
#define LED_MASK(led) (0x3 << LED_SHIFT(led))
In particular, why is LED_REG defined with the shifts? Shouldn't it be just 0x5 as the datasheet says?
Thank you
Hi Lidia,
I am not familiar with this driver, but for the PCA9533 (4-bit I2C-bus LED dimmer), the address of the LS0 - LED selector register is indeed 0x05, so the second byte when writing to or reading from this register has to be 0x05.
Best regards,
Tomas
Thank you,
that's why i was asking about the shifts #define LED_REG(m, led) (PCA9532_REG_OFFSET(m) + 0x5 + (led >> 2)).
maybe they have no effects on the writing/reading.
Lidia