The MCUXpresso SDK provides a peripheral driver for the WDOG32 module of MCUXpresso SDK devices.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/wdog32
struct wdog32_work_mode_t |
Data Fields |
bool | enableWait |
| Enables or disables WDOG32 in wait mode.
|
|
bool | enableStop |
| Enables or disables WDOG32 in stop mode.
|
|
bool | enableDebug |
| Enables or disables WDOG32 in debug mode.
|
|
Enumerator |
---|
kWDOG32_ClockSource0 |
Clock source 0.
|
kWDOG32_ClockSource1 |
Clock source 1.
|
kWDOG32_ClockSource2 |
Clock source 2.
|
kWDOG32_ClockSource3 |
Clock source 3.
|
Enumerator |
---|
kWDOG32_ClockPrescalerDivide1 |
Divided by 1.
|
kWDOG32_ClockPrescalerDivide256 |
Divided by 256.
|
Enumerator |
---|
kWDOG32_TestModeDisabled |
Test Mode disabled.
|
kWDOG32_UserModeEnabled |
User Mode enabled.
|
kWDOG32_LowByteTest |
Test Mode enabled, only low byte is used.
|
kWDOG32_HighByteTest |
Test Mode enabled, only high byte is used.
|
This structure contains the settings for all of the WDOG32 interrupt configurations.
Enumerator |
---|
kWDOG32_InterruptEnable |
Interrupt is generated before forcing a reset.
|
This structure contains the WDOG32 status flags for use in the WDOG32 functions.
Enumerator |
---|
kWDOG32_RunningFlag |
Running flag, set when WDOG32 is enabled.
|
kWDOG32_InterruptFlag |
Interrupt flag, set when interrupt occurs.
|
This function initializes the WDOG32 configuration structure to default values. The default values are:
* wdog32Config->enableWdog32 = true;
* wdog32Config->workMode.enableWait = true;
* wdog32Config->workMode.enableStop = false;
* wdog32Config->workMode.enableDebug = false;
* wdog32Config->enableUpdate = true;
* wdog32Config->enableInterrupt = false;
* wdog32Config->enableWindowMode = false;
* wdog32Config->windowValue = 0U;
* wdog32Config->timeoutValue = 0xFFFFU;
*
- Parameters
-
config | Pointer to the WDOG32 configuration structure. |
- See Also
- wdog32_config_t
This function initializes the WDOG32. To reconfigure the WDOG32 without forcing a reset first, enableUpdate must be set to true in the configuration.
Example:
- Parameters
-
base | WDOG32 peripheral base address. |
config | The configuration of the WDOG32. |
void WDOG32_Deinit |
( |
WDOG_Type * |
base | ) |
|
This function shuts down the WDOG32. Ensure that the WDOG_CS.UPDATE is 1, which means that the register update is enabled.
- Parameters
-
base | WDOG32 peripheral base address. |
void WDOG32_Unlock |
( |
WDOG_Type * |
base | ) |
|
This function unlocks the WDOG32 register written.
Before starting the unlock sequence and following the configuration, disable the global interrupts. Otherwise, an interrupt could effectively invalidate the unlock sequence and the WCT may expire. After the configuration finishes, re-enable the global interrupts.
- Parameters
-
base | WDOG32 peripheral base address |
void WDOG32_Enable |
( |
WDOG_Type * |
base | ) |
|
This function writes a value into the WDOG_CS register to enable the WDOG32. The WDOG_CS register is a write-once register. Please check the enableUpdate is set to true for calling WDOG32_Init to do wdog initialize. Before call the re-configuration APIs, ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | WDOG32 peripheral base address. |
void WDOG32_Disable |
( |
WDOG_Type * |
base | ) |
|
This function writes a value into the WDOG_CS register to disable the WDOG32. The WDOG_CS register is a write-once register. Please check the enableUpdate is set to true for calling WDOG32_Init to do wdog initialize. Before call the re-configuration APIs, ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | WDOG32 peripheral base address |
void WDOG32_EnableInterrupts |
( |
WDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
This function writes a value into the WDOG_CS register to enable the WDOG32 interrupt. The WDOG_CS register is a write-once register. Please check the enableUpdate is set to true for calling WDOG32_Init to do wdog initialize. Before call the re-configuration APIs, ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | WDOG32 peripheral base address. |
mask | The interrupts to enable. The parameter can be a combination of the following source if defined:
|
void WDOG32_DisableInterrupts |
( |
WDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
This function writes a value into the WDOG_CS register to disable the WDOG32 interrupt. The WDOG_CS register is a write-once register. Please check the enableUpdate is set to true for calling WDOG32_Init to do wdog initialize. Before call the re-configuration APIs, ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | WDOG32 peripheral base address. |
mask | The interrupts to disabled. The parameter can be a combination of the following source if defined:
|
static uint32_t WDOG32_GetStatusFlags |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets all status flags.
Example to get the running flag:
- Parameters
-
base | WDOG32 peripheral base address |
- Returns
- State of the status flag: asserted (true) or not-asserted (false).
- See Also
- _wdog32_status_flags_t
- true: related status flag has been set.
- false: related status flag is not set.
void WDOG32_ClearStatusFlags |
( |
WDOG_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
This function clears the WDOG32 status flag.
Example to clear an interrupt flag:
- Parameters
-
base | WDOG32 peripheral base address. |
mask | The status flags to clear. The parameter can be any combination of the following values:
|
void WDOG32_SetTimeoutValue |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
timeoutCount |
|
) |
| |
This function writes a timeout value into the WDOG_TOVAL register. The WDOG_TOVAL register is a write-once register. To ensure the reconfiguration fits the timing of WCT, unlock function will be called inline.
- Parameters
-
base | WDOG32 peripheral base address |
timeoutCount | WDOG32 timeout value, count of WDOG32 clock ticks. |
void WDOG32_SetWindowValue |
( |
WDOG_Type * |
base, |
|
|
uint16_t |
windowValue |
|
) |
| |
This function writes a window value into the WDOG_WIN register. The WDOG_WIN register is a write-once register. Please check the enableUpdate is set to true for calling WDOG32_Init to do wdog initialize. Before call the re-configuration APIs, ensure that the WCT window is still open and this register has not been written in this WCT while the function is called.
- Parameters
-
base | WDOG32 peripheral base address. |
windowValue | WDOG32 window value. |
static void WDOG32_Refresh |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function feeds the WDOG32. This function should be called before the Watchdog timer is in timeout. Otherwise, a reset is asserted.
- Parameters
-
base | WDOG32 peripheral base address |
static uint16_t WDOG32_GetCounterValue |
( |
WDOG_Type * |
base | ) |
|
|
inlinestatic |
This function gets the WDOG32 counter value.
- Parameters
-
base | WDOG32 peripheral base address. |
- Returns
- Current WDOG32 counter value.