42#define UINT24_MAX 0x00FFFFFFUL
47 const uint8_t badpcMask = (uint8_t)SWDT_BADPC_bm;
48 const bool isPreclearError = ((regVal & badpcMask) == badpcMask);
62 const uint8_t badcMask = (uint8_t)SWDT_BADC_bm;
63 const bool isClearError = ((regVal & badcMask) == badcMask);
77 const uint8_t unexpectedCmdMask = (uint8_t)SWDT_UC_bm;
78 const bool isUnexpectedCmdError = ((regVal & unexpectedCmdMask) == unexpectedCmdMask);
81 if (isUnexpectedCmdError)
92 const uint8_t expiredMask = (uint8_t)SWDT_EXP_bm;
93 const bool isExpiredError = ((regVal & expiredMask) == expiredMask);
121 bool isClosedWindow =
true;
123 while (isClosedWindow)
125 const uint8_t clearReadyMask = (uint8_t)(SWDT_CLEAR_bm);
129 isClosedWindow = ((regVal & clearReadyMask) != clearReadyMask);
138 if (resetVal > maxResetVal)
175 uint8_t registerConfig = (uint8_t)SWDT_ENABLE_bm;
179 registerConfig |= (uint8_t)SWDT_CCP_bm;
184 registerConfig |= (uint8_t)SWDT_LOCK_bm;
189 registerConfig |= (uint8_t)SWDT_MODE_bm;
215 const uint8_t windowConfig = (uint8_t)window << WDT_WINDOW_gp;
216 const uint8_t periodConfig = (uint8_t)period << WDT_PERIOD_gp;
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.
uint8_t SWDT_ReadIntFlags(void)
Reads the INTFLAGS register value.
void SWDT_WriteIntFlags(uint8_t value)
Overwrites the INTFLAGS register value.
void SWDT_WriteIntControl(uint8_t value)
Overwrites the INTCTRL register value.
void SWDT_WriteResetValue(uint32_t value)
Overwrites the RESET register value.
void SWDT_WriteCommand(uint8_t value)
Overwrites the COMMAND register value.
void SWDT_WriteWindowValue(uint16_t value)
Overwrites the WINDOW register value.
void SWDT_WriteControlA(uint8_t value)
Overwrites the CTRLA register value.
void MW_PreClearSwdt(void)
Sends a PRECLEAR command to the Synchronous Watchdog.
errFlag_t MW_SetWdtTimeout(wdtTimeout_t window, wdtTimeout_t period)
Configures and enables the Watchdog Timer in either Normal or Window mode.
void MW_ClearSwdt(void)
Sends a CLEAR command to the Synchronous Watchdog.
#define UINT24_MAX
Defines max value for 24-bit registers.
errFlag_t MW_GetSwdtClearError(void)
Reads the error flag indicating a non-clear command received while expecting a clear command in the S...
void MW_EnableSwdt(bool useCcp, bool useLock, bool useInstrMode)
Enables the Synchronous Watchdog Timer with the provided configurations.
errFlag_t MW_GetSwdtCounterExpiredError(void)
Reads the error flag indicating that the Synchronous Watchdog counter expired.
wdtTimeout_t
Defines available timeout configurations for the Watchdog Timer.
errFlag_t MW_SetSwdtResetValue(uint32_t resetVal)
Sets the Synchronous Watchdog Timer countdown reset value.
void MW_EnableSwdtInterrupts(void)
Enables all Synchronous Watchdog error interrupts.
errFlag_t MW_GetSwdtPreclearError(void)
Reads the error flag indicating a non-preclear command received while expecting a preclear command in...
void MW_ClearWdt(void)
Clears the Watchdog Timer by issuing a Watchdog Reset (WDR) instruction.
void ASM_IssueWdrInstruction(void)
Issues a Watchdog Reset instruction (WDR) to clear the WDT using assembly.
errFlag_t MW_SetSwdtWindowValue(uint16_t window)
Sets the Synchronous Watchdog Timer open window value.
void MW_ClearSwdtErrors(void)
Clears all the error flags in the Synchronous Watchdog.
errFlag_t MW_GetSwdtUnexpectedCmdError(void)
Reads the error flag indicating a clear command received in the closed window after a preclear comman...
void WDT_WriteControlA(uint8_t value)
Overwrites the CTRLA register value.
Contains assembly API for the Watchdog Manager.