FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
midware_power_manager.h
Go to the documentation of this file.
1
27#ifndef MIDWARE_POWER_MANAGER_H
28#define MIDWARE_POWER_MANAGER_H
29
30// Standard Library Includes
31#include <stdbool.h>
32#include <stdint.h>
33
34// Framework Includes
35#include <define_error_flags.h>
36
37// Device-specific Includes
38#include <xc.h>
39
46typedef enum
47{
48 SLP_MODE_IDLE = SLPCTRL_SMODE_IDLE_gc >> SLPCTRL_SMODE_gp,
49 SLP_MODE_STANDBY = SLPCTRL_SMODE_STDBY_gc >> SLPCTRL_SMODE_gp,
50 SLP_MODE_POWER_DOWN = SLPCTRL_SMODE_PDOWN_gc >> SLPCTRL_SMODE_gp,
53
60typedef enum
61{
62 VLM_THRESHOLD_OFF = BOD_VLMLVL_OFF_gc >> BOD_VLMLVL_gp,
63 VLM_THRESHOLD_PCT_5 = BOD_VLMLVL_5ABOVE_gc >> BOD_VLMLVL_gp,
64 VLM_THRESHOLD_PCT_15 = BOD_VLMLVL_15ABOVE_gc >> BOD_VLMLVL_gp,
65 VLM_THRESHOLD_PCT_25 = BOD_VLMLVL_25ABOVE_gc >> BOD_VLMLVL_gp,
68
75typedef enum
76{
77 VLM_TRIGGER_FALLING = BOD_VLMCFG_FALLING_gc >> BOD_VLMCFG_gp,
78 VLM_TRIGGER_RISING = BOD_VLMCFG_RISING_gc >> BOD_VLMCFG_gp,
79 VLM_TRIGGER_BOTH = BOD_VLMCFG_BOTH_gc >> BOD_VLMCFG_gp,
82
95
107
120
132
144
156
168
180
192
197void MW_EnablePowerInterrupts(void);
198
213
226
240void MW_SetVmonSleep(bool enableInSleep, bool useFullPowerMode);
241
242#endif // MIDWARE_POWER_MANAGER_H
Defines error flag type for indicating detected errors in Middleware services.
errFlag_t
Defines the error flag used by Middleware services to indicate error detection.
errFlag_t MW_GetClearVmonOverError(void)
Reads and clears the flag indicating an overvoltage error detected by the Voltage Monitor.
vlmTrigger_t
Type defines for available Voltage Level Monitor (VLM) trigger configurations.
errFlag_t MW_GetClearVmonDiagEntryError(void)
Reads and clears the flag indicating a Diagnostic Mode entry error in the Voltage Monitor.
errFlag_t MW_GetClearVmonDiagExitError(void)
Reads and clears the flag indicating an Diagnostic Mode exit error in the Voltage Monitor.
errFlag_t MW_GetClearVmonUnderError(void)
Reads and clears the flag indicating an undervoltage error detected by the Voltage Monitor.
vlmThreshold_t
Type defines for available Voltage Level Monitor (VLM) threshold levels.
errFlag_t MW_GetClearVlmError(void)
Reads and clears the flag indicating a supply voltage trigger error detected by the Voltage Level Mon...
errFlag_t MW_GetClearSleepError(void)
Reads and clears the flag indicating a Sleep Aborted error in the Sleep Controller.
void MW_SetVmonSleep(bool enableInSleep, bool useFullPowerMode)
Configures Voltage Monitor (VMON) operation during Standby or Power-Down sleep.
errFlag_t MW_GetClearVmonSleepEntryError(void)
Reads and clears the flag indicating a sleep mode entry error in the Voltage Monitor.
errFlag_t MW_GetClearVmonInternalError(void)
Reads and clears the flag indicating internal error in the Voltage Monitor.
errFlag_t MW_ConfigVlm(vlmThreshold_t threshold, vlmTrigger_t trigger)
Configures the Voltage Level Monitor (VLM) with the provided voltage threshold and trigger condition.
sleepMode_t
Type defines for available sleep modes.
errFlag_t MW_SetSleepMode(sleepMode_t sleepMode)
Sets the sleep mode to be used when entering Sleep.
void MW_EnablePowerInterrupts(void)
Enables power related interrupts, including VMON, VLM and sleep error related interrupts.
errFlag_t MW_GetClearVmonDisabledError(void)
Reads and clears the flag indicating a disabled Voltage Monitor error.
@ VLM_TRIGGER_BOTH
@ VLM_TRIGGER_RISING
@ VLM_TRIGGER_MAX
@ VLM_TRIGGER_FALLING
@ VLM_THRESHOLD_PCT_25
@ VLM_THRESHOLD_MAX
@ VLM_THRESHOLD_PCT_5
@ VLM_THRESHOLD_PCT_15
@ VLM_THRESHOLD_OFF
@ SLP_MODE_IDLE
@ SLP_MODE_STANDBY
@ SLP_MODE_POWER_DOWN