显示服务
显示服务 (display service) 在 display_pattern_t
中定义了一些常用的显示样式枚举值,帮助用户设置 LED 或者 LED 灯条的对应样式。
已经支持的 LED 驱动芯片有 AW2013、WS2812、IS31x。
应用示例
以下示例展示了该 API 的实现方式。
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.
- 返回
NULL Error
others Success
-
esp_err_t led_bar_aw2013_pattern(void *handle, int pat, int value)
Set led bar display pattern.
- 参数
handle – led bar instance
pat – display pattern
value – value of pattern
- 返回
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.
- 参数
handle – led bar instance
time – times of blink
period – period of blink
- 返回
ESP_OK
ESP_FAIL
-
void led_bar_aw2013_deinit(esp_periph_handle_t handle)
Destroy esp_periph_handle_t instance.
- 参数
handle – led bar instance
Header File
Functions
-
esp_periph_handle_t led_bar_is31x_init()
Initialize esp_periph_handle_t instance.
- 返回
NULL, Fail
Others, Success
-
esp_err_t led_bar_is31x_pattern(void *handle, int pat, int value)
Set led bar display pattern.
- 参数
handle – led bar instance
pat – display pattern
value – value of pattern
- 返回
ESP_OK
ESP_FAIL
-
void led_bar_is31x_deinit(esp_periph_handle_t handle)
Destroy esp_periph_handle_t instance.
- 参数
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.
- 参数
gpio_num – The GPIO number of ws2812
led_num – The number of all ws2812
- 返回
led_bar_ws2812_handle_t
-
esp_err_t led_bar_ws2812_pattern(void *handle, int pat, int value)
Set ws2812 pattern.
- 参数
handle – ws2812 indicator instance
pat – display pattern
value – value of pattern
- 返回
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.
- 参数
handle – ws2812 indicator instance
- 返回
- 返回
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.
- 参数
num – led gpio number
- 返回
NULL, Fail
Others, Success
-
esp_err_t led_indicator_pattern(void *handle, int pat, int value)
Set led indicator display pattern.
- 参数
handle – led indicator instance
pat – display pattern
value – value of pattern
- 返回
ESP_OK
ESP_FAIL
-
void led_indicator_deinit(led_indicator_handle_t handle)
Destroy led_indicator_handle_t instance.
- 参数
handle – led indicator instance
Type Definitions
-
typedef struct led_indicator_impl *led_indicator_handle_t