EFM32 Zero Gecko Software Documentation  efm32zg-doc-4.2.1
em_wdog.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef __SILICON_LABS_EM_WDOG_H__
35 #define __SILICON_LABS_EM_WDOG_H__
36 
37 #include "em_device.h"
38 #if defined(WDOG_COUNT) && (WDOG_COUNT > 0)
39 
40 #include <stdbool.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /***************************************************************************/
51 /***************************************************************************/
56 /*******************************************************************************
57  ******************************** ENUMS ************************************
58  ******************************************************************************/
59 
61 typedef enum
62 {
67 
69 typedef enum
70 {
71  wdogPeriod_9 = 0x0,
72  wdogPeriod_17 = 0x1,
73  wdogPeriod_33 = 0x2,
74  wdogPeriod_65 = 0x3,
78  wdogPeriod_1k = 0x7,
79  wdogPeriod_2k = 0x8,
80  wdogPeriod_4k = 0x9,
81  wdogPeriod_8k = 0xA,
88 
89 /*******************************************************************************
90  ******************************* STRUCTS ***********************************
91  ******************************************************************************/
92 
94 typedef struct
95 {
97  bool enable;
98 
100  bool debugRun;
101 
103  bool em2Run;
104 
106  bool em3Run;
107 
109  bool em4Block;
110 
113 
115  bool lock;
116 
119 
123 
125 #define WDOG_INIT_DEFAULT \
126 { \
127  true, /* Start watchdog when init done */ \
128  false, /* WDOG not counting during debug halt */ \
129  false, /* WDOG not counting when in EM2 */ \
130  false, /* WDOG not counting when in EM3 */ \
131  false, /* EM4 can be entered */ \
132  false, /* Do not block disabling LFRCO/LFXO in CMU */ \
133  false, /* Do not lock WDOG configuration (if locked, reset needed to unlock) */ \
134  wdogClkSelULFRCO, /* Select 1kHZ WDOG oscillator */ \
135  wdogPeriod_256k /* Set longest possible timeout period */ \
136 }
137 
138 
139 /*******************************************************************************
140  ***************************** PROTOTYPES **********************************
141  ******************************************************************************/
142 
143 void WDOG_Enable(bool enable);
144 void WDOG_Feed(void);
145 void WDOG_Init(const WDOG_Init_TypeDef *init);
146 void WDOG_Lock(void);
147 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif /* defined(WDOG_COUNT) && (WDOG_COUNT > 0) */
156 #endif /* __SILICON_LABS_EM_WDOG_H__ */
WDOG_ClkSel_TypeDef clkSel
Definition: em_wdog.h:118
void WDOG_Feed(void)
Feed the watchdog.
Definition: em_wdog.c:97
void WDOG_Enable(bool enable)
Enable/disable the watchdog timer.
Definition: em_wdog.c:75
WDOG_PeriodSel_TypeDef perSel
Definition: em_wdog.h:121
void WDOG_Lock(void)
Lock the watchdog configuration.
Definition: em_wdog.c:218
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define _WDOG_CTRL_CLKSEL_LFRCO
Definition: efm32zg_wdog.h:100
void WDOG_Init(const WDOG_Init_TypeDef *init)
Initialize watchdog (assuming the watchdog configuration has not been locked).
Definition: em_wdog.c:137
WDOG_ClkSel_TypeDef
Definition: em_wdog.h:61
#define _WDOG_CTRL_CLKSEL_LFXO
Definition: efm32zg_wdog.h:101
#define _WDOG_CTRL_CLKSEL_ULFRCO
Definition: efm32zg_wdog.h:99
WDOG_PeriodSel_TypeDef
Definition: em_wdog.h:69