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.
Elapsed | time in ticks |
References rtc, and rtc_count_get_count().
Referenced by PMM_Wakeup().
void SleepTimerInit | ( | void | ) |
Initializes the sleep timer module.
References COMPARE_COUNT_MAX_VALUE, rtc_count_config::compare_values, rtc_count_config::prescaler, rtc, rtc_count_enable(), rtc_count_get_config_defaults(), rtc_count_init(), and RTC_COUNT_PRESCALER_OFF.
void SleepTimerStart | ( | uint32_t | sleepTicks, |
void(*)(void) | cb | ||
) |
Start the sleep timer.
Start the sleep timer.
References rtc, RTC_COUNT_CALLBACK_COMPARE_0, RTC_COUNT_COMPARE_0, rtc_count_enable_callback(), rtc_count_register_callback(), rtc_count_set_compare(), and rtc_count_set_count().
Referenced by PMM_Sleep().
void SleepTimerStop | ( | void | ) |
Stop the sleep timer.
References rtc, RTC_COUNT_CALLBACK_COMPARE_0, and rtc_count_disable_callback().
Referenced by PMM_Wakeup().