Simple LED Driver
Description
Simple LED Driver.
Introduction
The Simple LED driver is a module of the LED driver that provides the functionality to control simple on/off LEDs.
Simple LED Configuration
Simple LEDs use the sl_led_t struct and their sl_simple_led_context_t struct. These are automatically generated into the following files, as well as instance specific headers with macro definitions in them. The samples below are for a single instance called "inst0".
- Note
- The sl_simple_led_instances.c file is shown with only one instance, but if more were in use they would all appear in this .c file.
- Note
- The sl_simple_led_instances.h file is shown with only one instance, but if more were in use they would all appear in this .h file.
Simple LED Usage
The simple LED driver is for LEDs with basic on off functionality, and there are no additional functions beyond those in the common driver. The LEDs can be turned on and off, toggled, and their on/off state can be retrieved. The following code shows how to control these LEDs. An LED should always be initialized before calling any other functions with it.
Data Structures |
|
struct | sl_simple_led_context_t |
Functions |
|
sl_status_t | sl_simple_led_init (void *led_handle) |
Initialize the simple LED driver.
|
|
void | sl_simple_led_turn_on (void *led_handle) |
Turn on a simple LED.
|
|
void | sl_simple_led_turn_off (void *led_handle) |
Turn off a simple LED.
|
|
void | sl_simple_led_toggle (void *led_handle) |
Toggle a simple LED.
|
|
sl_led_state_t | sl_simple_led_get_state (void *led_handle) |
Get the current state of the simple LED.
|
|
Macros |
|
#define | SL_SIMPLE_LED_POLARITY_ACTIVE_LOW 0U |
#define | SL_SIMPLE_LED_POLARITY_ACTIVE_HIGH 1U |
Typedefs |
|
typedef uint8_t | sl_led_polarity_t |
Function Documentation
◆ sl_simple_led_init()
sl_status_t sl_simple_led_init | ( | void * |
led_handle
|
) |
Initialize the simple LED driver.
- Parameters
-
[in] led_handle
Pointer to simple-led specific data:
- Returns
-
Status Code:
- SL_STATUS_OK
defined(_SILICON_LABS_32B_SERIES_2)
◆ sl_simple_led_turn_on()
void sl_simple_led_turn_on | ( | void * |
led_handle
|
) |
Turn on a simple LED.
- Parameters
-
[in] led_handle
Pointer to simple-led specific data:
◆ sl_simple_led_turn_off()
void sl_simple_led_turn_off | ( | void * |
led_handle
|
) |
Turn off a simple LED.
- Parameters
-
[in] led_handle
Pointer to simple-led specific data:
◆ sl_simple_led_toggle()
void sl_simple_led_toggle | ( | void * |
led_handle
|
) |
Toggle a simple LED.
- Parameters
-
[in] led_handle
Pointer to simple-led specific data:
◆ sl_simple_led_get_state()
sl_led_state_t sl_simple_led_get_state | ( | void * |
led_handle
|
) |
Get the current state of the simple LED.
- Parameters
-
[in] led_handle
Pointer to simple-led specific data:
- Returns
- sl_led_state_t Current state of simple LED. 1 for on, 0 for off