MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
QTMR: Quad Timer Driver

Read Guidance

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.

Driver Overview

 QTMR Peripheral and Driver Overview
 Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case.
 
 The Driver Change Log
 The current QTMR driver version is 2.0.0.
 

Data Structures

struct  qtmr_channel_input_config_t
 The structure for configuring Quad Timer channel input signal. More...
 
struct  qtmr_channel_count_config_t
 The structure for configuring Quad Timer channel counting behaviors. More...
 
struct  qtmr_channel_output_config_t
 The structure for configuring Quad Timer channel output signal (OFLAG). More...
 
struct  qtmr_channel_cooperation_config_t
 The structure for configuring Quad Timer channel cooperation mode with other channels. More...
 
struct  qtmr_channel_config_t
 Quad Timer channel configuration covering all channel configurable fields. More...
 
struct  qtmr_input_pin_filter_config_t
 The structure for configuring Quad Timer module input pin filter. More...
 
struct  qtmr_config_t
 Quad Timer module configuration which contain channel config structure pointers and input pin filter config structure pointers. More...
 

Enumerations

enum  qtmr_input_pin_t {
  kQTMR_InputPin0 = 0,
  kQTMR_InputPin1,
  kQTMR_InputPin2,
  kQTMR_InputPin3
}
 The enumeration for Quad Timer module input pin source. More...
 
enum  qtmr_channel_number_t {
  kQTMR_Channel0 = 0U,
  kQTMR_Channel1,
  kQTMR_Channel2,
  kQTMR_Channel3
}
 The enumeration for Quad Timer module channel number. More...
 
enum  qtmr_channel_primary_count_source_t {
  kQTMR_PrimarySrcInputPin0 = 0,
  kQTMR_PrimarySrcInputPin1,
  kQTMR_PrimarySrcInputPin2,
  kQTMR_PrimarySrcInputPin3,
  kQTMR_PrimarySrcChannel0Output,
  kQTMR_PrimarySrcChannel1Output,
  kQTMR_PrimarySrcChannel2Output,
  kQTMR_PrimarySrcChannel3Output,
  kQTMR_PrimarySrcIPBusClockDivide1,
  kQTMR_PrimarySrcIPBusClockDivide2,
  kQTMR_PrimarySrcIPBusClockDivide4,
  kQTMR_PrimarySrcIPBusClockDivide8,
  kQTMR_PrimarySrcIPBusClockDivide16,
  kQTMR_PrimarySrcIPBusClockDivide32,
  kQTMR_PrimarySrcIPBusClockDivide64,
  kQTMR_PrimarySrcIPBusClockDivide128
}
 The enumeration for Quad Timer channel primary input source. More...
 
enum  qtmr_channel_secondary_count_source_t {
  kQTMR_SecondarySrcInputPin0 = 0,
  kQTMR_SecondarySrcInputPin1,
  kQTMR_SecondarySrcInputPin2,
  kQTMR_SecondarySrcInputPin3
}
 The enumeration for Quad Timer channel secondary input source. More...
 
enum  qtmr_channel_secondary_source_capture_mode_t {
  kQTMR_SecondarySrcCaptureNoCapture = 0,
  kQTMR_SecondarySrcCaptureRisingEdge,
  kQTMR_SecondarySrcCaptureFallingEdge,
  kQTMR_SecondarySrcCaptureRisingAndFallingEdge,
  kQTMR_SecondarySrcCaptureRisingEdgeWithReload = 5,
  kQTMR_SecondarySrcCaptureFallingEdgeWithReload,
  kQTMR_SecondarySrcCaptureRisingAndFallingEdgeWithReload
}
 The enumeration for Quad Timer channel secondary input source capture mode. More...
 
enum  qtmr_channel_count_mode_t {
  kQTMR_CountNoOperation = 0,
  kQTMR_CountPrimarySrcRiseEdge,
  kQTMR_CountPrimarySrcRiseAndFallEdge,
  kQTMR_CountPrimarySrcRiseEdgeSecondarySrcInHigh,
  kQTMR_CountPrimarySecondarySrcInQuadDecode,
  kQTMR_CountPrimarySrcRiseEdgeSecondarySrcDir,
  kQTMR_CountPrimarySrcRiseEdgeSecondarySrcRiseEdgeTrig,
  kQTMR_CountCascadeWithOtherChannel
}
 The enumeration for Quad Timer channel count mode. More...
 
enum  qtmr_channel_count_length_t {
  kQTMR_CountLengthUntilRollOver = 0,
  kQTMR_CountLengthUntilCompare
}
 The enumeration for Quad Timer channel count length. More...
 
enum  qtmr_channel_count_direction_t {
  kQTMR_CountDirectionUp = 0,
  kQTMR_CountDirectionDown
}
 The enumeration for Quad Timer channel count direction. More...
 
enum  qtmr_channel_count_times_t {
  kQTMR_CountTimesRepeat = 0,
  kQTMR_CountTimesOnce
}
 The enumeration for Quad Timer channel count times. More...
 
enum  qtmr_channel_count_load_mode_t {
  kQTMR_CountLoadNormal = 0,
  kQTMR_CountLoadAlternative
}
 The enumeration for Quad Timer channel count load mode. More...
 
enum  qtmr_channel_count_preload_mode_t {
  kQTMR_CountPreloadNoLoad = 0,
  kQTMR_CountPreloadOnComp1CompareEvent,
  kQTMR_CountPreloadOnComp2CompareEvent
}
 The enumeration for Quad Timer channel COMP1 & COMP2 preload mode. More...
 
enum  qtmr_channel_output_mode_t {
  kQTMR_OutputAssertWhenCountActive = 0,
  kQTMR_OutputClearOnCompare,
  kQTMR_OutputSetOnCompare,
  kQTMR_OutputToggleOnCompare,
  kQTMR_OutputToggleOnAltCompareReg,
  kQTMR_OutputSetOnComareClearOnSecSrcActiveEdge,
  kQTMR_OutputSetOnCompareClearOnCountRoll,
  kQTMR_OutputGateClockOutWhenCountActive
}
 The enumeration for Quad Timer channel output signal (OFLAG signal) work mode. More...
 
