Watchdog (WDOG) Peripheral API. More...
![]() |
Data Structures | |
struct | WDOG_Init_TypeDef |
Defines | |
#define | WDOG_INIT_DEFAULT |
Enumerations | |
enum | WDOG_ClkSel_TypeDef { wdogClkSelULFRCO = _WDOG_CTRL_CLKSEL_ULFRCO, wdogClkSelLFRCO = _WDOG_CTRL_CLKSEL_LFRCO, wdogClkSelLFXO = _WDOG_CTRL_CLKSEL_LFXO } |
enum | WDOG_PeriodSel_TypeDef { wdogPeriod_9 = 0x0, wdogPeriod_17 = 0x1, wdogPeriod_33 = 0x2, wdogPeriod_65 = 0x3, wdogPeriod_129 = 0x4, wdogPeriod_257 = 0x5, wdogPeriod_513 = 0x6, wdogPeriod_1k = 0x7, wdogPeriod_2k = 0x8, wdogPeriod_4k = 0x9, wdogPeriod_8k = 0xA, wdogPeriod_16k = 0xB, wdogPeriod_32k = 0xC, wdogPeriod_64k = 0xD, wdogPeriod_128k = 0xE, wdogPeriod_256k = 0xF } |
Functions | |
void | WDOG_Enable (bool enable) |
Enable/disable the watchdog timer. | |
void | WDOG_Feed (void) |
Feed the watchdog. | |
void | WDOG_Init (const WDOG_Init_TypeDef *init) |
Initialize watchdog (assuming the watchdog configuration has not been locked). | |
void | WDOG_Lock (void) |
Lock the watchdog configuration. |
Watchdog (WDOG) Peripheral API.
#define WDOG_INIT_DEFAULT |
{ true, /* Start watchdog when init done */ \ false, /* WDOG not counting during debug halt */ \ false, /* WDOG not counting when in EM2 */ \ false, /* WDOG not counting when in EM3 */ \ false, /* EM4 can be entered */ \ false, /* Do not block disabling LFRCO/LFXO in CMU */ \ false, /* Do not lock WDOG configuration (if locked, reset needed to unlock) */ \ wdogClkSelULFRCO, /* Select 1kHZ WDOG oscillator */ \ wdogPeriod_256k /* Set longest possible timeout period */ \ }
Suggested default config for WDOG init structure.
enum WDOG_ClkSel_TypeDef |
Watchdog period selection.
void WDOG_Enable | ( | bool | enable | ) |
Enable/disable the watchdog timer.
[in] | enable | true to enable watchdog, false to disable. Watchdog cannot be disabled if watchdog has been locked. |
Definition at line 69 of file em_wdog.c.
References BITBAND_Peripheral().
void WDOG_Feed | ( | void | ) |
void WDOG_Init | ( | const WDOG_Init_TypeDef * | init | ) |
Initialize watchdog (assuming the watchdog configuration has not been locked).
[in] | init | Structure holding watchdog configuration. A default setting WDOG_INIT_DEFAULT is available for init. |
Definition at line 130 of file em_wdog.c.
References BITBAND_Peripheral(), WDOG_Init_TypeDef::clkSel, WDOG_Init_TypeDef::debugRun, WDOG_Init_TypeDef::em2Run, WDOG_Init_TypeDef::em3Run, WDOG_Init_TypeDef::em4Block, WDOG_Init_TypeDef::enable, WDOG_Init_TypeDef::lock, WDOG_Init_TypeDef::perSel, WDOG_Init_TypeDef::swoscBlock, and WDOG_Lock().
void WDOG_Lock | ( | void | ) |
Lock the watchdog configuration.
This prevents errors from overwriting the watchdog configuration, possibly disabling it. Only a reset can unlock the watchdog config, once locked.
If the LFRCO or LFXO clocks are used to clock the watchdog, one should consider using the option of inhibiting those clocks to be disabled, please see the WDOG_Enable() init structure.
Definition at line 211 of file em_wdog.c.
References BITBAND_Peripheral().
Referenced by WDOG_Init().