RGB LED#

The RGB LED driver provides a set of functions for controlling RGB LEDs on the SI91x platform. It allows initialization, turning on/off, toggling, setting colors, and reading the current state or color of the LED.

Usage#

Note

  • Deprecated APIs are provided for backward compatibility but new designs should use the sl_si91x_simple_ series of APIs.

See the function documentation above for detailed usage information.

Modules#

sl_led_t

sl_rgb_led_t

Functions#

void
sl_si91x_simple_rgb_led_init(const sl_rgb_led_t *handle)

Configures GPIOs pertaining to the control of RGB LEDs.

void
sl_si91x_simple_rgb_led_on(const sl_rgb_led_t *handle)

Turns on the RGB LED.

void
sl_si91x_simple_rgb_led_off(const sl_rgb_led_t *handle)

Turns off (clears) the RGB LED.

void
sl_si91x_simple_rgb_led_toggle(const sl_rgb_led_t *handle)

Atomically wraps an XOR or similar operation for the RGB LED.

void
sl_si91x_simple_rgb_led_set_colour(const sl_rgb_led_t *handle, int rgb_colour)

Displays the user-defined color hex code on the RGB LED.

uint8_t
sl_si91x_simple_rgb_led_get_current_state(const sl_rgb_led_t *handle)

Returns the current state of the RGB LED.

void
sl_si91x_simple_rgb_led_get_colour(const sl_rgb_led_t *handle, uint16_t *red, uint16_t *green, uint16_t *blue)

Returns the current colour of the RGB LED.

void
sl_si91x_rgb_led_init(const sl_led_t *handle)

Older API - Not recommended to use.

void
sl_si91x_rgb_led_on(const sl_led_t *handle)

Older API - Not recommended to use.

void
sl_si91x_rgb_led_off(const sl_led_t *handle)

Older API - Not recommended to use.

uint8_t
sl_si91x_rgb_led_get_current_state(const sl_led_t *handle)

Older API - Not recommended to use.

void
sl_si91x_rgb_led_toggle(const sl_led_t *handle)

Older API - Not recommended to use.

Function Documentation#

sl_si91x_simple_rgb_led_init#

void sl_si91x_simple_rgb_led_init (const sl_rgb_led_t * handle)

Configures GPIOs pertaining to the control of RGB LEDs.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This function initializes the GPIOs required to control the RGB LEDs.

Note

  • This function must be called before any other RGB LED control functions.


sl_si91x_simple_rgb_led_on#

void sl_si91x_simple_rgb_led_on (const sl_rgb_led_t * handle)

Turns on the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This function sets the GPIO pins connected to the specified RGB LED and starts the sleeptimer, turning it on.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • Ensure that the GPIO pin is configured correctly before using this function.


sl_si91x_simple_rgb_led_off#

void sl_si91x_simple_rgb_led_off (const sl_rgb_led_t * handle)

Turns off (clears) the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific RGB LED information.

This function clears the GPIO pins connected to the specified RGB LED and stops the sleeptimer, turning it off.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • Ensure that the GPIO pin is configured correctly before using this function.


sl_si91x_simple_rgb_led_toggle#

void sl_si91x_simple_rgb_led_toggle (const sl_rgb_led_t * handle)

Atomically wraps an XOR or similar operation for the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This function performs an atomic XOR operation on the RGB LED, toggling its state.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • Ensure that the GPIO pin is configured correctly before using this function.


sl_si91x_simple_rgb_led_set_colour#

void sl_si91x_simple_rgb_led_set_colour (const sl_rgb_led_t * handle, int rgb_colour)

Displays the user-defined color hex code on the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

int[in]rgb_colour

The color hex code to be displayed.

This function sets the RGB LED to display the specified color hex code.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • Ensure that the color hex code is valid and within the acceptable range.


sl_si91x_simple_rgb_led_get_current_state#

uint8_t sl_si91x_simple_rgb_led_get_current_state (const sl_rgb_led_t * handle)

Returns the current state of the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific RGB LED information.

This function retrieves the current state of the specified RGB LED.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Returns

  • uint8_t The current state of the RGB LED.

Note

  • The returned state indicates whether the RGB LED is on or off.


sl_si91x_simple_rgb_led_get_colour#

void sl_si91x_simple_rgb_led_get_colour (const sl_rgb_led_t * handle, uint16_t * red, uint16_t * green, uint16_t * blue)

Returns the current colour of the RGB LED.

Parameters
TypeDirectionArgument NameDescription
const sl_rgb_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific RGB LED information.

uint16_t *[out]red

The pointer to the variable to store the red LED color value.

uint16_t *[out]green

The pointer to the variable to store the green LED color value.

uint16_t *[out]blue

The pointer to the variable to store the blue LED color value.

This function retrieves the current color values of the specified RGB LED.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • Ensure that the pointers for red, green, and blue are valid and not null.


sl_si91x_rgb_led_init#

void sl_si91x_rgb_led_init (const sl_led_t * handle)

Older API - Not recommended to use.

Parameters
TypeDirectionArgument NameDescription
const sl_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This API is deprecated in favor of the new sl_si91x_simple_ series of APIs. Consider using sl_si91x_simple_rgb_led_init.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • This function is deprecated and should be replaced with sl_si91x_simple_rgb_led_init.


sl_si91x_rgb_led_on#

void sl_si91x_rgb_led_on (const sl_led_t * handle)

Older API - Not recommended to use.

Parameters
TypeDirectionArgument NameDescription
const sl_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This API is deprecated in favor of the new sl_si91x_simple_ series of APIs. Consider using sl_si91x_simple_rgb_led_on.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • This function is deprecated and should be replaced with sl_si91x_simple_rgb_led_on.


sl_si91x_rgb_led_off#

void sl_si91x_rgb_led_off (const sl_led_t * handle)

Older API - Not recommended to use.

Parameters
TypeDirectionArgument NameDescription
const sl_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific RGB LED information.

This API is deprecated in favor of the new sl_si91x_simple_ series of APIs. Consider using sl_si91x_simple_rgb_led_off.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • This function is deprecated and should be replaced with sl_si91x_simple_rgb_led_off.


sl_si91x_rgb_led_get_current_state#

uint8_t sl_si91x_rgb_led_get_current_state (const sl_led_t * handle)

Older API - Not recommended to use.

Parameters
TypeDirectionArgument NameDescription
const sl_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This API is deprecated in favor of the new sl_si91x_simple_ series of APIs. Consider using sl_si91x_simple_rgb_led_get_current_state.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Returns

  • uint8_t The current state of the RGB LED.

Note

  • This function is deprecated and should be replaced with sl_si91x_simple_rgb_led_get_current_state.


sl_si91x_rgb_led_toggle#

void sl_si91x_rgb_led_toggle (const sl_led_t * handle)

Older API - Not recommended to use.

Parameters
TypeDirectionArgument NameDescription
const sl_led_t *[in]handle

The pointer to the RGB LED structure that contains the specific LED information.

This API is deprecated in favor of the new sl_si91x_simple_ series of APIs. Consider using sl_si91x_simple_rgb_led_toggle.

  • Pre-conditions:

    • The RGB LED structure must be properly initialized before calling this function.

Note

  • This function is deprecated and should be replaced with sl_si91x_simple_rgb_led_toggle.