enum  qtmr_channel_output_value_on_force_t {
  kQTMR_OutputValueClearOnForce = 0,
  kQTMR_OutputValueSetOnForce
}
 The enumeration for Quad Timer channel output signal (OFLAG) value on force event occur. More...
 
enum  qtmr_channel_debug_action_t {
  kQTMR_DebugRunNormal = 0U,
  kQTMR_DebugHaltCounter,
  kQTMR_DebugForceOutToZero,
  kQTMR_DebugHaltCountForceOutZero
}
 The enumeration for Quad Timer channel run options when the chip entering debug mode. More...
 
enum  _qtmr_channel_interrupt_enable {
  kQTMR_CompareInterruptEnable = (TMR_SCTRL_TCFIE_MASK),
  kQTMR_Compare1InterruptEnable = (TMR_CSCTRL_TCF1EN_MASK),
  kQTMR_Compare2InterruptEnable = (TMR_CSCTRL_TCF2EN_MASK),
  kQTMR_OverflowInterruptEnable = (TMR_SCTRL_TOFIE_MASK),
  kQTMR_EdgeInterruptEnable = (TMR_SCTRL_IEFIE_MASK)
}
 The enumeration for Quad Timer channel interrupts. More...
 
enum  _qtmr_channel_status_flags {
  kQTMR_CompareFlag = TMR_SCTRL_TCF_MASK,
  kQTMR_Compare1Flag = TMR_CSCTRL_TCF1_MASK,
  kQTMR_Compare2Flag = TMR_CSCTRL_TCF2_MASK,
  kQTMR_OverflowFlag = TMR_SCTRL_TOF_MASK,
  kQTMR_EdgeFlag = TMR_SCTRL_IEF_MASK
}
 The enumeration for Quad Timer channel work status. More...
 
enum  _qtmr_channel_enable {
  kQTMR_Channel0Enable = (1 << 0U),
  kQTMR_Channel1Enable = (1 << 1U),
  kQTMR_Channel2Enable = (1 << 2U),
  kQTMR_Channel3Enable = (1 << 3U)
}
 The enumeration for Quad Timer channel enable. More...
 
enum  _qtmr_channel_dma_enable {
  kQTMR_InputEdgeFlagDmaEnable = (TMR_DMA_IEFDE_MASK),
  kQTMR_Compare1PreloadDmaEnable = (TMR_DMA_CMPLD1DE_MASK),
  kQTMR_Compare2PreloadDmaEnable = (TMR_DMA_CMPLD2DE_MASK)
}
 The enumeration for Quad Timer channel DMA trigger source. More...
 

Driver version

#define FSL_QTMR_DRIVER_VERSION   (MAKE_VERSION(2, 1, 0))
 Version.
 

Initialization and deinitialization Interfaces

void QTMR_Init (TMR_Type *base, const qtmr_config_t *psConfig)
 Initialization Quad Timer module with provided structure. More...
 
void QTMR_Deinit (TMR_Type *base)
 De-initialization Quad Timer module. More...
 
void QTMR_GetChannelDefaultConfig (qtmr_channel_config_t *psConfig)
 Gets an available pre-defined options for Quad Timer channel module's configuration. More...
 
void QTMR_SetupChannleConfig (TMR_Type *base, qtmr_channel_number_t eChannelNumber, const qtmr_channel_config_t *psConfig)
 Setup a Quad Timer channel with provided structure. More...
 

Input signal control related Interfaces

static void QTMR_SetPrimaryCountSource (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_primary_count_source_t ePrimarySource)
 Sets primary input source. More...
 
static void QTMR_SetSecondaryCountSource (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_secondary_count_source_t source)
 Sets secondary input source. More...
 
void QTMR_SetSecondarySourceInputCaptureMode (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_secondary_source_capture_mode_t eCaptureMode)
 Sets secondary input capture mode. More...
 
static void QTMR_EnableSecondarySourceFault (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables secondary input source signal fault feature. More...
 
static void QTMR_EnableInputInvert (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables input pin signal polarity invert feature. More...
 
static void QTMR_SetInputFilter (TMR_Type *base, qtmr_input_pin_t ePin, uint8_t u8Count, uint8_t u8Period)
 Sets input filter for one input pin. More...
 
static uint16_t QTMR_GetInputPinValueInSecondarySource (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Gets the external input signal value selected via the secondary input source. More...
 

Channel count related Interfaces

void QTMR_SetCountMode (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_mode_t eCountMode)
 Sets channel count mode. More...
 
static void QTMR_SetCountLength (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_length_t eLength)
 Sets channel count length. More...
 
static void QTMR_SetCountDirection (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_direction_t eDirection)
 Sets channel count direction. More...
 
static
qtmr_channel_count_direction_t 
QTMR_GetCountDirection (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Gets channel count direction. More...
 
static void QTMR_SetCountTimes (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_times_t eTimes)
 Sets channel count times. More...
 
static void QTMR_SetCountLoadMode (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_load_mode_t eLoadMode)
 Sets channel count load mode. More...
 
static void QTMR_SetCompare1PreloadControl (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_preload_mode_t ePreloadMode)
 Sets channel preload mode for compare register 1. More...
 
static void QTMR_SetCompare2PreloadControl (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_count_preload_mode_t ePreloadMode)
 Sets channel preload mode for compare register 2. More...
 
static void QTMR_SetCompare1PreloadValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Comp1Preload)
 Sets channel compare register 1 preload register value. More...
 
static void QTMR_SetCompare2PreloadValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Comp2Preload)
 Sets channel compare register 2 preload register value. More...
 
static void QTMR_SetLoadValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Load)
 Sets channel load register value. More...
 
static void QTMR_SetCompare1Value (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Comp1)
 Sets channel count compare register 1. More...
 
static void QTMR_SetCompare2Value (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Comp2)
 Sets channel count compare register 2. More...
 
static uint16_t QTMR_ReadCaptureValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Gets channel capture register value. More...
 
static uint16_t QTMR_GetHoldValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Gets channel hold register value. More...
 
static void QTMR_SetCounterValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Count)
 Sets channel counter register value. More...
 
