LED Application Functions

[English]

APP_LED API Brief

Application

Brief

app_led_init()

initailize LED config setting

app_led_uninit()

deinitailize LED config setting

app_led_push_event_action()

push LED event to app task

app_led_register_task_cb_handler()

LED event task handler

APP_LED API Reference

Header File

Functions

void app_led_init(void)

initailize LED config setting

initailize and loed LED config setting from env data

返回:

N/A

void app_led_uninit(void)

deinitailize LED config setting

free LED config setting which has allocated by app_led_init

返回:

N/A

void app_led_push_event_action(APP_LED_EVENT event)

push LED event to app task

push LED event to app task, wait app_task pass it to app_led_register_task_cb_handler

参数:

event[in] LED event index

返回:

N/A

void app_led_register_task_cb_handler(void)

LED event task handler.

a callback function hook with APP_TASK, it handle LED action start ot stop

返回:

N/A

void app_led_set_charger_plugin_status(bool plugin)

set charger plugin status

set charger plugin status

参数:

plugin[in] charger plugin

返回:

N/A

Structures

struct _app_led_info_t

LED action config struct definiation.

Public Members

uint8_t index

LED index, LED_LP = 0, LED_0 = 1, LED_1 = 2, LED_BRATH = 3

uint16_t number_flash

gpio mode is flash times , pwm mode is brighter

uint16_t led_ontime

LED on time, (unit: ms)

uint16_t led_offtime

LED off time, (unit: ms)

uint16_t repeat

LED action repeat times

int32_t timeout

LED action timeout(uint: ms) , 0xFFFF means never timeout, pwm mode is darken

Macros

LED_ON
LED_OFF
LED_NUM

total numbers of LED

LED_EVENT_NUM

total numbers of LED event

LED0_INDEX

LED_0 default GPIO index

LED1_INDEX

LED_1 default GPIO index

LED_BR_INDEX

LED_BR default GPIO index

LED_TMR_DUR

LED action event timer unit

LED_INVALID_INDEX

LED invalid config value

LED_DEBUG

LED debug message

LED_PRT(...)
LED_ERR(...)

Type Definitions

typedef uint8_t APP_LED_MODE
typedef uint8_t APP_LED_EVENT
typedef struct _app_led_info_t app_led_info_t

LED action config struct definiation.

Enumerations

enum [anonymous]

led_gpio index, “LEDIndex” in toolkit This item that is logical led index, containing leds action, will be translated to “LED_GPIO” in toolkit finally. ex. LEDIndex==LED0, means LED_GPIO:GPIO_x toggles repeatedly as event happens. One more case, LEDIndex==BOTH, means LED_GPIO:LED0 && LED_GPIO:LED1 both toggle repeatedly. In another view, wo could treat this index as instruction, which instruct the leds how to take action,such as LED0, instructs LED0 flash(blink), Altern does LED0 && LED1 flash alternatively, LED0_Only does LED0 flah(blink),and LED1 switch off.

Values:

enumerator LED_INDEX_LED0

0, action using LED_0 and clean others

enumerator LED_INDEX_LED1

1, action using LED_1 and clean others

enumerator LED_INDEX_LP

2, action using LED_LP and clean others

enumerator LED_INDEX_ALTERN

3, action using alternatively blinking

enumerator LED_INDEX_BOTH

4, action using synchronously blinking

enumerator LED_INDEX_LED0_ONLY

5, action using LED_0

enumerator LED_INDEX_LED1_ONLY

6, action using LED_1

enumerator LED_INDEX_LED_LP_ONLY

7, action using LED_LP

enumerator LED_INDEX_LED_BR

8, action using LED pwm mode

enumerator LED_INDEX_ALL_IN_LED0

9, action force using LED_0 instead of the original setting

enumerator LED_INDEX_ALL_IN_LED1

10, action force using LED_1 instead of the original setting

enumerator LED_INDEX_ALL_IN_LP

11, action force using LED_LP instead of the original setting

enumerator LED_INDEX_END
enum [anonymous]

LED action event definition.

Values:

enumerator LED_EVENT_INVALID_LED
enumerator LED_EVENT_AUTO_CONNECTION
enumerator LED_EVENT_MATCH_STATE
enumerator LED_EVENT_NO_MATCH_NO_CONN_STATE
enumerator LED_EVENT_CONN
enumerator LED_EVENT_BT_PAUSE
enumerator LED_EVENT_BT_PLAY
enumerator LED_EVENT_INCOMING_RINGING
enumerator LED_EVENT_OUTGOING_RINGING
enumerator LED_EVENT_CALL_ESTABLISHMENT
enumerator LED_EVENT_LOW_BATTERY
enumerator LED_EVENT_CHARGING
enumerator LED_EVENT_BATTERY_FULL
enumerator LED_EVENT_POWER_ON
enumerator LED_EVENT_POWER_OFF
enumerator LED_EVENT_LINEIN_PLAY
enumerator LED_EVENT_LINEIN_PAUSE
enumerator LED_EVENT_MUSIC_PLAY
enumerator LED_EVENT_MUSIC_PAUSE
enumerator LED_EVENT_FM_PLAY
enumerator LED_EVENT_FM_PAUSE
enumerator LED_EVENT_FM_SCAN
enumerator LED_EVENT_TEST_MODE
enumerator LED_EVENT_STEREO_CONN_MODE
enumerator LED_EVENT_STEREO_MATCH_MODE
enumerator LED_EVENT_STEREO_RECON_MODE
enumerator LED_EVENT_RESERVED1
enumerator LED_EVENT_RESERVED2
enumerator LED_EVENT_RESERVED3
enumerator LED_EVENT_END