API Reference¶
-
group
group_board_libs
Defines
-
CY_RSLT_RGB_LED_CLK_FAIL
¶ Error code for RGB LED operation: Peripheral clock assignment failure.
-
CY_RSLT_RGB_LED_PWM_FAIL
¶ Error code for RGB LED operation: PWM resource allocation failure.
-
CY_RSLT_RGB_LED_LP_CB_REG_FAIL
¶ Error code for RGB LED operation: Low power callback function registration failure.
-
CY_RSLT_RGB_LED_LP_CB_DEREG_FAIL
¶ Error code for RGB LED operation: Low power callback function deregistration failure.
-
CY_RGB_LED_RED_POS
¶ Bit position for Red LED.
-
CY_RGB_LED_GREEN_POS
¶ Bit position for Green LED.
-
CY_RGB_LED_BLUE_POS
¶ Bit position for Blue LED.
-
CY_RGB_LED_COLOR_RED
¶ 32-bit encoding for Red Color
Note: LED Color is encoded as 0x00RRGGBB where RR - byte field for Red color GG - byte field for Green color BB - byte field for Blue color
Each byte represents 256 (0x00 to 0xFF) different brightness level for each LED color (Red, Green, Blue). Colors can be generated varying these byte fields.
For example: 0x00FFFFFF (RR = 0xFF; GG = 0xFF BB = 0xFF) produces white color.
0x00FFFF00 (RR = 0xFF; GG = 0xFF BB = 0x00) produces yellow color.
-
CY_RGB_LED_COLOR_GREEN
¶ 32-bit encoding for Green Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_BLUE
¶ 32-bit encoding for Blue Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_WHITE
¶ 32-bit encoding for White Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_YELLOW
¶ 32-bit encoding for Yellow Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_MAGENTA
¶ 32-bit encoding for Magenta Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_PURPLE
¶ Deprecated.
Use CY_RGB_LED_COLOR_MAGENTA instead
-
CY_RGB_LED_COLOR_CYAN
¶ 32-bit encoding for Cyan Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_COLOR_OFF
¶ No Color.
Refer to CY_RGB_LED_COLOR_RED for color encoding scheme
-
CY_RGB_LED_MAX_BRIGHTNESS
¶ Maximum LED Brightness.
-
CY_RGB_LED_ACTIVE_HIGH
¶ RGB LED active HIGH logic.
-
CY_RGB_LED_ACTIVE_LOW
¶ RGB LED active LOW logic.
Functions
-
cy_rslt_t
cy_rgb_led_init
(cyhal_gpio_t pin_red, cyhal_gpio_t pin_green, cyhal_gpio_t pin_blue, bool led_active_logic)¶ Initializes RGB LED on the board.
- Parameters
pin_red – GPIO for Red component.
pin_green – GPIO for Green component.
pin_blue – GPIO for Blue component.
led_active_logic – Active logic (low or high) for the RGB LED, all three LEDs must be connected in same active logic.
- Returns
CY_RSLT_SUCCESS if the initialization was successful, an error code otherwise.
-
void
cy_rgb_led_deinit
(void)¶ De-initializes the RGB LED on the board.
-
void
cy_rgb_led_on
(uint32_t color, uint8_t brightness)¶ Turns on RGB LED with specified color and brightness.
- Parameters
color – LED color
brightness – Brightness of the LED (Valid range: 0 to CY_RGB_LED_MAX_BRIGHTNESS).
-
void
cy_rgb_led_off
(void)¶ Turns off the RGB LED on the board.
-
void
cy_rgb_led_toggle
(void)¶ Toggles the RGB LED on the board.
-
void
cy_rgb_led_set_color
(uint32_t color)¶ Sets color of the RGB LED.
- Parameters
color – LED color
-
uint32_t
cy_rgb_led_get_color
(void)¶ Returns the current color of the RGB LED.
- Returns
4-byte encoded color.
-
static inline uint32_t
cy_rgb_led_create_color
(uint8_t red, uint8_t green, uint8_t blue)¶ Create a custom color code for the RGB LED.
- Parameters
red – 1-byte value for Red component.
green – 1-byte value for Green component.
blue – 1-byte value for Blue component.
- Returns
32-bit encoded color code.
-
void
cy_rgb_led_set_brightness
(uint8_t brightness)¶ Sets brightness of the RGB LED.
- Parameters
brightness – LED brightness (Valid range: 0 to CY_RGB_LED_MAX_BRIGHTNESS)
-
uint8_t
cy_rgb_led_get_brightness
(void)¶ Returns the current brightness of the RGB LED.
- Returns
uint8_t LED brightness.
-