SLEEP_Init_t Struct Reference

Initialization structure for the sleep driver.

#include <sleep.h>

Data Fields

bool(* sleepCallback )(SLEEP_EnergyMode_t emode)
 Pointer to the callback function that is being called before the device is going to sleep.
 
void(* wakeupCallback )(SLEEP_EnergyMode_t emode)
 Pointer to the callback function that is being called after wake up.
 
uint32_t(* restoreCallback )(SLEEP_EnergyMode_t emode)
 Pointer to the callback function that is being called after wake up and before the HF clock is restored.
 

Initialization structure for the sleep driver.

This includes optional callback functions that can be used by the application to get notified about sleep related events and that can be used to control the MCU behavior when waking up from sleep.

Field Documentation

◆ sleepCallback

bool(* SLEEP_Init_t::sleepCallback) (SLEEP_EnergyMode_t emode)

Pointer to the callback function that is being called before the device is going to sleep.

This function is optional, if no sleep callback is needed by the application then this field must be set to NULL.

This callback function has a return value that can be used to force the sleep driver to not enter a sleep mode. This can be used in applications where for instance timing of events will make it inefficient to enter sleep at a certain point in time.

◆ wakeupCallback

void(* SLEEP_Init_t::wakeupCallback) (SLEEP_EnergyMode_t emode)

Pointer to the callback function that is being called after wake up.

This function is optional, if no wake up callback is needed by the application then this field must be set to NULL.

◆ restoreCallback

uint32_t(* SLEEP_Init_t::restoreCallback) (SLEEP_EnergyMode_t emode)

Pointer to the callback function that is being called after wake up and before the HF clock is restored.

This function can be used by the application to signal that the sleep driver should wakeup normally or if it should skip restoring the HF clock and go back to sleep. Delaying HF clock restore is an advanced functionality that can be used to save power in a system with frequent interrupts.

These are the supported flags that can be returned from the callback function.

SLEEP_FLAG_NONE SLEEP_FLAG_NO_CLOCK_RESTORE