HAL ADP Exported Functions

group HAL_ADP_Exported_Functions

Typedefs

typedef void (*P_ADP_ISR_CBACK)(void)

ADP interrupt callback function type.

typedef void (*P_ADP_PLUG_CBACK)(T_ADP_PLUG_EVENT event, void *user_data)

ADP plug callback function type.

Param event:

ADP plug event. This parameter can be one of the following values:

  • ADP_EVENT_PLUG_IN: ADP plug in.

  • ADP_EVENT_PLUG_OUT: ADP plug out.

Param user_data:

The user data.

Functions

bool adp_update_isr_cb(T_ADP_DETECT adp_type, P_ADP_ISR_CBACK cback)

Update ADP IO/5V interrupt callback.

Parameters:
  • adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

    • ADP_DETECT_5V: Use ADP 5V.

    • ADP_DETECT_IO: Use ADP IO.

  • cback -- ADP interrupt callback function.

Return values:
  • true -- Update ADP interrupt callback success.

  • false -- Update ADP interrupt callback failed.

T_ADP_LEVEL adp_get_level(T_ADP_DETECT adp_type)

Get ADP IO/5V current level.

Parameters:

adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

  • ADP_DETECT_5V: Use ADP 5V.

  • ADP_DETECT_IO: Use ADP IO.

Returns:

The ADP current level.

bool adp_register_state_change_cb(T_ADP_DETECT adp_type, P_ADP_PLUG_CBACK cback, void *user_data)

Register ADP IO/5V callback.

Parameters:
  • adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

    • ADP_DETECT_5V: Use ADP 5V.

    • ADP_DETECT_IO: Use ADP IO.

  • cback -- ADP callback function.

  • user_data -- The user data.

Return values:
  • true -- Register ADP callback success.

  • false -- Register ADP callback failed.

bool adp_unregister_state_change_cb(T_ADP_DETECT adp_type, P_ADP_PLUG_CBACK cback)

Unregister ADP IO/5V callback.

Parameters:
  • adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

    • ADP_DETECT_5V: Use ADP 5V.

    • ADP_DETECT_IO: Use ADP IO.

  • cback -- ADP callback function.

Return values:
  • true -- Unregister ADP callback success.

  • false -- Unregister ADP callback failed.

T_ADP_STATE adp_get_current_state(T_ADP_DETECT adp_type)

Get ADP IO/5V current state.

Parameters:

adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

  • ADP_DETECT_5V: Use ADP 5V.

  • ADP_DETECT_IO: Use ADP IO.

Returns:

ADP current state.

bool adp_get_debounce_time(T_ADP_DETECT adp_type, uint32_t *p_in_debounce_ms, uint32_t *p_out_debounce_ms)

Get ADP IO/5V function debounce time.

Parameters:
  • adp_type -- Use ADP 5V or ADP IO. This parameter can be one of the following values:

    • ADP_DETECT_5V: Use ADP 5V.

    • ADP_DETECT_IO: Use ADP IO.

  • io_in_debounce_time -- ADP in debounce time.

  • io_out_debounce_time -- ADP out debounce time.

Return values:
  • true -- Get ADP IO debounce time success.

  • false -- Get ADP IO debounce time failed.

bool adp_set_debounce_time(T_ADP_DETECT adp_type, T_ADP_IO_DEBOUNCE_TIME io_in_debounce_time, T_ADP_IO_DEBOUNCE_TIME io_out_debounce_time)

Only can set ADP IO function debounce time.

Parameters:
  • adp_type -- Only can be set ADP_DETECT_IO.

  • io_in_debounce_time -- ADP IO in debounce time.

  • io_out_debounce_time -- ADP IO out debounce time.

Return values:
  • true -- Set ADP IO debounce success.

  • false -- ADP type error or debounce time overflow.

bool adp_close(T_ADP_DETECT adp_type)

Close ADP function.

Parameters:

adp_type -- Only can be set ADP_DETECT_IO.

Return values:
  • true -- Close ADP IO function success.

  • false -- ADP type error.

bool adp_open(T_ADP_DETECT adp_type)

Open ADP function.

Parameters:

adp_type -- Only can be set ADP_DETECT_IO.

Return values:
  • true -- Open ADP IO function success.

  • false -- ADP type error.

bool adp_wake_up_enable(T_ADP_WAKE_UP_MODE mode)

Adapter wake up function enable.

Parameters:

mode -- Config power off or none power off. This parameter value is ADP_WAKE_UP_POWER_OFF or ADP_WAKE_UP_GENERAL.

Return values:
  • true -- Enable success.

  • false -- Enable failed.

void adp_wake_up_disable(T_ADP_WAKE_UP_MODE mode)

Adapter wake up function disable.

Parameters:

mode -- Config power off or none power off. This parameter value is ADP_WAKE_UP_POWER_OFF or ADP_WAKE_UP_GENERAL.