The MCUXpresso SDK provides a driver for the Self-wake-up Timer (WKT) of MCUXpresso SDK devices.
Function groups
The WKT driver supports operating the module as a time counter.
Initialization and deinitialization
The function WKT_Init() initializes the WKT with specified configurations. The function WKT_GetDefaultConfig() gets the default configurations. The initialization function configures the WKT operating mode.
The function WKT_Deinit() stops the WKT timers and disables the module clock.
Read actual WKT counter value
The function WKT_GetCounterValue() reads the current timer counting value. This function returns the real-time timer counting value, in a range from 0 to a timer period.
Start and Stop timer operations
The function WKT_StartTimer() starts the timer counting. After calling this function, the timer loads the period value, counts down to 0. When the timer reaches 0, it stops and generates a trigger pulse and sets the timeout interrupt flag.
The function WKT_StopTimer() stops the timer counting.
Status
Provides functions to get and clear the WKT status flags.
Typical use case
WKT tick example
Updates the WKT period and toggles an LED periodically. Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/wkt
Enumerator |
---|
kWKT_DividedFROClockSource |
WKT clock sourced from the divided FRO clock.
|
kWKT_LowPowerClockSource |
WKT clock sourced from the Low power clock Use this clock, LPOSCEN bit of DPDCTRL register must be enabled.
|
kWKT_ExternalClockSource |
WKT clock sourced from the Low power clock Use this clock, WAKECLKPAD_DISABLE bit of DPDCTRL register must be enabled.
|
Enumerator |
---|
kWKT_AlarmFlag |
Alarm flag.
|
void WKT_Init |
( |
WKT_Type * |
base, |
|
|
const wkt_config_t * |
config |
|
) |
| |
- Note
- This API should be called at the beginning of the application using the WKT driver.
- Parameters
-
base | WKT peripheral base address |
config | Pointer to user's WKT config structure. |
void WKT_Deinit |
( |
WKT_Type * |
base | ) |
|
- Parameters
-
base | WKT peripheral base address |
This function initializes the WKT configuration structure to default values. The default values are as follows.
- Parameters
-
config | Pointer to the WKT configuration structure. |
- See Also
- wkt_config_t
static uint32_t WKT_GetCounterValue |
( |
WKT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | WKT peripheral base address |
static uint32_t WKT_GetStatusFlags |
( |
WKT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | WKT peripheral base address |
- Returns
- The status flags. This is the logical OR of members of the enumeration wkt_status_flags_t
static void WKT_ClearStatusFlags |
( |
WKT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | WKT peripheral base address |
mask | The status flags to clear. This is a logical OR of members of the enumeration wkt_status_flags_t |
static void WKT_StartTimer |
( |
WKT_Type * |
base, |
|
|
uint32_t |
count |
|
) |
| |
|
inlinestatic |
After calling this function, timer loads a count value, counts down to 0, then stops.
- Note
- User can call the utility macros provided in fsl_common.h to convert to ticks Do not write to Counter register while the counting is in progress
- Parameters
-
base | WKT peripheral base address. |
count | The value to be loaded into the WKT Count register |
static void WKT_StopTimer |
( |
WKT_Type * |
base | ) |
|
|
inlinestatic |
This function Clears the counter and stops the timer from counting.
- Parameters
-
base | WKT peripheral base address |