Sleep mode¶
Note
This is only implemented for NXP MKW41Z platform.
Types¶
mira_sleep_callback_t¶
Enums¶
mira_sleep_mode_t¶
Name | Description |
---|---|
MIRA_SLEEP_MODE_RUN |
Stay in Run with high frequency clock enabled. |
MIRA_SLEEP_MODE_WAIT |
Wait in WFI |
MIRA_SLEEP_MODE_SLEEP |
Sleep mode with high frequency clock disabled. |
Functions¶
mira_sleep_set_callbacks¶
mira_status_t mira_sleep_set_callbacks(mira_sleep_callback_t enter_cb, mira_sleep_callback_t exit_cb, void *storage);
Configure sleep mode callbacks.
Setup sleep mode callbacks to be called before and after entering sleep. The time spent in callback should be as short as possible to not shorten the sleep time and in turn increase the energy consumption. If callback is not set, the default sleep state is WFI.
Note
This does only apply to platforms where it is necessary to control the sleep state. On other platforms these methods should not be used.
Parameters¶
Name | Description |
---|---|
enter_cb | Callback function before entering sleep. The callback function should return which sleep mode that is allowed (mira_sleep_mode_t). |
exit_cb | Callback function after exiting sleep. |
*storage | Storage pointer which is used to store optional information to be used by the callback function. |
Return value¶
Name | Description |
---|---|
MIRA_SUCCESS | Callback set successfully. |
MIRA_ERROR_UNKNOWN | An unknown error occurred. |
MIRA_ERROR_NOT_IMPLEMENTED | Sleep callback functionality not implemented. |
MIRA_ERROR_INVALID_VALUE | Invalid input values. |