static uint16_t QTMR_GetCounterValue (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Reads channel counter register value. More...
 

Channel output signal (OFLAG) related Interfaces

static void QTMR_SetOutputMode (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_output_mode_t eOutputMode)
 Sets Channel output signal (OFLAG) work mode. More...
 
static void QTMR_SetOutputValueOnForce (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_output_value_on_force_t eValue)
 Sets the value of output signal when a force event occurs. More...
 
static void QTMR_EnableOutputInvert (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables output signal polarity invert feature. More...
 
static void QTMR_EnableSwForceOutput (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Enables software triggers a FORCE command to output signal. More...
 
static void QTMR_EnableOutputPin (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables output signal (OFLAG) drive on the external pin feature. More...
 

Channel cooperation control related Interfaces

static void QTMR_EnableMasterMode (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables channel master mode. More...
 
static void QTMR_EnableMasterForceOFLAG (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables force the channel output signal (OFLAG) state by master channel compare event. More...
 
static void QTMR_EnableMasterReInit (TMR_Type *base, qtmr_channel_number_t eChannelNumber, bool bEnable)
 Enables/Disables channel be re-initialized by master channel compare event feature. More...
 

DMA control Interfaces

static void QTMR_EnableDma (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Mask)
 Enables the Quad Timer DMA request according to a provided mask. More...
 
static void QTMR_DisableDma (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Mask)
 Disables the Quad Timer DMA request according to a provided mask. More...
 

Interrupt control Interfaces

static void QTMR_EnableInterrupts (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Mask)
 Enables the Quad Timer interrupts according to a provided mask. More...
 
static void QTMR_DisableInterrupts (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Mask)
 Disables the Quad Timer interrupts according to a provided mask. More...
 

QTMR channel Status Flag Interfaces

static uint16_t QTMR_GetStatusFlags (TMR_Type *base, qtmr_channel_number_t eChannelNumber)
 Gets the Quad Timer status flags. More...
 
static void QTMR_ClearStatusFlags (TMR_Type *base, qtmr_channel_number_t eChannelNumber, uint16_t u16Mask)
 Clears the Quad Timer status flags. More...
 

QTMR channel debug control Interface

static void QTMR_SetDebugActions (TMR_Type *base, qtmr_channel_number_t eChannelNumber, qtmr_channel_debug_action_t eDebugMode)
 Sets channel debug actions. More...
 

QTMR channels enable/disable control Interfaces

static void QTMR_EnableChannels (TMR_Type *base, uint16_t u16Mask)
 Enables the Quad Timer channels according to a provided mask. More...
 
static void QTMR_DisableChannels (TMR_Type *base, uint16_t u16Mask)
 Disables the Quad Timer channels according to a provided mask. More...
 

Data Structure Documentation

struct qtmr_channel_input_config_t

Data Fields

qtmr_channel_primary_count_source_t ePrimarySource: 4U
 Specify the primary input source. More...
 
qtmr_channel_secondary_count_source_t eSecondarySource: 2U
 Specify the secondary input source. More...
 
bool bEnableSecondarySrcFaultFunction: 1U
 
              true: The selected secondary input acts as a fault signal which can

clear the channel output signal when it is set, false: Fault function disabled. More...

 
bool eEnableInputInvert: 1U
 true: Invert input signal value when select input pin as primary or/and secondary input source false: no operation. More...
 

Field Documentation

qtmr_channel_primary_count_source_t qtmr_channel_input_config_t::ePrimarySource
qtmr_channel_secondary_count_source_t qtmr_channel_input_config_t::eSecondarySource
bool qtmr_channel_input_config_t::bEnableSecondarySrcFaultFunction
bool qtmr_channel_input_config_t::eEnableInputInvert
struct qtmr_channel_count_config_t

Data Fields

qtmr_channel_count_mode_t eCountMode: 4U
 Configures channel count mode. More...
 
qtmr_channel_count_length_t eCountLength: 1U
 Configures channel count length. More...
 
qtmr_channel_count_direction_t eCountDir: 1U
 Configures channel count direction. More...
 
qtmr_channel_count_times_t eCountTimes: 1U
 Configures channel count times. More...
 
qtmr_channel_count_load_mode_t eCountLoadMode: 1U
 Configures channel count load mode. More...
 

Field Documentation

qtmr_channel_count_mode_t qtmr_channel_count_config_t::eCountMode
qtmr_channel_count_length_t qtmr_channel_count_config_t::eCountLength
qtmr_channel_count_direction_t qtmr_channel_count_config_t::eCountDir
qtmr_channel_count_times_t qtmr_channel_count_config_t::eCountTimes
qtmr_channel_count_load_mode_t qtmr_channel_count_config_t::eCountLoadMode
struct qtmr_channel_output_config_t

Data Fields

qtmr_channel_output_mode_t eOutputMode: 3U
 Configures channel output signal work mode. More...
 
qtmr_channel_output_value_on_force_t eOutputValueOnForce: 1U
 The value of output signal when force event occur. More...
 
bool bEnableOutputInvert: 1U
 True: the polarity of output signal will be inverted, false: The output signal is not inverted. More...
 
bool bEnableSwForceOutput: 1U
 True: forces the current value of eOFLAGValueOnForce to output signal. More...
 
bool bEnableOutputPin: 1U
 True: the output signal is driven on the external pin. More...
 

Field Documentation

qtmr_channel_output_mode_t qtmr_channel_output_config_t::eOutputMode
qtmr_channel_output_value_on_force_t qtmr_channel_output_config_t::eOutputValueOnForce
bool qtmr_channel_output_config_t::bEnableOutputInvert
bool qtmr_channel_output_config_t::bEnableSwForceOutput

false: no operation.

bool qtmr_channel_output_config_t::bEnableOutputPin

false: the external pin is configured as an input.

struct qtmr_channel_cooperation_config_t

Data Fields

bool bEnableMasterReInit: 1U
 true: Master channel within the module can re-initialize this channel when it has a compare event, false: no operation. More...
 
bool bEnableMasterForceOFLAG: 1U
 true: Master channel within the module can force this channel OFLAG signal when it has a compare event, false: no operation. More...
 
bool bEnableMasterMode: 1U
 true: This channel is configured as mater channel, it can broadcast compare event to all channels within the module to re-initialize channel and/or force channel output signal, false: no operation. More...
 

Field Documentation

bool qtmr_channel_cooperation_config_t::bEnableMasterReInit
bool qtmr_channel_cooperation_config_t::bEnableMasterForceOFLAG
bool qtmr_channel_cooperation_config_t::bEnableMasterMode
struct qtmr_channel_config_t

Data Fields

qtmr_channel_input_config_t sInputConfig
 Configures channel input signal. More...
 
qtmr_channel_count_config_t sCountConfig
 Configures channel count work mode. More...
 
qtmr_channel_output_config_t sOutputConfig
 Configures channel output signal (OFLAG) work mode. More...
 
qtmr_channel_debug_action_t eDebugMode
 Configures channel operation in chip debug mode. More...
 
uint16_t u16EnabledInterruptMask
 The mask of the interrupts to be enabled, should be the OR'ed of _qtmr_channel_interrupt_enable. More...
 
uint16_t u16EnabledDMAMask
 The mask of the interrupts to be enabled, should be the OR'ed of _qtmr_channel_dma_enable. More...
 
uint16_t u16Comp1
 Value for Channel compare register 1. More...
 
uint16_t u16Comp2
 Value for Channel compare register 2. More...
 
uint16_t u16Comp1Preload
 Value for Channel compare 1 preload register. More...
 
uint16_t u16Comp2Preload
 Value for Channel compare 2 preload register. More...
 
uint16_t u16Load
 Value for Channel load register. More...
 
uint16_t u16Count
 Value for Channel counter value register. More...
 
bool bEnableChannel
 True: enable the channel prescaler (if it is being used) and counter false: disable channel. More...
 

Field Documentation

qtmr_channel_input_config_t qtmr_channel_config_t::sInputConfig
qtmr_channel_count_config_t qtmr_channel_config_t::sCountConfig
qtmr_channel_output_config_t qtmr_channel_config_t::sOutputConfig
qtmr_channel_debug_action_t qtmr_channel_config_t::eDebugMode
uint16_t qtmr_channel_config_t::u16EnabledInterruptMask
uint16_t qtmr_channel_config_t::u16EnabledDMAMask
uint16_t qtmr_channel_config_t::u16Comp1
uint16_t qtmr_channel_config_t::u16Comp2
uint16_t qtmr_channel_config_t::u16Comp1Preload
uint16_t qtmr_channel_config_t::u16Comp2Preload
uint16_t qtmr_channel_config_t::u16Load
uint16_t qtmr_channel_config_t::u16Count
bool qtmr_channel_config_t::bEnableChannel
struct qtmr_input_pin_filter_config_t

Data Fields

uint8_t u8Period
 Value for input filter sample period. More...
 
uint8_t u8Count
 Value for input filter sample count (sample count = count +3). More...
 

Field Documentation

uint8_t qtmr_input_pin_filter_config_t::u8Period
uint8_t qtmr_input_pin_filter_config_t::u8Count
struct qtmr_config_t
Note
Need use channel structure address to init the structure pointers, when the channel or input pin structure pointers is NULL, it will be ignored by QTMR_Init API. This can save stack space when only one or two channels are used.

Enumeration Type Documentation

Enumerator
kQTMR_InputPin0 

Quad Timer input pin 0.

kQTMR_InputPin1 

Quad Timer input pin 1.

kQTMR_InputPin2 

Quad Timer input pin 2.

kQTMR_InputPin3 

Quad Timer input pin 3.

Enumerator
kQTMR_Channel0 

Quad Timer Channel 0.

kQTMR_Channel1 

Quad Timer Channel 1.

kQTMR_Channel2 

Quad Timer Channel 2.

kQTMR_Channel3 

Quad Timer Channel 3.

Enumerator
kQTMR_PrimarySrcInputPin0 

Quad Timer input pin 0.

kQTMR_PrimarySrcInputPin1 

Quad Timer input pin 1.

kQTMR_PrimarySrcInputPin2 

Quad Timer input pin 2.

kQTMR_PrimarySrcInputPin3 

Quad Timer input pin 3.

kQTMR_PrimarySrcChannel0Output 

Quad Timer channel 0 output.

kQTMR_PrimarySrcChannel1Output 

Quad Timer channel 1 output.

kQTMR_PrimarySrcChannel2Output 

Quad Timer channel 2 output.

kQTMR_PrimarySrcChannel3Output 

Quad Timer channel 3 output.

kQTMR_PrimarySrcIPBusClockDivide1 

IP bus clock divide by 1.

kQTMR_PrimarySrcIPBusClockDivide2 

IP bus clock divide by 2.

kQTMR_PrimarySrcIPBusClockDivide4 

IP bus clock divide by 4.

kQTMR_PrimarySrcIPBusClockDivide8 

IP bus clock divide by 8.

kQTMR_PrimarySrcIPBusClockDivide16 

IP bus clock divide by 16.

kQTMR_PrimarySrcIPBusClockDivide32 

IP bus clock divide by 32.

kQTMR_PrimarySrcIPBusClockDivide64 

IP bus clock divide by 64.

kQTMR_PrimarySrcIPBusClockDivide128 

IP bus clock divide by 128.

Enumerator
kQTMR_SecondarySrcInputPin0 

Quad Timer input pin 0.

kQTMR_SecondarySrcInputPin1 

Quad Timer input pin 1.

kQTMR_SecondarySrcInputPin2 

Quad Timer input pin 2.

kQTMR_SecondarySrcInputPin3 

Quad Timer input pin 3.

Enumerator
kQTMR_SecondarySrcCaptureNoCapture 

Secondary source capture is disabled.

kQTMR_SecondarySrcCaptureRisingEdge 

Secondary source capture on rising edge.

kQTMR_SecondarySrcCaptureFallingEdge 

Secondary source capture on falling edge.

kQTMR_SecondarySrcCaptureRisingAndFallingEdge 

Secondary source capture on both edges.

kQTMR_SecondarySrcCaptureRisingEdgeWithReload 

Secondary source capture on rising edge while cause the channel to be reloaded.

kQTMR_SecondarySrcCaptureFallingEdgeWithReload 

Secondary source capture on falling edge while cause the channel to be reloaded.

kQTMR_SecondarySrcCaptureRisingAndFallingEdgeWithReload 

Secondary source capture on both edges while cause the channel to be reloaded.

When "channel output 0~3" or "IP bus clock prescaler" is chosen, active edge is the rising edge. When "input pin 0~3" is chosen, active edge and active level is determined by input invert feature (IPS). Disable input invert feature means active edge is rising edge, active level is high level, enable input invert feature means active edge is falling edge, active level is low level.

Enumerator
kQTMR_CountNoOperation 

No operation.

kQTMR_CountPrimarySrcRiseEdge 

Count active edge of primary input source.

kQTMR_CountPrimarySrcRiseAndFallEdge 

Count rising and falling edges of primary input source.

kQTMR_CountPrimarySrcRiseEdgeSecondarySrcInHigh 

Count active edge of primary input source when secondary input is at a active level.

kQTMR_CountPrimarySecondarySrcInQuadDecode 

Quadrature count mode, uses primary and secondary sources.

kQTMR_CountPrimarySrcRiseEdgeSecondarySrcDir 

Count active edge of primary input source; secondary input source specifies count direction.

kQTMR_CountPrimarySrcRiseEdgeSecondarySrcRiseEdgeTrig 

The active edge of secondary input source triggers count active edge of primary input source, and the channel counter will stop upon receiving a second trigger event while it's still counting from the first trigger event.

kQTMR_CountCascadeWithOtherChannel 

Cascaded count mode, the channel will count as compare events occur in the selected source chennel (use a special high-speed signal path rather than the OFLAG output signal).

The active edge of secondary input source triggers count active edge of primary input source, and the channel

counter will re-initialized upon receiving a second trigger event while it's still counting from the first trigger event.

Enumerator
kQTMR_CountLengthUntilRollOver 

Count until roll over at $FFFF.

kQTMR_CountLengthUntilCompare 

Count until compare.

Enumerator
kQTMR_CountDirectionUp 

Count direction up.

kQTMR_CountDirectionDown 

Count direction down.

Enumerator
kQTMR_CountTimesRepeat 

Count repeatedly.

kQTMR_CountTimesOnce 

Count time once.

Enumerator
kQTMR_CountLoadNormal 

Count can be re-initialized only with the LOAD register when match event occurs.

kQTMR_CountLoadAlternative 

Channel can be re-initialized with the LOAD register when count up and a match with COMP1 occurs, or with CMPLD2 register when count down and a match with COMP2 occurs.

Enumerator
kQTMR_CountPreloadNoLoad 

Not load CMPLDn into COMPn register when compare event occurs.

kQTMR_CountPreloadOnComp1CompareEvent 

Load CMPLDn register into COMPn when occurs a successful comparison of channel counter value and the COMP1 register.

kQTMR_CountPreloadOnComp2CompareEvent 

Load CMPLDn register into COMPn when occurs a successful comparison of channel counter value and the COMP2 register.

Enumerator
kQTMR_OutputAssertWhenCountActive 

OFLAG output assert while counter is active.

kQTMR_OutputClearOnCompare 

OFLAG output clear on successful compare.

kQTMR_OutputSetOnCompare 

OFLAG output set on successful compare.

kQTMR_OutputToggleOnCompare 

OFLAG output toggle on successful compare.

kQTMR_OutputToggleOnAltCompareReg 

OFLAG output toggle using alternating compare registers.

kQTMR_OutputSetOnComareClearOnSecSrcActiveEdge 

OFLAG output set on compare, clear on secondary source input edge.

kQTMR_OutputSetOnCompareClearOnCountRoll 

OFLAG output set on compare, clear on counter rollover.

kQTMR_OutputGateClockOutWhenCountActive 

OFLAG output gated while count is active.

Enumerator
kQTMR_OutputValueClearOnForce 

OFLAG output clear (low) when software triggers a FORCE command or master channel force the OFLAG (EEOF need set).

kQTMR_OutputValueSetOnForce 

OFLAG output set (high) when software triggers a FORCE command or master channel force the OFLAG (EEOF need set).

Enumerator
kQTMR_DebugRunNormal 

Continue with normal operation.

kQTMR_DebugHaltCounter 

Halt counter.

kQTMR_DebugForceOutToZero 

Force output to logic 0.

kQTMR_DebugHaltCountForceOutZero 

Halt counter and force output to logic 0.

Enumerator
kQTMR_CompareInterruptEnable 

Compare interrupt.

kQTMR_Compare1InterruptEnable 

Compare 1 interrupt.

kQTMR_Compare2InterruptEnable 

Compare 2 interrupt.

kQTMR_OverflowInterruptEnable 

Timer overflow interrupt.

kQTMR_EdgeInterruptEnable 

Input edge interrupt.

Enumerator
kQTMR_CompareFlag 

Compare flag.

kQTMR_Compare1Flag 

Compare 1 flag.

kQTMR_Compare2Flag 

Compare 2 flag.

kQTMR_OverflowFlag 

Timer overflow flag.

kQTMR_EdgeFlag 

Input edge flag.

Enumerator
kQTMR_Channel0Enable 

Channel 0 enable.

kQTMR_Channel1Enable 

Channel 1 enable.

kQTMR_Channel2Enable 

Channel 2 enable.

kQTMR_Channel3Enable 

Channel 3 enable.

Enumerator
kQTMR_InputEdgeFlagDmaEnable 

Input edge flag setting will trigger DMA read request for CAPT register.

kQTMR_Compare1PreloadDmaEnable 

Channel load CMPLD1 register into COMP1 will trigger DMA write request for CMPLD1.

kQTMR_Compare2PreloadDmaEnable 

Channel load CMPLD2 register into COMP2 will trigger DMA write request for CMPLD2.

Function Documentation

void QTMR_Init ( TMR_Type *  base,
const qtmr_config_t psConfig 
)

This function can initial one or more channels of the Quad Timer module.

This examples shows how only initial channel 0.

* qtmr_config_t sConfig = {0};
* qtmr_channel_config_t sChannel0Config;
* sConfig.psChannelConfig[0] = &sChannel0Config;
* QTMR_GetChannelDefaultConfig(&sChannel0Config);
* QTMR_Init(QTMR, sConfig);
*
Note
This API should be called at the beginning of the application using the Quad Timer module.
Parameters
baseQuad Timer peripheral base address.
psConfigPointer to user's Quad Timer config structure. See qtmr_config_t.
void QTMR_Deinit ( TMR_Type *  base)
Parameters
baseQuad Timer peripheral base address.
void QTMR_GetChannelDefaultConfig ( qtmr_channel_config_t psConfig)

This function initializes the channel configuration structure with a free run 16bit timer work setting. The default values are:

* psConfig->sInputConfig.ePrimarySource = kQTMR_PrimarySrcIPBusClockDivide2;
* psConfig->sInputConfig.eSecondarySource = kQTMR_SecondarySrcInputPin0;
* psConfig->sInputConfig.eSecondarySourceCaptureMode = kQTMR_SecondarySrcCaptureNoCapture;
* psConfig->sInputConfig.bEnableSecondarySrcFaultFunction = false;
* psConfig->sInputConfig.eEnableInputInvert = false;
* psConfig->sCountConfig.eCountMode = kQTMR_CountPrimarySrcRiseEdge;
* psConfig->sCountConfig.eCountLength = kQTMR_CountLengthUntilRollOver;
* psConfig->sCountConfig.eCountDir = kQTMR_CountDirectionUp;
* psConfig->sCountConfig.eCountTimes = kQTMR_CountTimesRepeat;
* psConfig->sCountConfig.eCountLoadMode = kQTMR_CountLoadNormal;
* psConfig->sCountConfig.eCountPreload1 = kQTMR_CountPreloadNoLoad;
* psConfig->sCountConfig.eCountPreload2 = kQTMR_CountPreloadNoLoad;
* psConfig->sOutputConfig.eOutputMode = kQTMR_OutputAssertWhenCountActive;
* psConfig->sOutputConfig.eOutputValueOnForce = kQTMR_OutputValueClearOnForce;
* psConfig->sOutputConfig.bEnableOutputInvert = false;
* psConfig->sOutputConfig.bEnableSwForceOutput = false;
* psConfig->sOutputConfig.bEnableOutputPin = false;
* psConfig->sCooperationConfig.bEnableMasterReInit = false;
* psConfig->sCooperationConfig.bEnableMasterForceOFLAG = false;
* psConfig->sCooperationConfig.bEnableMasterMode = false;
* psConfig->eDebugMode = kQTMR_DebugRunNormal;
* psConfig->u16EnabledInterruptMask = 0x0U;
* psConfig->u16EnabledDMAMask = 0x0U;
* psConfig->u16Comp1 = 0x0U;
* psConfig->u16Comp2 = 0x0U;
* psConfig->u16Comp1Preload = 0x0U;
* psConfig->u16Comp1Preload = 0x0U;
* psConfig->u16Load = 0x0U;
* psConfig->u16Count = 0x0U;
* psConfig->bEnableChannel = false;
*
Parameters
psConfigPointer to user's Quad Timer channel config structure. See qtmr_channel_config_t.
void QTMR_SetupChannleConfig ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
const qtmr_channel_config_t psConfig 
)
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
psConfigPointer to user's Quad Timer channel config structure. See qtmr_channel_config_t.
static void QTMR_SetPrimaryCountSource ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_primary_count_source_t  ePrimarySource 
)
inlinestatic

This function select the primary input source, it can select from "input pin 0~3", "channel output 0~3" and "IP bus clock prescaler".

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
ePrimarySourceThe primary input source. See qtmr_channel_primary_count_source_t.
static void QTMR_SetSecondaryCountSource ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_secondary_count_source_t  source 
)
inlinestatic

This function select the secondary input source, it can select from "input pin 0~3".

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
sourceThe Secondary input source. See qtmr_secondary_count_source_t.
void QTMR_SetSecondarySourceInputCaptureMode ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_secondary_source_capture_mode_t  eCaptureMode 
)

This function select the capture mode for secondary input, it can select from "disable capture", "capture on rising/falling edge" and "capture on both edges". Need enable capture mode when input edge interrupt is needed.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eCaptureModeThe capture mode of secondary input. See qtmr_channel_secondary_source_capture_mode_t.
static void QTMR_EnableSecondarySourceFault ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

Enable fault feature will make secondary input acts as a fault signal so that the channel output signal (OFLAG) is cleared when the secondary input is set.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Enable secondary source fault feature.
  • false Disable secondary source fault feature.
static void QTMR_EnableInputInvert ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables input pin signal polarity invert feature.

Note
Invert feature only affects "input pin 0~3", and acts on the channel input node, not the input pin, so it only affect current channel and not share by other channel
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Invert input pin signal polarity.
  • false No invert for input pin signal polarity.
static void QTMR_SetInputFilter ( TMR_Type *  base,
qtmr_input_pin_t  ePin,
uint8_t  u8Count,
uint8_t  u8Period 
)
inlinestatic

Sets input filter if the input signal is noisy.

Note
The input filter acts on the input pin directly, so the input filter config will affect all channels that select this input pin as source. Turning on the input filter(setting FILT_PER to a non-zero value) introduces a latency of (((u8Count + 3) x u8Period) + 2) IP bus clock periods.
Parameters
baseQuad Timer peripheral base address.
ePinQuad Timer input pin number. See qtmr_input_pin_t.
u8CountRange is 0~7, represent the number of consecutive samples that must agree prior to the input filter accepting an input transition. Actual consecutive samples numbers is (u8Count + 3).
u8PeriodRepresent the sampling period (in IP bus clock cycles) of the input pin signals. Each input is sampled multiple times at the rate specified by this field. If u8Period is 0, then the input pin filter is bypassed.
static uint16_t QTMR_GetInputPinValueInSecondarySource ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function read the value of the secondary input source, the input pin IPS and filtering have been applied to the read back value.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The state of the current state of the external input pin selected via the secondary count source after application of IPS and filtering.
void QTMR_SetCountMode ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_mode_t  eCountMode 
)

This function select channel basic count mode which trigger by primary input or/and secondary input events.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eCountModeThe mode of operation for the count. See qtmr_counting_mode_t.
static void QTMR_SetCountLength ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_length_t  eLength 
)
inlinestatic

