FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
driver_slpctrl.c
Go to the documentation of this file.
1
22
23// Framework Includes
24#include <driver_ccp_asm.h>
25#include <driver_slpctrl.h>
26
27// Device-specific Includes
28#include <xc.h>
29
30void SLPCTRL_ModifyControlA(uint8_t groupMask, uint8_t groupConfig)
31{
32 const uint8_t currentValue = SLPCTRL.CTRLA;
33 const uint8_t clearedConfig = currentValue & (uint8_t)(~groupMask);
34 const uint8_t newConfig = groupConfig & groupMask;
35 const uint8_t updatedValue = clearedConfig | newConfig;
36
37 SLPCTRL.CTRLA = updatedValue;
38}
39
40void SLPCTRL_WriteControlB(uint8_t value)
41{
42 ASM_WriteCcp8(&SLPCTRL.CTRLB, value);
43}
44
45void SLPCTRL_WriteVregControl(uint8_t value)
46{
47 ASM_WriteCcp8(&SLPCTRL.VREGCTRL, value);
48}
49
50void SLPCTRL_WriteIntControl(uint8_t value)
51{
52 SLPCTRL.INTCTRL = value;
53}
54
56{
57 return SLPCTRL.INTFLAGS;
58}
59
60void SLPCTRL_WriteIntFlags(uint8_t value)
61{
62 SLPCTRL.INTFLAGS = value;
63}
void ASM_WriteCcp8(register8_t *regAddr, uint8_t value)
Writes value to a Configuration Change Protected (CCP) 8-bit register.
void SLPCTRL_ModifyControlA(uint8_t groupMask, uint8_t groupConfig)
Modifies specific bit field(s) in the CTRLA register.
void SLPCTRL_WriteVregControl(uint8_t value)
Overwrites the VREGCTRL register value.
void SLPCTRL_WriteIntFlags(uint8_t value)
Overwrites the INTFLAGS register value.
void SLPCTRL_WriteIntControl(uint8_t value)
Overwrites the INTCTRL register value.
void SLPCTRL_WriteControlB(uint8_t value)
Overwrites the CTRLB register value.
uint8_t SLPCTRL_ReadIntFlags(void)
Reads the INTFLAGS register value.