Infineon Logo AIROC BTSDK v4.9 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
wiced_hal_lpm.h File Reference

Defines the interface for device low power managment. More...

Typedefs

typedef enum
wiced_bt_lpm_poll_type_e 
wiced_bt_lpm_poll_type_t
 
typedef enum
wiced_bt_lpm_pmu_sleep_type_t 
wiced_bt_lpm_pmu_sleep_type_t
 The sleep type of the power managment modole (PMU)
 
typedef uint32_t(* wiced_bt_lpm_callback_fp )(wiced_bt_lpm_poll_type_t type, uint32_t context)
 This typedef is what is expected when registering a function as a callback. More...
 

Enumerations

enum  {
  WICED_BT_LPM_WAKE_SOURCE_GPIO = (1 << 8), WICED_BT_LPM_WAKE_SOURCE_LHL = WICED_BT_LPM_WAKE_SOURCE_GPIO, WICED_BT_LPM_WAKE_SOURCE_KEYSCAN = (1 << 6), WICED_BT_LPM_WAKE_SOURCE_QUAD = (1 << 7),
  WICED_BT_LPM_WAKE_SOURCE_MASK = (WICED_BT_LPM_WAKE_SOURCE_GPIO | WICED_BT_LPM_WAKE_SOURCE_KEYSCAN | WICED_BT_LPM_WAKE_SOURCE_QUAD)
}
 The wake up sources. More...
 
enum  wiced_bt_lpm_poll_type_e { WICED_BT_LOW_POWER_MODE_POLL_TYPE_SLEEP = 0, WICED_BT_LOW_POWER_MODE_POLL_TYPE_SDS = 2 }
 
enum  wiced_bt_lpm_pmu_sleep_type_t { WICED_BT_PMU_SLEEP_NOT_ALLOWED = 0, WICED_BT_PMU_SLEEP_SDS_ALLOWED = 2, WICED_BT_PMU_SLEEP_NO_SDS = 5 }
 The sleep type of the power managment modole (PMU) More...
 

Functions

void wiced_hal_lpm_init (void)
 Initialize device low power management module. More...
 
void wiced_hal_lpm_enable_wake_from (uint32_t sources)
 Enables wake up from the given sources. More...
 
void wiced_hal_lpm_register_for_wake_notification (uint8_t(*fn)(void *), void *data)
 Allows an application to register for wake notification that the wake source are enabled by wiced_hal_lpm_enable_wake_from(uint32_t sources). More...
 
wiced_bool_t wiced_hal_lpm_register_for_low_power_queries (wiced_bt_lpm_callback_fp callback, uint32_t context)
 Adds the given object to the list of objects that need to be queried for sleep and SDS. More...
 

Detailed Description

Defines the interface for device low power managment.

Typedef Documentation

typedef uint32_t(* wiced_bt_lpm_callback_fp)(wiced_bt_lpm_poll_type_t type, uint32_t context)

This typedef is what is expected when registering a function as a callback.

This callback function is expected to respond with time to sleep or if it is ok to enter shutdown sleep (SDS) or not.

when poll type is WICED_BT_LOW_POWER_MODE_POLL_TYPE_SLEEP, return value 0 indicates do not sleep; return value non-zero indicates the sleep time allowed. when poll type is WICED_BT_LOW_POWER_MODE_POLL_TYPE_SDS, return value WICED_BT_PMU_SLEEP_SDS_ALLOWED indicates OK to enter SDS. return value WICED_BT_PMU_SLEEP_NO_SDS indicates do not enter SDS;

Enumeration Type Documentation

anonymous enum

The wake up sources.

Enumerator
WICED_BT_LPM_WAKE_SOURCE_GPIO 

Wake from GPIO.

WICED_BT_LPM_WAKE_SOURCE_LHL 

Wake from LHL is the same as waking from GPIO.

WICED_BT_LPM_WAKE_SOURCE_KEYSCAN 

Wake from keyscan.

WICED_BT_LPM_WAKE_SOURCE_QUAD 

Wake from wuadrature sensor.

WICED_BT_LPM_WAKE_SOURCE_MASK 

All wake HID sources.

The sleep type of the power managment modole (PMU)

Enumerator
WICED_BT_PMU_SLEEP_NOT_ALLOWED 

sleep is not allowed

WICED_BT_PMU_SLEEP_SDS_ALLOWED 

shutdown sleep (SDS) is allowed. SDS will disable almost all the HW during sleep

WICED_BT_PMU_SLEEP_NO_SDS 

shutdown sleep (SDS) is NOT allowed. SDS will disable almost all the HW during sleep

Enumerator
WICED_BT_LOW_POWER_MODE_POLL_TYPE_SLEEP 

lpm is probing the registered method if device can sleep

WICED_BT_LOW_POWER_MODE_POLL_TYPE_SDS 

lpm is probing the registered method if the device can enter shutdown sleep (SDS)

Function Documentation

void wiced_hal_lpm_enable_wake_from ( uint32_t  sources)

Enables wake up from the given sources.

Parameters
sources- The WICED_BT_LPM_WAKE_SOURCE_* sources for wake. See bellowed:
enum
{
    /// Wake from GPIO
    WICED_BT_LPM_WAKE_SOURCE_GPIO    = (1 << 8),

    /// Wake from LHL is the same as waking from GPIO
    WICED_BT_LPM_WAKE_SOURCE_LHL     = WICED_BT_LPM_WAKE_SOURCE_GPIO,

    /// Wake from keyscan
    WICED_BT_LPM_WAKE_SOURCE_KEYSCAN = (1 << 6),

    /// Wake from wuadrature sensor
    WICED_BT_LPM_WAKE_SOURCE_QUAD    = (1 << 7),

    /// All wake HID sources
    WICED_BT_LPM_WAKE_SOURCE_MASK    = (WICED_BT_LPM_WAKE_SOURCE_GPIO | WICED_BT_LPM_WAKE_SOURCE_KEYSCAN | WICED_BT_LPM_WAKE_SOURCE_QUAD)
};
Returns
none
void wiced_hal_lpm_init ( void  )

Initialize device low power management module.

Parameters
none
Returns
none
wiced_bool_t wiced_hal_lpm_register_for_low_power_queries ( wiced_bt_lpm_callback_fp  callback,
uint32_t  context 
)

Adds the given object to the list of objects that need to be queried for sleep and SDS.

Parameters
callback- The callback that needs to be invoked to check for sleep/SDS OK. The callback should decide very quickly and return within a few 10s of uS.
context- Any arbitrary context that the callback function may need later. Will be passed in as is when the callback is invoked.
Returns
TRUE if successfully added, else FALSE.
void wiced_hal_lpm_register_for_wake_notification ( uint8_t(*)(void *)  fn,
void *  data 
)

Allows an application to register for wake notification that the wake source are enabled by wiced_hal_lpm_enable_wake_from(uint32_t sources).

Parameters
fn- Pointer to function that will handle the wake notification
data- An opaque data that is handed to callback.
Returns
none