Add support for inverted LEDS. See common anode RGB LED discussion in the Yahoo group
This commit is contained in:
parent
598386ef90
commit
552ed255f6
|
@ -48,6 +48,15 @@ config RGBLED
|
|||
This selection enables building of the "upper-half" RGB LED driver.
|
||||
See include/nuttx/rgbled.h for further PWM driver information.
|
||||
|
||||
config RGBLED_INVERT
|
||||
bool "Invert RGB LED Output"
|
||||
depends on RGBLED
|
||||
default n
|
||||
---help---
|
||||
If the board has a common anode RGB LED (a LOW output turns ON
|
||||
each LED), this selection inverts the outputs so that the
|
||||
colors are displayed correctly.
|
||||
|
||||
config PCA9635PW
|
||||
bool "PCA9635PW I2C LED Driver"
|
||||
default n
|
||||
|
|
|
@ -304,9 +304,15 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
|
|||
|
||||
/* Convert 8bit to 16bits */
|
||||
|
||||
red <<= 8;
|
||||
green <<= 8;
|
||||
blue <<= 8;
|
||||
red = (red << 8) | red;
|
||||
green = (green << 8) | green;
|
||||
blue = (blue << 8) | blue;
|
||||
|
||||
#ifdef CONFIG_RGBLED_INVERT
|
||||
red ^= 0xffff;
|
||||
green ^= 0xffff;
|
||||
blue ^= 0xffff;
|
||||
#endif
|
||||
|
||||
/* Setup LED R */
|
||||
|
||||
|
|
Loading…
Reference in New Issue