This function select channel single count length from "until roll over" or "until compare". "until roll over" means count until 0xFFFF, "until compare" means count until reach COMP1 (for count up) or COMP2 (for count up) value (unless the output signal is in alternating compare mode, this mode make channel use COMP1 and COMP2 alternately).

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eLengthThe channel count length. See qtmr_channel_count_length_t.
static void QTMR_SetCountDirection ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_direction_t  eDirection 
)
inlinestatic

This function select channel count direction from "count up" or "count down". Under normal count mode, this function decide the count direction directly, when chose "secondary specifies direction" count mode, count direction decide by "the secondary input level" XOR with "the function selection".

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eDirectionThe channel count direction. See qtmr_channel_count_direction_t.
static qtmr_channel_count_direction_t QTMR_GetCountDirection ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function read the channel count direction of the last count during quadrature encoded count mode.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The direction of the last count. Value see qtmr_channel_count_direction_t.
static void QTMR_SetCountTimes ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_times_t  eTimes 
)
inlinestatic

This function select channel count times from "once" or "repeatedly". If select "once" with "until compare", channel will stop when reach COMP1 (for count up) or COMP2 (for count up) (unless the output signal is in alternating compare mode, this mode will make channel reaching COMP1, re-initializes then count reaching COMP2, and then stops).

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eTimesThe channel count times. See qtmr_channel_count_times_t.
static void QTMR_SetCountLoadMode ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_load_mode_t  eLoadMode 
)
inlinestatic

