Microchip® Advanced Software Framework

sleep_mgr.c File Reference

Copyright (c) 2014-2018 Microchip Technology Inc.

and its subsidiaries.

#include "sleep_mgr.h"
#include "sleepmgr.h"
#include "sysclk.h"
#include "delay.h"

Macros

#define RTC32_SyncBusy()   (RTC32.SYNCCTRL & RTC32_SYNCBUSY_bm)
 This macro returns the RTC32 CNT/CTRL write synchronization flag. More...
 
#define RTC32_SyncCnt()   (RTC32.SYNCCTRL |= RTC32_SYNCCNT_bm)
 This macro initiates read synchronization of the RTC32 CNT register. More...
 
#define RTC32_SyncCntBusy()   (RTC32.SYNCCTRL & RTC32_SYNCCNT_bm)
 This macro returns the RTC32 CNT read synchronization flag. More...
 

Functions

 ISR (RTC32_COMP_vect)
 
static void RTC32_Initialize (uint32_t period, uint32_t count, uint32_t compareValue)
 
static void RTC32_SetTimeout (uint32_t alarmTimeout)
 
void sm_init (void)
 This function Initializes the Sleep functions. More...
 
void sm_sleep (uint32_t interval)
 This function puts the device to sleep. More...
 

#define RTC32_SyncBusy ( )    (RTC32.SYNCCTRL & RTC32_SYNCBUSY_bm)

This macro returns the RTC32 CNT/CTRL write synchronization flag.

Returns
Non-Zero if RTC32 is busy synchronizing CNT/CTRL from system to RTC32 clock domain, and zero otherwise.

Referenced by RTC32_Initialize().

#define RTC32_SyncCnt ( )    (RTC32.SYNCCTRL |= RTC32_SYNCCNT_bm)

This macro initiates read synchronization of the RTC32 CNT register.

Initiates synchronization of CNT register from RTC to system clock domain.

Referenced by RTC32_SetTimeout().

#define RTC32_SyncCntBusy ( )    (RTC32.SYNCCTRL & RTC32_SYNCCNT_bm)

This macro returns the RTC32 CNT read synchronization flag.

Returns
Non-Zero if RTC32 is busy synchronizing CNT from RTC to system clock domain, zero otherwise.

Referenced by RTC32_SetTimeout().

ISR ( RTC32_COMP_vect  )
static void RTC32_Initialize ( uint32_t  period,
uint32_t  count,
uint32_t  compareValue 
)
static
static void RTC32_SetTimeout ( uint32_t  alarmTimeout)
static

References RTC32_SyncCnt, and RTC32_SyncCntBusy.

Referenced by sm_sleep().

void sm_init ( void  )

This function Initializes the Sleep functions.

References RTC32_Initialize(), sleepmgr_init(), sleepmgr_lock_mode(), SLEEPMGR_PSAVE, sysclk_enable_module(), SYSCLK_PORT_GEN, and SYSCLK_RTC.

Referenced by wsndemo_init().

void sm_sleep ( uint32_t  interval)

This function puts the device to sleep.

This function puts the transceiver and device to sleep.

References RTC32_SetTimeout(), and sleepmgr_enter_sleep().

Referenced by APP_TaskHandler().