Defines a platform abstraction layer for the Z-Wave power manager. More...
Typedefs | |
typedef void * | zpal_pm_handle_t |
Power lock handle. | |
Enumerations | |
enum | zpal_pm_type_t { ZPAL_PM_TYPE_USE_RADIO , ZPAL_PM_TYPE_DEEP_SLEEP } |
Defines the different power types that can be requested. More... | |
enum | zpal_pm_mode_t { ZPAL_PM_MODE_RUNNING , ZPAL_PM_MODE_SLEEP , ZPAL_PM_MODE_DEEP_SLEEP , ZPAL_PM_MODE_SHUTOFF } |
Defines the power modes the underlying platform can enter or leave. More... | |
Functions | |
void | zpal_zw_pm_event_handler (zpal_pm_mode_t from, zpal_pm_mode_t to) |
The ZPAL implementation must invoke this function whenever a transition happens between one of the power modes defined in zpal_pm_mode_t. This function is implemented by Z-Wave. | |
zpal_pm_handle_t | zpal_pm_register (zpal_pm_type_t type) |
Registers a power lock of a given type. This function must be invoked once to allocate power lock before any other API calls are made on that lock. | |
void | zpal_pm_stay_awake (zpal_pm_handle_t handle, uint32_t timeout_milliseconds) |
Makes the chip stay awake for a given time in a power mode defined by handle . The power lock must be registered with zpal_pm_register() prior to invoking this function. If invoked on an already active power lock, the timeout will be reset. | |
void | zpal_pm_cancel (zpal_pm_handle_t handle) |
Cancels an active power lock. If handle points to NULL or inactive power lock, nothing happens. | |
void | zpal_pm_cancel_all (void) |
Cancels all active power locks. | |
Defines a platform abstraction layer for the Z-Wave power manager.
The ZPAL power manager offers an API for registering power locks and for receiving events on power mode transitions. Power lock forces the chip to stay awake in a given power mode for a given time. An event handler is invoked every time the transition between power modes occurs.
Infinite lock example:
Lock with timeout example:
Requirements:
typedef void* zpal_pm_handle_t |
Power lock handle.
enum zpal_pm_mode_t |
Defines the power modes the underlying platform can enter or leave.
For instance, the platform might go from ZPAL_PM_MODE_RUNNING to ZPAL_PM_MODE_SHUTOFF if no power locks are requested.
enum zpal_pm_type_t |
Defines the different power types that can be requested.
For instance, if the Z-Wave stack or the application wants the radio available, ZPAL_PM_TYPE_USE_RADIO must be requested.
void zpal_pm_cancel | ( | zpal_pm_handle_t | handle | ) |
Cancels an active power lock. If handle
points to NULL or inactive power lock, nothing happens.
[in] | handle | Power lock handle registered by zpal_pm_register(). |
void zpal_pm_cancel_all | ( | void | ) |
Cancels all active power locks.
zpal_pm_handle_t zpal_pm_register | ( | zpal_pm_type_t | type | ) |
Registers a power lock of a given type. This function must be invoked once to allocate power lock before any other API calls are made on that lock.
[in] | type | Power lock type. |
void zpal_pm_stay_awake | ( | zpal_pm_handle_t | handle, |
uint32_t | timeout_milliseconds ) |
Makes the chip stay awake for a given time in a power mode defined by handle
. The power lock must be registered with zpal_pm_register() prior to invoking this function. If invoked on an already active power lock, the timeout will be reset.
[in] | handle | Power lock handle registered by zpal_pm_register(). |
[in] | timeout_milliseconds | Timeout value. If zero is given, the power lock will stay active until manually cancelled. |
|
extern |
The ZPAL implementation must invoke this function whenever a transition happens between one of the power modes defined in zpal_pm_mode_t. This function is implemented by Z-Wave.
[in] | from | The power mode from which the platform is coming. |
[in] | to | The power mode to which the platform is going. |