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.


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#

sl_led_t

Functions#

void
sl_si91x_led_init(const sl_led_t *handle)

Configures GPIOs pertaining to the control of LEDs.

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.

void
sl_si91x_led_set(uint8_t pin)

Sets a GPIO pin connected to an LED to turn the LED on.

void
sl_si91x_led_clear(uint8_t pin)

Clears a GPIO pin connected to an LED to turn the LED off.

void

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.

Parameters
[in]handle

The pointer to led structure that has the specific LED information.

Initializes the selected LED GPIO and mode.

Returns

  • none


Definition at line 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.

Parameters
[in]pin

GPIO pin connected to the LED to be toggled.

Returns

  • none


Definition at line 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.

Parameters
[in]pin

GPIO pin connected to the LED to be set.

Returns

  • none


Definition at line 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.

Parameters
[in]pin

GPIO pin connected to the LED to be cleared.

Returns

  • none


Definition at line 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).

Parameters
[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


Definition at line 92 of file components/device/silabs/si91x/mcu/drivers/hardware_drivers/led/inc/sl_si91x_led.h