Driver API for WDT (plib_wdt.h) More...
Typedefs | |
| typedef void(* | WDT_CALLBACK_HANDLER) (void) |
| Function pointer type for Watchdog Timer callback. | |
| typedef uint8_t | WDT_TIMEOUT_PERIOD |
| WDT timeout period identifier. | |
| typedef uint8_t | WDT_WINDOW_CLOSED_PERIOD |
| WDT window closed period identifier. | |
| typedef uint8_t | WDT_EARLY_WARNING_OFFSET |
| WDT early warning offset identifier. | |
Functions | |
| void | WDT_Enable (void) |
| Enables the Watchdog Timer. | |
| void | WDT_Disable (void) |
| Disables the Watchdog Timer. | |
| void | WDT_Clear (void) |
| Clears (refreshes) the Watchdog Timer. | |
| void | WDT_SetCallbackHandler (WDT_CALLBACK_HANDLER callback) |
| Registers the callback handler to be invoked from the WDT ISR. | |
| void | WDT_SetTimeout (WDT_TIMEOUT_PERIOD period) |
| Sets the WDT timeout period. | |
| bool | WDT_EnableWindowMode (WDT_WINDOW_CLOSED_PERIOD window) |
| Enables the WDT window mode. | |
| void | WDT_DisableWindowMode (void) |
| Disables the WDT window mode. | |
| bool | WDT_SetEarlyWarningOffset (WDT_EARLY_WARNING_OFFSET offset) |
| Sets the WDT early warning offset. | |
| bool | WDT_IsAlwaysOn (void) |
| Checks if the WDT is configured as always-on. | |
| void | WDT_EnableEarlyWarning (void) |
| Enables WDT Early Warning interrupt. | |
| void | WDT_DisableEarlyWarning (void) |
| Disables WDT Early Warning interrupt. | |
| bool | WDT_EarlyWarningIsSet (void) |
| Checks if Early Warning interrupt flag is set. | |
| void | WDT_ClearEarlyWarning (void) |
| Clears Early Warning interrupt flag. | |
Driver API for WDT (plib_wdt.h)
The following example demonstrates typical usage of the WDT peripheral:
| typedef void(* WDT_CALLBACK_HANDLER) (void) |
Function pointer type for Watchdog Timer callback.
WDT early warning offset identifier.
Defines how many watchdog clock cycles before timeout the Early Warning interrupt is generated.
WDT timeout period identifier.
A system reset occurs if the watchdog is not cleared before timeout.
WDT window closed period identifier.
Defines the time interval during which clearing the watchdog is not allowed when Window Mode is enabled. Writing CLEAR during this closed window causes an immediate reset.
| void WDT_Clear | ( | void | ) |
Clears (refreshes) the Watchdog Timer.
Resets the WDT counter to avoid system reset. Must be called periodically.
| void WDT_ClearEarlyWarning | ( | void | ) |
Clears Early Warning interrupt flag.
| void WDT_Disable | ( | void | ) |
Disables the Watchdog Timer.
Stops the WDT from counting down.
| void WDT_DisableEarlyWarning | ( | void | ) |
Disables WDT Early Warning interrupt.
| void WDT_DisableWindowMode | ( | void | ) |
Disables the WDT window mode.
Disables the restricted window requirement for clearing the WDT.
| bool WDT_EarlyWarningIsSet | ( | void | ) |
Checks if Early Warning interrupt flag is set.
| void WDT_Enable | ( | void | ) |
Enables the Watchdog Timer.
Starts the WDT countdown.
| void WDT_EnableEarlyWarning | ( | void | ) |
Enables WDT Early Warning interrupt.
| bool WDT_EnableWindowMode | ( | WDT_WINDOW_CLOSED_PERIOD | window | ) |
Enables the WDT window mode.
When enabled, the WDT must be cleared only within a specific window period.
| window | Window size to configure. |
| bool WDT_IsAlwaysOn | ( | void | ) |
Checks if the WDT is configured as always-on.
Some devices may not allow disabling the WDT. This function returns that status.
| void WDT_SetCallbackHandler | ( | WDT_CALLBACK_HANDLER | callback | ) |
Registers the callback handler to be invoked from the WDT ISR.
| callback | Pointer to the callback function. |
This function is used to set a user-defined function that will be called when a WDT interrupt or timeout event occurs.
| bool WDT_SetEarlyWarningOffset | ( | WDT_EARLY_WARNING_OFFSET | offset | ) |
Sets the WDT early warning offset.
Configures the Early Warning interrupt offset. Valid only in normal mode.
| offset | Early warning offset value. |
| void WDT_SetTimeout | ( | WDT_TIMEOUT_PERIOD | period | ) |
Sets the WDT timeout period.
Configures the WDT to timeout after the given period.
| period | The timeout value in supported units (hardware-dependent). |