Microchip® Advanced Software Framework

sleep_timer.h File Reference

Sleep timer interface.

Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>

Macros

#define COMPARE_COUNT_MAX_VALUE   (0xFFFFFFFF)
 
#define MS_TO_SLEEP_TICKS(m)   ((m) * (32.769f))
 
#define SLEEP_TICKS_TO_MS(s)   ((s) * (0.0306f))
 
#define SLEEP_TICKS_TO_US(s)   ((s) * (30.5175f))
 
#define US_TO_SLEEP_TICKS(u)   ((u) * (0.03278f))
 

Functions

uint32_t SleepTimerGetElapsedTime (void)
 Calculate the Elapsed Time from the previous call of this function. More...
 
void SleepTimerInit (void)
 Initializes the sleep timer module. More...
 
void SleepTimerStart (uint32_t time, void(*cb)(void))
 Start the sleep timer. More...
 
void SleepTimerStop (void)
 Stop the sleep timer. More...
 

#define COMPARE_COUNT_MAX_VALUE   (0xFFFFFFFF)

Referenced by SleepTimerInit().

#define MS_TO_SLEEP_TICKS (   m)    ((m) * (32.769f))

Referenced by PMM_Sleep().

#define SLEEP_TICKS_TO_MS (   s)    ((s) * (0.0306f))
#define SLEEP_TICKS_TO_US (   s)    ((s) * (30.5175f))

Referenced by PMM_Wakeup().

#define US_TO_SLEEP_TICKS (   u)    ((u) * (0.03278f))

uint32_t SleepTimerGetElapsedTime ( void  )

Calculate the Elapsed Time from the previous call of this function.

Return values
Elapsedtime in ticks

References rtc, and rtc_count_get_count().

Referenced by PMM_Wakeup().

void SleepTimerStart ( uint32_t  sleepTicks,
void(*)(void)  cb 
)
void SleepTimerStop ( void  )

Stop the sleep timer.

References rtc, RTC_COUNT_CALLBACK_COMPARE_0, and rtc_count_disable_callback().

Referenced by PMM_Wakeup().