Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Power Manager (PM)

This is a stub on the SAM Power Manager Control (PMC) for the sleepmgr service.

Note
To minimize the code overhead, these functions do not feature interrupt-protected access since they are likely to be called inside interrupt handlers or in applications where such protection is not necessary. If such protection is needed, it must be ensured by the calling code.

Macros

#define SAM_PM_SMODE_ACTIVE   0
 Sets the MCU in the specified sleep mode. More...
 
#define SAM_PM_SMODE_BACKUP   5
 Backup Mode. More...
 
#define SAM_PM_SMODE_SLEEP_WFE   1
 Wait for Events. More...
 
#define SAM_PM_SMODE_SLEEP_WFI   2
 Wait for Interrupts. More...
 
#define SAM_PM_SMODE_WAIT   4
 Wait Mode. More...
 
#define SAM_PM_SMODE_WAIT_FAST   3
 Wait Mode, startup fast (in 3ms) More...
 
#define SCR_SLEEPDEEP   (0x1 << 2)
 (SCR) Sleep deep bit More...
 

Typedefs

typedef void(* pmc_callback_wakeup_clocks_restored_t )(void)
 Clocks restored callback function type. More...
 

Functions

bool pmc_is_wakeup_clocks_restored (void)
 Check if clocks are restored after wakeup (For WAIT mode. More...
 
void pmc_sleep (int sleep_mode)
 Enter sleep mode. More...
 
void pmc_wait_wakeup_clocks_restore (pmc_callback_wakeup_clocks_restored_t callback)
 

#define SAM_PM_SMODE_ACTIVE   0

Sets the MCU in the specified sleep mode.

Parameters
sleep_modeSleep mode to set.Active
#define SAM_PM_SMODE_BACKUP   5

Backup Mode.

#define SAM_PM_SMODE_SLEEP_WFE   1

Wait for Events.

#define SAM_PM_SMODE_SLEEP_WFI   2

Wait for Interrupts.

#define SAM_PM_SMODE_WAIT   4

Wait Mode.

#define SAM_PM_SMODE_WAIT_FAST   3

Wait Mode, startup fast (in 3ms)

#define SCR_SLEEPDEEP   (0x1 << 2)

(SCR) Sleep deep bit

typedef void(* pmc_callback_wakeup_clocks_restored_t)(void)

Clocks restored callback function type.

Registered by routine pmc_wait_wakeup_clocks_restore() Callback called when all clocks are restored.

bool pmc_is_wakeup_clocks_restored ( void  )

Check if clocks are restored after wakeup (For WAIT mode.

In WAIT mode, clocks are switched to FASTRC. After wakeup clocks should be restored, before that some of the ISR should not be served, otherwise there may be timing or clock issue.)

void pmc_sleep ( int  sleep_mode)

Enter sleep mode.

Parameters
sleep_modeSleep mode to enter

Referenced by sleepmgr_sleep().

void pmc_wait_wakeup_clocks_restore ( pmc_callback_wakeup_clocks_restored_t  callback)
Returns
true if start waiting