Overview
Provides functions for controlling an RGB LED. This library implements color mixing and brightness control using the PWM blocks.
- The cy_rgb_led_init() function accepts the active logic (high or low) of the RGB LED as a parameter. All three (red, green, and blue) LEDs must be connected in same configuration, either active high or active low.
- The cy_rgb_led_init() function registers a low power handler that prevents the device from entering low power (deep-sleep) mode when the RGB LED is ON. You need to call cy_rgb_led_off() to turn the LED OFF before entering low power mode.
Quick Start
- Add #include "cy_rgb_led.h"
Add the following code to the main() function. This example initializes the RGB LED and produces a yellow color with maximum brightness.
CYBSP_LED_RGB_RED, CYBSP_LED_RGB_GREEN, and CYBSP_LED_RGB_BLUE are defined in the BSP.
cy_rslt_t result;
result = cybsp_init();
if(result == CY_RSLT_SUCCESS) {
}
for(;;) {
}
More information