LED#
Sample API funtions for controlling LEDs.
See sl_si91x_led.c for source code.
Introduction#
The SI91x LED driver is a platform-level software module responsible for managing the control of LEDs. All LED functions are called through the generic driver, which then which internally calls functions specific to the LED.
Configuration#
All LED instances are configured with an sl_led_t struct. This struct is automatically generated after a LED is set up using Simplicity Studio's wizard.
For more information on configuring available parameters refer to the respective peripheral example readme document and refer here https://docs.silabs.com/wiseconnect/latest/wiseconnect-api-reference-guide-si91x-peripherals/disable-uc-config.
Usage#
Once the LED structs are defined, the LED functions can be called being passed an instance of sl_led_t, which will be redirected to calling the type specific version of that function. The common functions include the following:
sl_led_init initialises the specific LED. This function is called automatically when the application is run.
sl_si91x_led_toggle can be implemented by the application if required. This function is used to toggle the state of the LED. sl_si91x_led_set and sl_si91x_led_clear both can be implemented by the application. These functions are used to turn the LED on and off resectively.
Modules#
Functions#
Configures GPIOs pertaining to the control of LEDs.
Atomically wraps an XOR or a similar operation for a single GPIO pin connected to an LED to toggle the LED.
Sets a GPIO pin connected to an LED to turn the LED on.
Clears a GPIO pin connected to an LED to turn the LED off.
Called by the stack to indicate activity over the radio (for both transmission and reception).
Function Documentation#
sl_si91x_led_init#
void sl_si91x_led_init (const sl_led_t * handle)
Configures GPIOs pertaining to the control of LEDs.
[in] | handle | The pointer to led structure that has the specific LED information. |
Initializes the selected LED GPIO and mode.
Returns
none
46
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h
sl_si91x_led_toggle#
void sl_si91x_led_toggle (uint8_t pin)
Atomically wraps an XOR or a similar operation for a single GPIO pin connected to an LED to toggle the LED.
[in] | pin | GPIO pin connected to the LED to be toggled. |
Returns
none
57
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h
sl_si91x_led_set#
void sl_si91x_led_set (uint8_t pin)
Sets a GPIO pin connected to an LED to turn the LED on.
[in] | pin | GPIO pin connected to the LED to be set. |
Returns
none
67
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h
sl_si91x_led_clear#
void sl_si91x_led_clear (uint8_t pin)
Clears a GPIO pin connected to an LED to turn the LED off.
[in] | pin | GPIO pin connected to the LED to be cleared. |
Returns
none
77
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h
sl_si91x_led_StackIndicateActivity#
void sl_si91x_led_StackIndicateActivity (bool turnOn)
Called by the stack to indicate activity over the radio (for both transmission and reception).
[in] | turnOn | See Usage. |
It is called once with turnOn
true and shortly thereafter with turnOn
false.
Typically does something interesting, such as change the state of an LED.
Returns
none
92
of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h