This function select channel count re-initialized load mode from "normal" or "alternative". "normal" means channel counter re-initialized from LOAD register when compare event, "alternative" means channel counter can re-initialized from LOAD (count up) or CMPLD2 (count down) when compare event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eLoadModeThe channel count load mode. See qtmr_channel_count_load_mode_t.
static void QTMR_SetCompare1PreloadControl ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_preload_mode_t  ePreloadMode 
)
inlinestatic

This function select channel preload mode for compare register 1. Default the COMP1 register never preload, when enabled, the COMP1 can preload from CMPLD1 register when COMP1 or COMP2 compare event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
ePreloadModeThe compare register 1 preload mode. See qtmr_channel_count_preload_mode_t.
static void QTMR_SetCompare2PreloadControl ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_count_preload_mode_t  ePreloadMode 
)
inlinestatic

This function select channel preload mode for compare register 2. Default the COMP2 register never preload, when enabled, the COMP2 can preload from CMPLD2 register when COMP1 or COMP2 compare event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
ePreloadModeThe compare register 2 preload mode. See qtmr_channel_count_preload_mode_t.
static void QTMR_SetCompare1PreloadValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Comp1Preload 
)
inlinestatic

This function set the CMPLD1 register value. The COMP1 can preload from CMPLD1 register when preload mode is not "never preload".

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16Comp1PreloadValue for Channel compare register 1 preload register.
static void QTMR_SetCompare2PreloadValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Comp2Preload 
)
inlinestatic

