This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.
|
enum | pit_prescaler_value_t {
kPIT_PrescalerDivBy1 = 0x0U,
kPIT_PrescalerDivBy2 = 0x1U,
kPIT_PrescalerDivBy4 = 0x2U,
kPIT_PrescalerDivBy8 = 0x3U,
kPIT_PrescalerDivBy16 = 0x4U,
kPIT_PrescalerDivBy32 = 0x5U,
kPIT_PrescalerDivBy64 = 0x6U,
kPIT_PrescalerDivBy128 = 0x7U,
kPIT_PrescalerDivBy256 = 0x8U,
kPIT_PrescalerDivBy512 = 0x9U,
kPIT_PrescalerDivBy1024 = 0xAU,
kPIT_PrescalerDivBy2048 = 0xBU,
kPIT_PrescalerDivBy4096 = 0xCU,
kPIT_PrescalerDivBy8192 = 0xDU,
kPIT_PrescalerDivBy16384 = 0xEU,
kPIT_PrescalerDivBy32768 = 0xFU
} |
| PIT clock prescaler values. More...
|
|
enum | _pit_status_flags { kPIT_Timer_RollOverFlag = PIT_CTRL_PRF_MASK
} |
| List of PIT status flags. More...
|
|
This structure holds the configuration settings for the PIT peripheral. To initialize this structure to reasonable defaults, call the PIT_GetDefaultConfig() function and pass a pointer to your config structure instance.
The configuration structure can be made constant so it resides in flash.
bool pit_config_t::bEnableSlaveMode |
uint16_t pit_config_t::u16PeriodCount |
Enumerator |
---|
kPIT_PrescalerDivBy1 |
Clock divided by 1.
|
kPIT_PrescalerDivBy2 |
Clock divided by 2.
|
kPIT_PrescalerDivBy4 |
Clock divided by 4.
|
kPIT_PrescalerDivBy8 |
Clock divided by 8.
|
kPIT_PrescalerDivBy16 |
Clock divided by 16.
|
kPIT_PrescalerDivBy32 |
Clock divided by 32.
|
kPIT_PrescalerDivBy64 |
Clock divided by 64.
|
kPIT_PrescalerDivBy128 |
Clock divided by 128.
|
kPIT_PrescalerDivBy256 |
Clock divided by 256.
|
kPIT_PrescalerDivBy512 |
Clock divided by 512.
|
kPIT_PrescalerDivBy1024 |
Clock divided by 1024.
|
kPIT_PrescalerDivBy2048 |
Clock divided by 2048.
|
kPIT_PrescalerDivBy4096 |
Clock divided by 4096.
|
kPIT_PrescalerDivBy8192 |
Clock divided by 8192.
|
kPIT_PrescalerDivBy16384 |
Clock divided by 16384.
|
kPIT_PrescalerDivBy32768 |
Clock divided by 32768.
|
Enumerator |
---|
kPIT_Timer_RollOverFlag |
Timer roll over flag.
|
void PIT_Init |
( |
PIT_Type * |
base, |
|
|
const pit_config_t * |
psConfig |
|
) |
| |
The configurations are:
- Clock source selection for PIT module
- Prescaler configuration to the input clock source
- PIT period interval
- PIT slave mode enable/disable
- Interrupt enable/disable
- PIT timer enable/disable
- Note
- This API should be called at the beginning of the application using the PIT driver and call PIT_StartTimer() API to start PIT timer.
- Parameters
-
base | PIT peripheral base address |
psConfig | Pointer to the user's PIT config structure |
void PIT_Deinit |
( |
PIT_Type * |
base | ) |
|
- Parameters
-
base | PIT peripheral base address |
This function initializes the PIT configuration structure to default values.
* psConfig->bEnableInterrupt = false;
* psConfig->bEnableSlaveMode = false;
* psConfig->bEnableTimer = false;
* psConfig->u16PeriodCount = 0xFFFFU;
*
- Parameters
-
psConfig | Pointer to user's PIT config structure. |
static void PIT_EnableSlaveMode |
( |
PIT_Type * |
base, |
|
|
bool |
bEnable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | PIT peripheral base address |
bEnable | enable/disable slave mode |
static void PIT_SetTimerPeriod |
( |
PIT_Type * |
base, |
|
|
uint16_t |
u16PeriodCount |
|
) |
| |
|
inlinestatic |
Timers begin counting from 0 until it reaches the value set by this function, then it generates an interrupt and counter resumes counting from 0 again.
- Note
- Users can call the utility macros provided in fsl_common.h to convert to ticks.
- Parameters
-
base | PIT peripheral base address |
count | Timer period in units of ticks, use macro definition MSEC_TO_COUNT to convert value in ms to count of ticks, the PIT clock rate is source clock divide prescaler. |
static uint16_t PIT_GetCurrentTimerCount |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
This function returns the real-time timer counting value, in a range from 0 to a timer period.
- Note
- Users can call the utility macros provided in fsl_common.h to convert ticks to usec or msec.
- Parameters
-
base | PIT peripheral base address |
- Returns
- Current timer counting value in ticks, use macro definition COUNT_TO_MSEC to convert value in ticks to count of millisecond, the PIT clock rate is source clock divide prescaler.
static void PIT_StartTimer |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
After calling this function, timers load period value, count down to 0 and then load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and sets the timeout interrupt flag.
- Parameters
-
base | PIT peripheral base address |
static void PIT_StopTimer |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
This function stops timer counting, and the counter remains at or returns to a 0 value.
- Parameters
-
base | PIT peripheral base address |
static void PIT_EnableInterrupt |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | PIT peripheral base address |
static void PIT_DisableInterrupt |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | PIT peripheral base address |
static uint32_t PIT_GetStatusFlags |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | PIT peripheral base address |
- Returns
- The status flags. This is the logical OR of members of the enumeration _pit_status_flags
static void PIT_ClearStatusFlags |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | PIT peripheral base address |