MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a driver for the QTMR module of MCUXpresso SDK devices.
Data Structures | |
struct | qtmr_config_t |
Quad Timer config structure. More... | |
Functions | |
status_t | QTMR_SetupPwm (TMR_Type *base, uint32_t pwmFreqHz, uint8_t dutyCyclePercent, bool outputPolarity, uint32_t srcClock_Hz) |
Sets up Quad timer module for PWM signal output. More... | |
void | QTMR_SetupInputCapture (TMR_Type *base, qtmr_input_source_t capturePin, bool inputPolarity, bool reloadOnCapture, qtmr_input_capture_edge_t captureMode) |
Allows the user to count the source clock cycles until a capture event arrives. More... | |
Driver version | |
#define | FSL_QTMR_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
Version 2.0.0. | |
Initialization and deinitialization | |
void | QTMR_Init (TMR_Type *base, const qtmr_config_t *config) |
Ungates the Quad Timer clock and configures the peripheral for basic operation. More... | |
void | QTMR_Deinit (TMR_Type *base) |
Stops the counter and gates the Quad Timer clock. More... | |
void | QTMR_GetDefaultConfig (qtmr_config_t *config) |
Fill in the Quad Timer config struct with the default settings. More... | |
Interrupt Interface | |
void | QTMR_EnableInterrupts (TMR_Type *base, uint32_t mask) |
Enables the selected Quad Timer interrupts. More... | |
void | QTMR_DisableInterrupts (TMR_Type *base, uint32_t mask) |
Disables the selected Quad Timer interrupts. More... | |
uint32_t | QTMR_GetEnabledInterrupts (TMR_Type *base) |
Gets the enabled Quad Timer interrupts. More... | |
Status Interface | |
uint32_t | QTMR_GetStatus (TMR_Type *base) |
Gets the Quad Timer status flags. More... | |
void | QTMR_ClearStatusFlags (TMR_Type *base, uint32_t mask) |
Clears the Quad Timer status flags. More... | |
Read and Write the timer period | |
void | QTMR_SetTimerPeriod (TMR_Type *base, uint16_t ticks) |
Sets the timer period in ticks. More... | |
static uint16_t | QTMR_GetCurrentTimerCount (TMR_Type *base) |
Reads the current timer counting value. More... | |
Timer Start and Stop | |
static void | QTMR_StartTimer (TMR_Type *base, qtmr_counting_mode_t clockSource) |
Starts the Quad Timer counter. More... | |
static void | QTMR_StopTimer (TMR_Type *base) |
Stops the Quad Timer counter. More... | |
struct qtmr_config_t |
This structure holds the configuration settings for the Quad Timer peripheral. To initialize this structure to reasonable defaults, call the QTMR_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Data Fields | |
qtmr_primary_count_source_t | primarySource |
Specify the primary count source. | |
qtmr_input_source_t | secondarySource |
Specify the secondary count source. | |
bool | enableMasterMode |
true: Broadcast compare function output to other counters; false no broadcast | |
bool | enableExternalForce |
true: Compare from another counter force state of OFLAG signal false: OFLAG controlled by local counter | |
uint8_t | faultFilterCount |
Fault filter count. | |
uint8_t | faultFilterPeriod |
Fault filter period;value of 0 will bypass the filter. | |
qtmr_debug_action_t | debugMode |
Operation in Debug mode. | |
enum qtmr_input_source_t |
enum qtmr_counting_mode_t |
enum qtmr_output_mode_t |
enum qtmr_debug_action_t |
enum qtmr_status_flags_t |
void QTMR_Init | ( | TMR_Type * | base, |
const qtmr_config_t * | config | ||
) |
base | Quad Timer peripheral base address |
config | Pointer to user's Quad Timer config structure |
void QTMR_Deinit | ( | TMR_Type * | base | ) |
base | Quad Timer peripheral base address |
void QTMR_GetDefaultConfig | ( | qtmr_config_t * | config | ) |
The default values are:
config | Pointer to user's Quad Timer config structure. |
status_t QTMR_SetupPwm | ( | TMR_Type * | base, |
uint32_t | pwmFreqHz, | ||
uint8_t | dutyCyclePercent, | ||
bool | outputPolarity, | ||
uint32_t | srcClock_Hz | ||
) |
The function initializes the timer module according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements.
base | Quad Timer peripheral base address |
pwmFreqHz | PWM signal frequency in Hz |
dutyCyclePercent | PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle) |
outputPolarity | true: invert polarity of the output signal, false: no inversion |
srcClock_Hz | Main counter clock in Hz. |
void QTMR_SetupInputCapture | ( | TMR_Type * | base, |
qtmr_input_source_t | capturePin, | ||
bool | inputPolarity, | ||
bool | reloadOnCapture, | ||
qtmr_input_capture_edge_t | captureMode | ||
) |
The count is stored in the capture register.
base | Quad Timer peripheral base address |
capturePin | Pin through which we receive the input signal to trigger the capture |
inputPolarity | true: invert polarity of the input signal, false: no inversion |
reloadOnCapture | true: reload the counter when an input capture occurs, false: no reload |
captureMode | Specifies which edge of the input signal triggers a capture |
void QTMR_EnableInterrupts | ( | TMR_Type * | base, |
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t |
void QTMR_DisableInterrupts | ( | TMR_Type * | base, |
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t |
uint32_t QTMR_GetEnabledInterrupts | ( | TMR_Type * | base | ) |
base | Quad Timer peripheral base address |
uint32_t QTMR_GetStatus | ( | TMR_Type * | base | ) |
base | Quad Timer peripheral base address |
void QTMR_ClearStatusFlags | ( | TMR_Type * | base, |
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
mask | The status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t |
void QTMR_SetTimerPeriod | ( | TMR_Type * | base, |
uint16_t | ticks | ||
) |
Timers counts from initial value till it equals the count value set here. The counter will then reinitialize to the value specified in the Load register.
base | Quad Timer peripheral base address |
ticks | Timer period in units of ticks |
|
inlinestatic |
This function returns the real-time timer counting value, in a range from 0 to a timer period.
base | Quad Timer peripheral base address |
|
inlinestatic |
base | Quad Timer peripheral base address |
clockSource | Quad Timer clock source |
|
inlinestatic |
base | Quad Timer peripheral base address |