The MCUXpresso SDK provides a peripheral driver for the Watchdog Timer module of MCUXpresso SDK devices.
Typical use case
Example use of WDT API. Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/wdt
|
|
typedef void(* | wdg_callback_t )(void) |
| | Callback function when WDT interrupt happens.
|
| |
| uint32_t wdt_config_t::timeoutCount |
The maximum timeoutCount is 0x000FFFFF.
| uint32_t wdt_config_t::threshold |
| #define FSL_WDT_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) |
| void WDT_Init |
( |
TIMERS_Type * |
base, |
|
|
const wdt_config_t * |
config |
|
) |
| |
This function register the interrupt callback, set the interrupt counter threshold, and sets the timeout to start WDT.
- Parameters
-
| base | wdt base pointer. |
| config | The configuration. |
| void WDT_Deinit |
( |
TIMERS_Type * |
base | ) |
|
This function stops the WDT, clears the interrupt flags, and unregisters the callback.
- Parameters
-
| void WDT_StartTimer |
( |
TIMERS_Type * |
base, |
|
|
uint32_t |
timeoutCount |
|
) |
| |
- Parameters
-
| base | wdt base pointer. |
| timeoutCount | the initial timeout count of the timer. The total timeout time is determined by (1 / timerCountingFreq_Hz) * timeoutCount.The maximum timeoutCount is 0x000FFFFF. |
| void WDT_StopTimer |
( |
TIMERS_Type * |
base | ) |
|
| static void WDT_SetInterruptThreshold |
( |
TIMERS_Type * |
base, |
|
|
uint32_t |
threshold |
|
) |
| |
|
inlinestatic |
The Watchdog timer includes a "timeout pre-emption" feature whereby the non-maskable interrupt output intreq_wdg_o is asserted high when the counter reaches the value specified in field WDOG_INT_THRESHOLD defined in register TIMERS_WDOG_TRIGGER_INT_REG.
- Parameters
-
| base | WDT peripheral base address |
| threshold | WDT triggerthreshold value. |
| static void WDT_SetTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
| static void WDT_ClearTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
| base | timer base pointer. |
| timer | the specific timer to be stop. |
| static bool WDT_GetTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
- Return values
-
| true | is the timer timeout, false is the timeout still not timeout. |
| static uint32_t WDT_GetRemainCount |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
| static void WDT_Feed |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
This is a mandatory step, if this function isn't called after enabling the WDT, WDT will ignore timeout errors and will not generate a WDT interrupt or reset the chip.
- Parameters
-
| base | WDT peripheral base address |
| void WDT_HandleIRQ |
( |
TIMERS_Type * |
base | ) |
|
Call this function in the ISR.
- Parameters
-
| base | WDT peripheral base address |