This function set the CMPLD2 register value. The COMP2 can preload from CMPLD2 register when preload mode is not "never preload".

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16Comp2PreloadValue for Channel compare register 2 preload register.
static void QTMR_SetLoadValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Load 
)
inlinestatic

This function set the LOAD register value. The channel will re-initialize the counter value with this register after counter compare or overflow event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16LoadValue used to initialize the counter after counter compare or overflow event.
static void QTMR_SetCompare1Value ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Comp1 
)
inlinestatic

This function set the COMP1 register value. It use to trigger compare event in count up mode or alternating compare mode.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16Comp1Value for Channel compare register 1.
static void QTMR_SetCompare2Value ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Comp2 
)
inlinestatic

This function set the COMP2 register value. It use to trigger compare event in count down mode or alternating compare mode.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
compValue for Channel compare register 2.
static uint16_t QTMR_ReadCaptureValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function read the CAPT register value, which store the real-time channel counter value when input capture event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The value captured from the channel counter.
static uint16_t QTMR_GetHoldValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function read the HOLD register value, which stores the channel counter's values of specific channels whenever any of the four channels within a module is read.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The channel counter value when any read operation occurs.
static void QTMR_SetCounterValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Count 
)
inlinestatic

This function set the CNTR register value, the channel will start counting based on this value.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16CountThe channel counter initialize value.
static uint16_t QTMR_GetCounterValue ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function read the CNTR register value, which stores the channel real-time channel counting value. This read operation will trigger HOLD register update.

