Microchip® Advanced Software Framework

sleep_mgr.c File Reference

Copyright (c) 2018 - 2019 Microchip Technology Inc.

and its subsidiaries.

#include "sleep_mgr.h"
#include "rtc_count.h"
#include "system.h"
#include "rtc_count_interrupt.h"
#include "asf.h"
#include "trx_access.h"
#include "sysTimer.h"

Macros

#define MIN_SLEEP_INTERVAL   (1000)
 

Functions

static void configure_rtc_callbacks (void)
 Configuring RTC Callback Function on Overflow. More...
 
static void rtc_overflow_callback (void)
 Callback Function indicating RTC Overflow. More...
 
static void sleepExit (uint32_t sleepTime)
 Sleep Exit procedures. More...
 
void sleepMgr_init (void)
 This function Initializes the Sleep functions Enable RTC Clock in conf_clocks.h. More...
 
bool sleepMgr_sleep (uint32_t interval)
 This function puts the transceiver and device to sleep interval - the time to sleep in milliseconds. More...
 
static void sleepPreparation (void)
 Sleep Preparation procedures. More...
 

Variables

struct rtc_module rtc_instance
 [rtc_module_instance] More...
 

#define MIN_SLEEP_INTERVAL   (1000)

Referenced by sleepMgr_sleep().

static void configure_rtc_callbacks ( void  )
static

Configuring RTC Callback Function on Overflow.

Parameters
void

References RTC_COUNT_CALLBACK_OVERFLOW, rtc_count_enable_callback(), rtc_count_register_callback(), rtc_instance, and rtc_overflow_callback().

Referenced by main(), sleepMgr_init(), and sleepMgr_sleep().

static void rtc_overflow_callback ( void  )
static

Callback Function indicating RTC Overflow.

Parameters
void

References rtc_count_disable(), and rtc_instance.

Referenced by configure_rtc_callbacks().

static void sleepExit ( uint32_t  sleepTime)
static

Sleep Exit procedures.

Parameters
sleepTime

References SYS_TimerAdjust_SleptTime().

Referenced by sleepMgr_sleep().

void sleepMgr_init ( void  )

This function Initializes the Sleep functions Enable RTC Clock in conf_clocks.h.

This function Initializes the Sleep functions.

References rtc_count_config::clear_on_match, configure_rtc_callbacks(), rtc_count_config::mode, rtc_count_config::prescaler, rtc_count_get_config_defaults(), rtc_count_init(), RTC_COUNT_MODE_32BIT, RTC_COUNT_PRESCALER_DIV_1, and rtc_instance.

Referenced by Initialize_Demo(), and wsndemo_init().

bool sleepMgr_sleep ( uint32_t  interval)

This function puts the transceiver and device to sleep interval - the time to sleep in milliseconds.

This function puts the transceiver and device to sleep.

References configure_rtc_callbacks(), MIN_SLEEP_INTERVAL, RTC_COUNT_COMPARE_0, rtc_count_enable(), rtc_count_set_compare(), rtc_instance, sleepExit(), sleepPreparation(), system_set_sleepmode(), system_sleep(), and SYSTEM_SLEEPMODE_STANDBY.

Referenced by APP_TaskHandler(), run_p2p_demo(), and run_star_demo().

static void sleepPreparation ( void  )
static

Sleep Preparation procedures.

Parameters
void

Referenced by sleepMgr_sleep().

struct rtc_module rtc_instance

[rtc_module_instance]