This section describes the programming interface of the PIT HAL driver.
static void PIT_HAL_Enable |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
This function enables the PIT timer clock (Note: this function does not un-gate the system clock gating control). It should be called before any other timer related setup.
- Parameters
-
base | Base address for current PIT instance. |
static void PIT_HAL_Disable |
( |
PIT_Type * |
base | ) |
|
|
inlinestatic |
This function disables all PIT timer clocks(Note: it does not affect the SIM clock gating control).
- Parameters
-
base | Base address for current PIT instance. |
static void PIT_HAL_SetTimerRunInDebugCmd |
( |
PIT_Type * |
base, |
|
|
bool |
timerRun |
|
) |
| |
|
inlinestatic |
In debug mode, the timers may or may not be frozen, based on the configuration of this function. This is intended to aid software development, allowing the developer to halt the processor, investigate the current state of the system (for example, the timer values), and continue the operation.
- Parameters
-
base | Base address for current PIT instance. |
timerRun | Timers run or stop in debug mode.
- true: Timers continue to run in debug mode.
- false: Timers stop in debug mode.
|
static void PIT_HAL_StartTimer |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
After calling this function, timers load the start value as specified by the function PIT_HAL_SetTimerPeriodByCount(PIT_Type * base, uint32_t channel, uint32_t count), count down to 0, and load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and sets the time-out interrupt flag.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
static void PIT_HAL_StopTimer |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
This function stops every timer from counting. Timers reload their periods respectively after they call the PIT_HAL_StartTimer the next time.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
static bool PIT_HAL_IsTimerRunning |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
- Returns
- Current timer running status -true: Current timer is running. -false: Current timer has stopped.
static void PIT_HAL_SetTimerPeriodByCount |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel, |
|
|
uint32_t |
count |
|
) |
| |
|
inlinestatic |
Timers begin counting from the value set by this function. The counter period of a running timer can be modified by first stopping the timer, setting a new load value, and starting the timer again. If timers are not restarted, the new value is loaded after the next trigger event.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
count | Timer period in units of count |
static uint32_t PIT_HAL_GetTimerPeriodByCount |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
- Returns
- Timer period in units of count
static uint32_t PIT_HAL_ReadTimerCount |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
This function returns the real-time timer counting value, in a range from 0 to a timer period.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
- Returns
- Current timer counting value
static void PIT_HAL_SetIntCmd |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
If enabled, an interrupt happens when a timeout event occurs (Note: NVIC should be called to enable pit interrupt in system level).
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
enable | Enable or disable interrupt.
- true: Generate interrupt when timer counts to 0.
- false: No interrupt is generated.
|
static bool PIT_HAL_GetIntCmd |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
- Returns
- Status of enabled or disabled interrupt
- true: Interrupt is enabled.
- false: Interrupt is disabled.
static void PIT_HAL_ClearIntFlag |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
This function clears the timer interrupt flag after a timeout event occurs.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
static bool PIT_HAL_IsIntPending |
( |
PIT_Type * |
base, |
|
|
uint32_t |
channel |
|
) |
| |
|
inlinestatic |
Every time the timer counts to 0, this flag is set.
- Parameters
-
base | Base address for current PIT instance. |
channel | Timer channel number |
- Returns
- Current status of the timeout flag
- true: Timeout has occurred.
- false: Timeout has not yet occurred.