Note
User can call the utility macros provided in fsl_common.h to convert ticks to usec or msec.
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The real-time channel counter value.
static void QTMR_SetOutputMode ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_output_mode_t  eOutputMode 
)
inlinestatic

This function select channel output signal (OFLAG) work mode base on different channel event.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eOutputModeThe mode of operation for the OFLAG output signal. See qtmr_channel_output_mode_t.
static void QTMR_SetOutputValueOnForce ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_output_value_on_force_t  eValue 
)
inlinestatic

This function config the value of output signal when a force event occurs. Force events can be a software command or compare event from a master channel.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eValueThe value of output signal when force event occur. See qtmr_channel_output_value_on_force_t.
static void QTMR_EnableOutputInvert ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables the invert feature of output signal (OFLAG).

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Invert output signal polarity.
  • false No invert for output signal polarity.
static void QTMR_EnableSwForceOutput ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function uses a software command to trigger force event, which can force the current value of SCTRL[VAL] bit to be written to the OFLAG output.

Note
This function can be called only if the counter is disabled.
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
static void QTMR_EnableOutputPin ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables output signal (OFLAG) drive on the external pin feature.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true The output signal is driven on the external pin.
  • false The external pin is configured as an input.
static void QTMR_EnableMasterMode ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables channel master mode.

