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.
|
This selection enables building of the "upper-half" RGB LED driver.
|
||||||
See include/nuttx/rgbled.h for further PWM driver information.
|
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
|
config PCA9635PW
|
||||||
bool "PCA9635PW I2C LED Driver"
|
bool "PCA9635PW I2C LED Driver"
|
||||||
default n
|
default n
|
||||||
|
@ -304,9 +304,15 @@ static ssize_t rgbled_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
|
|
||||||
/* Convert 8bit to 16bits */
|
/* Convert 8bit to 16bits */
|
||||||
|
|
||||||
red <<= 8;
|
red = (red << 8) | red;
|
||||||
green <<= 8;
|
green = (green << 8) | green;
|
||||||
blue <<= 8;
|
blue = (blue << 8) | blue;
|
||||||
|
|
||||||
|
#ifdef CONFIG_RGBLED_INVERT
|
||||||
|
red ^= 0xffff;
|
||||||
|
green ^= 0xffff;
|
||||||
|
blue ^= 0xffff;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Setup LED R */
|
/* Setup LED R */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user