This is the implementation of LoRaWAN power management module.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries.
Copyright (c) 2019-2020 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include "pmm.h"
#include "conf_pmm.h"
#include "hw_timer.h"
#include "sw_timer.h"
#include "sleep_timer.h"
#include "sleep.h"
#include "atomic.h"
#include "system_task_manager.h"
Macros | |
#define | SW_TIMER_ERROR_CORRECTION_TICKS 2 |
Functions | |
PMM_Status_t | PMM_Sleep (PMM_SleepReq_t *req) |
This function puts the system to sleep if possible. More... | |
void | PMM_Wakeup (void) |
Wakeup from sleep. More... | |
static bool | validateSleepDuration (uint32_t durationMs) |
Variables | |
static PMM_State_t | pmmState = PMM_STATE_ACTIVE |
static PMM_SleepReq_t * | sleepReq = NULL |
#define SW_TIMER_ERROR_CORRECTION_TICKS 2 |
PMM_Status_t PMM_Sleep | ( | PMM_SleepReq_t * | req | ) |
This function puts the system to sleep if possible.
[in] | *req | - pointer to PMM_SleepReq_t request structure |
References HAL_Sleep(), MS_TO_SLEEP_TICKS, PMM_SLEEP_REQ_DENIED, PMM_SLEEP_REQ_PROCESSED, PMM_SLEEPTIME_MAX_MS, PMM_STATE_ACTIVE, PMM_STATE_SLEEP, PMM_Wakeup(), PMM_WAKEUPTIME_MS, pmmState, _PMM_SleepReq_t::sleep_mode, _PMM_SleepReq_t::sleepTimeMs, SleepTimerStart(), SWTIMER_INVALID_TIMEOUT, SwTimerNextExpiryDuration(), SYSTEM_ReadyToSleep(), SystemTimerSuspend(), US_TO_MS, and validateSleepDuration().
Referenced by processJoinAndSend().
void PMM_Wakeup | ( | void | ) |
Wakeup from sleep.
References NULL, PMM_STATE_ACTIVE, PMM_STATE_SLEEP, pmmState, _PMM_SleepReq_t::pmmWakeupCallback, SLEEP_TICKS_TO_US, SleepTimerGetElapsedTime(), SleepTimerStop(), SystemTimerSync(), and US_TO_MS.
Referenced by HAL_RadioDIO0Callback(), HAL_RadioDIO1Callback(), HAL_RadioDIO2Callback(), and PMM_Sleep().
|
inlinestatic |
References PMM_SLEEPTIME_MAX_MS, PMM_SLEEPTIME_MIN_MS, and SWTIMER_INVALID_TIMEOUT.
Referenced by PMM_Sleep().
|
static |
Referenced by PMM_Sleep(), and PMM_Wakeup().
|
static |
Referenced by processJoinAndSend().