Note
Master channel can broadcast compare event to all channels within the module to re-initialize channel and/or force channel output signal.
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Enables channel master mode.
  • false Disables channel master mode.
static void QTMR_EnableMasterForceOFLAG ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables the compare event from master channel within the same module to force the state of this channel OFLAG output signal.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Enables OFLAG state to be forced by master channel compare event.
  • false Disables OFLAG state to be forced by master channel compare event.
static void QTMR_EnableMasterReInit ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
bool  bEnable 
)
inlinestatic

This function enables/disables the compare event from master channel within the same module to force the re-initialization of this channel.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
bEnableEnable the feature or not.
  • true Enables channel be re-initialized by master channel compare event.
  • false Disables channel be re-initialized by master channel compare event.
static void QTMR_EnableDma ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Mask 
)
inlinestatic

This function enables the Quad Timer DMA request according to a provided mask. The mask is a logical OR of enumerators members. See _qtmr_channel_dma_enable. This examples shows how to enable compare 1 register preload DMA request and compare 2 register preload DMA request.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16MaskThe QTMR DMA requests to enable. Logical OR of _qtmr_channel_dma_enable.
static void QTMR_DisableDma ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Mask 
)
inlinestatic

This function disables the Quad Timer DMA request according to a provided mask. The mask is a logical OR of enumerators members. See _qtmr_channel_dma_enable. This examples shows how to disable compare 1 register preload DMA request and compare 2 register preload DMA request.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16MaskThe QTMR DMA requests to disable. Logical OR of _qtmr_channel_dma_enable.
static void QTMR_EnableInterrupts ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Mask 
)
inlinestatic

This function enables the Quad Timer interrupts according to a provided mask. The mask is a logical OR of enumerators members. See _qtmr_channel_interrupt_enable. This examples shows how to enable compare 1 interrupt and compare 2 interrupt.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16MaskThe QTMR DMA interrupts to enable. Logical OR of _qtmr_channel_interrupt_enable.
static void QTMR_DisableInterrupts ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Mask 
)
inlinestatic

This function disables the Quad Timer interrupts according to a provided mask. The mask is a logical OR of enumerators members. See _qtmr_channel_interrupt_enable. This examples shows how to disable compare 1 interrupt and compare 2 interrupt.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
u16MaskThe QTMR DMA interrupts to disable. Logical OR of _qtmr_channel_interrupt_enable.
static uint16_t QTMR_GetStatusFlags ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber 
)
inlinestatic

This function gets all QTMR channel status flags. The flags are returned as the logical OR value of the enumerators _qtmr_channel_status_flags. To check for a specific status, compare the return value with enumerators in the _qtmr_channel_status_flags. For example, to check whether the compare flag set.

* {
* ...
* }
*
Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
Returns
The QTMR status flags which is the logical OR of the enumerators _qtmr_channel_status_flags.
static void QTMR_ClearStatusFlags ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
uint16_t  u16Mask 
)
inlinestatic

This function clears QTMR channel status flags with a provide mask. The mask is a logical OR of enumerators _qtmr_channel_status_flags. This examples shows how to clear compare 1 flag and compare 2 flag.

Parameters
baseQuad Timer peripheral base address
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t
u16MaskThe QTMR status flags to clear. Logical OR of _qtmr_channel_status_flags
static void QTMR_SetDebugActions ( TMR_Type *  base,
qtmr_channel_number_t  eChannelNumber,
qtmr_channel_debug_action_t  eDebugMode 
)
inlinestatic

This function selects the certain actions which will perform when the chip entering debug mode.

Parameters
baseQuad Timer peripheral base address.
eChannelNumberQuad Timer channel number. See qtmr_channel_number_t.
eDebugModeThe Quad Timer channel actions in response to the chip entering debug mode. See qtmr_channel_debug_action_t.
static void QTMR_EnableChannels ( TMR_Type *  base,
uint16_t  u16Mask 
)
inlinestatic

This function enables the Quad Timer channels according to a provided mask. The mask is a logical OR of enumerators _qtmr_channel_enable. This examples shows how to enable channel 0 and channel 1.

Note
If one channel has effective count mode, it will start its counter as soon as the channel be enabled.
Parameters
baseQuad Timer peripheral base address.
u16MaskThe QTMR channels to enable. Logical OR of _qtmr_channel_enable.
static void QTMR_DisableChannels ( TMR_Type *  base,
uint16_t  u16Mask 
)
inlinestatic

This function disables the Quad Timer channels according to a provided mask. The mask is a logical OR of enumerators _qtmr_channel_enable. This examples shows how to disable channel 0 and channel 1.

Parameters
baseQuad Timer peripheral base address.
u16MaskThe QTMR channels to enable. Logical OR of _qtmr_channel_enable.