Display Service
The display service defines enumeration values for some common display patterns in display_pattern_t
, with which you can set the corresponding patterns of LEDs or LED bars.
The currently supported LED drivers are AW2013, WS2812, and IS31x.
Application Example
Implementation of this API is demonstrated in the following example:
Header File
Functions
-
display_service_handle_t display_service_create(display_service_config_t *cfg)
-
esp_err_t display_service_set_pattern(void *handle, int disp_pattern, int value)
-
esp_err_t display_destroy(display_service_handle_t handle)
Structures
-
struct display_service_config_t
Display service configurations.
Public Members
-
periph_service_config_t based_cfg
Peripheral service configuration
-
void *instance
Sub-instance
-
periph_service_config_t based_cfg
Type Definitions
-
typedef struct display_service_impl *display_service_handle_t
Enumerations
-
enum display_pattern_t
Values:
-
enumerator DISPLAY_PATTERN_UNKNOWN
-
enumerator DISPLAY_PATTERN_WIFI_SETTING
-
enumerator DISPLAY_PATTERN_WIFI_CONNECTTING
-
enumerator DISPLAY_PATTERN_WIFI_CONNECTED
-
enumerator DISPLAY_PATTERN_WIFI_DISCONNECTED
-
enumerator DISPLAY_PATTERN_WIFI_SETTING_FINISHED
-
enumerator DISPLAY_PATTERN_BT_CONNECTTING
-
enumerator DISPLAY_PATTERN_BT_CONNECTED
-
enumerator DISPLAY_PATTERN_BT_DISCONNECTED
-
enumerator DISPLAY_PATTERN_RECORDING_START
-
enumerator DISPLAY_PATTERN_RECORDING_STOP
-
enumerator DISPLAY_PATTERN_RECOGNITION_START
-
enumerator DISPLAY_PATTERN_RECOGNITION_STOP
-
enumerator DISPLAY_PATTERN_WAKEUP_ON
-
enumerator DISPLAY_PATTERN_WAKEUP_FINISHED
-
enumerator DISPLAY_PATTERN_MUSIC_ON
-
enumerator DISPLAY_PATTERN_MUSIC_FINISHED
-
enumerator DISPLAY_PATTERN_VOLUME
-
enumerator DISPLAY_PATTERN_MUTE_ON
-
enumerator DISPLAY_PATTERN_MUTE_OFF
-
enumerator DISPLAY_PATTERN_TURN_ON
-
enumerator DISPLAY_PATTERN_TURN_OFF
-
enumerator DISPLAY_PATTERN_BATTERY_LOW
-
enumerator DISPLAY_PATTERN_BATTERY_CHARGING
-
enumerator DISPLAY_PATTERN_BATTERY_FULL
-
enumerator DISPLAY_PATTERN_POWERON_INIT
-
enumerator DISPLAY_PATTERN_WIFI_NO_CFG
-
enumerator DISPLAY_PATTERN_SPEECH_BEGIN
-
enumerator DISPLAY_PATTERN_SPEECH_OVER
-
enumerator DISPLAY_PATTERN_MAX
-
enumerator DISPLAY_PATTERN_UNKNOWN
Header File
Functions
-
void aw2013_led_bar_task(void *parameters)
-
esp_periph_handle_t led_bar_aw2013_init(void)
Initialize led bar instance.
- Returns
NULL Error
others Success
-
esp_err_t led_bar_aw2013_pattern(void *handle, int pat, int value)
Set led bar display pattern.
- Parameters
handle – led bar instance
pat – display pattern
value – value of pattern
- Returns
ESP_OK
ESP_FAIL
-
esp_err_t led_bar_aw2013_set_blink_time(void *handle, uint8_t time, int period)
Set blinking period and times.
- Parameters
handle – led bar instance
time – times of blink
period – period of blink
- Returns
ESP_OK
ESP_FAIL
-
void led_bar_aw2013_deinit(esp_periph_handle_t handle)
Destroy esp_periph_handle_t instance.
- Parameters
handle – led bar instance
Header File
Functions
-
esp_periph_handle_t led_bar_is31x_init()
Initialize esp_periph_handle_t instance.
- Returns
NULL, Fail
Others, Success
-
esp_err_t led_bar_is31x_pattern(void *handle, int pat, int value)
Set led bar display pattern.
- Parameters
handle – led bar instance
pat – display pattern
value – value of pattern
- Returns
ESP_OK
ESP_FAIL
-
void led_bar_is31x_deinit(esp_periph_handle_t handle)
Destroy esp_periph_handle_t instance.
- Parameters
handle – led bar instance
Header File
Functions
-
led_bar_ws2812_handle_t led_bar_ws2812_init(gpio_num_t gpio_num, int led_num)
Initialize led_bar_ws2812_handle_t instance.
- Parameters
gpio_num – The GPIO number of ws2812
led_num – The number of all ws2812
- Returns
led_bar_ws2812_handle_t
-
esp_err_t led_bar_ws2812_pattern(void *handle, int pat, int value)
Set ws2812 pattern.
- Parameters
handle – ws2812 indicator instance
pat – display pattern
value – value of pattern
- Returns
ESP_OK, success
Others, fail
-
esp_err_t led_bar_ws2812_deinit(led_bar_ws2812_handle_t handle)
Destroy led_bar_ws2812_handle_t instance.
- Parameters
handle – ws2812 indicator instance
- Returns
- Returns
ESP_OK, success
Others, fail
Type Definitions
-
typedef struct led_bar_ws2812_impl *led_bar_ws2812_handle_t
Header File
Functions
-
led_indicator_handle_t led_indicator_init(gpio_num_t num)
Initialize led_indicator_handle_t instance.
- Parameters
num – led gpio number
- Returns
NULL, Fail
Others, Success
-
esp_err_t led_indicator_pattern(void *handle, int pat, int value)
Set led indicator display pattern.
- Parameters
handle – led indicator instance
pat – display pattern
value – value of pattern
- Returns
ESP_OK
ESP_FAIL
-
void led_indicator_deinit(led_indicator_handle_t handle)
Destroy led_indicator_handle_t instance.
- Parameters
handle – led indicator instance
Type Definitions
-
typedef struct led_indicator_impl *led_indicator_handle_t