![]() |
MCUXpresso SDK API Reference Manual
Rev 2.13.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, qtmr_channel_selection_t channel, 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_channel_selection_t channel, 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, 2, 1)) |
Version. | |
Initialization and deinitialization | |
void | QTMR_Init (TMR_Type *base, qtmr_channel_selection_t channel, const qtmr_config_t *config) |
Ungates the Quad Timer clock and configures the peripheral for basic operation. More... | |
void | QTMR_Deinit (TMR_Type *base, qtmr_channel_selection_t channel) |
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, qtmr_channel_selection_t channel, uint32_t mask) |
Enables the selected Quad Timer interrupts. More... | |
void | QTMR_DisableInterrupts (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Disables the selected Quad Timer interrupts. More... | |
uint32_t | QTMR_GetEnabledInterrupts (TMR_Type *base, qtmr_channel_selection_t channel) |
Gets the enabled Quad Timer interrupts. More... | |
Status Interface | |
uint32_t | QTMR_GetStatus (TMR_Type *base, qtmr_channel_selection_t channel) |
Gets the Quad Timer status flags. More... | |
void | QTMR_ClearStatusFlags (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Clears the Quad Timer status flags. More... | |
Read and Write the timer period | |
void | QTMR_SetTimerPeriod (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks) |
Sets the timer period in ticks. More... | |
void | QTMR_SetCompareValue (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks) |
Set compare value. More... | |
static void | QTMR_SetLoadValue (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t value) |
Set load value. More... | |
static uint16_t | QTMR_GetCurrentTimerCount (TMR_Type *base, qtmr_channel_selection_t channel) |
Reads the current timer counting value. More... | |
Timer Start and Stop | |
static void | QTMR_StartTimer (TMR_Type *base, qtmr_channel_selection_t channel, qtmr_counting_mode_t clockSource) |
Starts the Quad Timer counter. More... | |
static void | QTMR_StopTimer (TMR_Type *base, qtmr_channel_selection_t channel) |
Stops the Quad Timer counter. More... | |
Enable and Disable the Quad Timer DMA | |
void | QTMR_EnableDma (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Enable the Quad Timer DMA. More... | |
void | QTMR_DisableDma (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask) |
Disable the Quad Timer DMA. More... | |
void | QTMR_SetPwmOutputToIdle (TMR_Type *base, qtmr_channel_selection_t channel, bool idleStatus) |
Set PWM output in idle status (high or low). More... | |
static qtmr_pwm_out_state_t | QTMR_GetPwmOutputStatus (TMR_Type *base, qtmr_channel_selection_t channel) |
Get the channel output status. More... | |
uint8_t | QTMR_GetPwmChannelStatus (TMR_Type *base, qtmr_channel_selection_t channel) |
Get the PWM channel dutycycle value. More... | |
void | QTMR_SetPwmClockMode (TMR_Type *base, qtmr_channel_selection_t channel, qtmr_primary_count_source_t prescaler) |
This function set the value of the prescaler on QTimer channels. 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_pwm_out_state_t |
enum qtmr_output_mode_t |
enum qtmr_debug_action_t |
enum qtmr_status_flags_t |
enum qtmr_dma_enable_t |
void QTMR_Init | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
const qtmr_config_t * | config | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
config | Pointer to user's Quad Timer config structure |
void QTMR_Deinit | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
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, |
qtmr_channel_selection_t | channel, | ||
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 |
channel | Quad Timer channel number |
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_channel_selection_t | channel, | ||
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 |
channel | Quad Timer channel number |
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, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
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, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
base | Quad Timer peripheral base addres |
channel | Quad Timer channel number |
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, |
qtmr_channel_selection_t | channel | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
uint32_t QTMR_GetStatus | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
void QTMR_ClearStatusFlags | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
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, |
qtmr_channel_selection_t | channel, | ||
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 |
channel | Quad Timer channel number |
ticks | Timer period in units of ticks |
void QTMR_SetCompareValue | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint16_t | ticks | ||
) |
This function sets the value used for comparison with the counter value.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
ticks | Timer period in units of ticks. |
|
inlinestatic |
This function sets the value used to initialize the counter after a counter comparison.
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
value | Load register initialization value. |
|
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 |
channel | Quad Timer channel number |
|
inlinestatic |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
clockSource | Quad Timer clock source |
|
inlinestatic |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
void QTMR_EnableDma | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t |
void QTMR_DisableDma | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
uint32_t | mask | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
mask | The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t |
void QTMR_SetPwmOutputToIdle | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
bool | idleStatus | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
idleStatus | True: PWM output is high in idle status; false: PWM output is low in idle status. |
|
inlinestatic |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
uint8_t QTMR_GetPwmChannelStatus | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
void QTMR_SetPwmClockMode | ( | TMR_Type * | base, |
qtmr_channel_selection_t | channel, | ||
qtmr_primary_count_source_t | prescaler | ||
) |
base | Quad Timer peripheral base address |
channel | Quad Timer channel number |
prescaler | Set prescaler value |