Microchip® Advanced Software Framework

pmm.h File Reference

This is the interface of LoRaWAN power management module.

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

#include <asf.h>
#include "sleep.h"

Data Structures

struct  _PMM_SleepReq_t
 

Macros

#define PMM_SLEEPTIME_MAX_MS   130990000u
 
#define PMM_SLEEPTIME_MIN_MS   1000u
 
#define PMM_WAKEUPTIME_MS   10u
 

Typedefs

typedef struct _PMM_SleepReq_t PMM_SleepReq_t
 
typedef enum _PMM_State_t PMM_State_t
 
typedef enum _PMM_Status_t PMM_Status_t
 

Enumerations

enum  _PMM_State_t {
  PMM_STATE_ACTIVE = 0,
  PMM_STATE_SLEEP
}
 
enum  _PMM_Status_t {
  PMM_SLEEP_REQ_DENIED = 0,
  PMM_SLEEP_REQ_PROCESSED
}
 

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...
 

#define PMM_SLEEPTIME_MAX_MS   130990000u

Referenced by PMM_Sleep(), and validateSleepDuration().

#define PMM_SLEEPTIME_MIN_MS   1000u

Referenced by validateSleepDuration().

#define PMM_WAKEUPTIME_MS   10u

Referenced by PMM_Sleep().

typedef enum _PMM_State_t PMM_State_t

Enumerator
PMM_STATE_ACTIVE 
PMM_STATE_SLEEP 
Enumerator
PMM_SLEEP_REQ_DENIED 
PMM_SLEEP_REQ_PROCESSED 

PMM_Status_t PMM_Sleep ( PMM_SleepReq_t req)

This function puts the system to sleep if possible.

Parameters
[in]*req- pointer to PMM_SleepReq_t request structure
Returns
value of type PMM_Status_t PMM_SLEEP_REQ_DENIED when sleep is not possible at the instance PMM_SLEEP_REQ_PROCESSED when sleep is possible and have already done
Parameters
[in]*req- pointer to PMM_SleepReq_t request structure
Returns
value of type PMM_Status_t PMM_SLEEP_REQ_DENIED – when sleep is not possible at the instance PMM_SLEEP_REQ_PROCESSED – when sleep is possible and have already done

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().