RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
Qtmr

Data Structures

struct  _qtmr_config
 Quad Timer config structure. More...
 

Macros

#define TMR_CSCTRL_OFLAG_MASK   (0x100UL)
 
#define TMR_CSCTRL_OFLAG_SHIFT   (8UL)
 

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.
 
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.
 

Driver version

enum  _qtmr_primary_count_source {
  kQTMR_ClockCounter0InputPin = 0 , kQTMR_ClockCounter1InputPin , kQTMR_ClockCounter2InputPin , kQTMR_ClockCounter3InputPin ,
  kQTMR_ClockCounter0Output , kQTMR_ClockCounter1Output , kQTMR_ClockCounter2Output , kQTMR_ClockCounter3Output ,
  kQTMR_ClockDivide_1 , kQTMR_ClockDivide_2 , kQTMR_ClockDivide_4 , kQTMR_ClockDivide_8 ,
  kQTMR_ClockDivide_16 , kQTMR_ClockDivide_32 , kQTMR_ClockDivide_64 , kQTMR_ClockDivide_128
}
 Quad Timer primary clock source selection. More...
 
enum  _qtmr_input_source { kQTMR_Counter0InputPin = 0 , kQTMR_Counter1InputPin , kQTMR_Counter2InputPin , kQTMR_Counter3InputPin }
 Quad Timer input sources selection. More...
 
enum  _qtmr_counting_mode {
  kQTMR_NoOperation = 0 , kQTMR_PriSrcRiseEdge , kQTMR_PriSrcRiseAndFallEdge , kQTMR_PriSrcRiseEdgeSecInpHigh ,
  kQTMR_QuadCountMode , kQTMR_PriSrcRiseEdgeSecDir , kQTMR_SecSrcTrigPriCnt , kQTMR_CascadeCount
}
 Quad Timer counting mode selection. More...
 
enum  _qtmr_pwm_out_state { kQTMR_PwmLow = 0 , kQTMR_PwmHigh }
 Quad Timer PWM output state. More...
 
enum  _qtmr_output_mode {
  kQTMR_AssertWhenCountActive = 0 , kQTMR_ClearOnCompare , kQTMR_SetOnCompare , kQTMR_ToggleOnCompare ,
  kQTMR_ToggleOnAltCompareReg , kQTMR_SetOnCompareClearOnSecSrcInp , kQTMR_SetOnCompareClearOnCountRoll , kQTMR_EnableGateClock
}
 Quad Timer output mode selection. More...
 
enum  _qtmr_input_capture_edge { kQTMR_NoCapture = 0 , kQTMR_RisingEdge , kQTMR_FallingEdge , kQTMR_RisingAndFallingEdge }
 Quad Timer input capture edge mode, rising edge, or falling edge. More...
 
enum  _qtmr_preload_control { kQTMR_NoPreload = 0 , kQTMR_LoadOnComp1 , kQTMR_LoadOnComp2 }
 Quad Timer input capture edge mode, rising edge, or falling edge. More...
 
enum  _qtmr_debug_action { kQTMR_RunNormalInDebug = 0U , kQTMR_HaltCounter , kQTMR_ForceOutToZero , kQTMR_HaltCountForceOutZero }
 List of Quad Timer run options when in Debug mode. More...
 
enum  _qtmr_interrupt_enable {
  kQTMR_CompareInterruptEnable = (1U << 0) , kQTMR_Compare1InterruptEnable = (1U << 1) , kQTMR_Compare2InterruptEnable = (1U << 2) , kQTMR_OverflowInterruptEnable = (1U << 3) ,
  kQTMR_EdgeInterruptEnable = (1U << 4)
}
 List of Quad Timer interrupts. More...
 
enum  _qtmr_status_flags {
  kQTMR_CompareFlag = (1U << 0) , kQTMR_Compare1Flag = (1U << 1) , kQTMR_Compare2Flag = (1U << 2) , kQTMR_OverflowFlag = (1U << 3) ,
  kQTMR_EdgeFlag = (1U << 4)
}
 List of Quad Timer flags. More...
 
enum  _qtmr_channel_selection { kQTMR_Channel_0 = 0U , kQTMR_Channel_1 , kQTMR_Channel_2 , kQTMR_Channel_3 }
 List of channel selection. More...
 
enum  _qtmr_dma_enable { kQTMR_InputEdgeFlagDmaEnable = (1U << 0) , kQTMR_ComparatorPreload1DmaEnable = (1U << 1) , kQTMR_ComparatorPreload2DmaEnable = (1U << 2) }
 List of Quad Timer DMA enable. More...
 
typedef enum _qtmr_primary_count_source qtmr_primary_count_source_t
 Quad Timer primary clock source selection.
 
typedef enum _qtmr_input_source qtmr_input_source_t
 Quad Timer input sources selection.
 
typedef enum _qtmr_counting_mode qtmr_counting_mode_t
 Quad Timer counting mode selection.
 
typedef enum _qtmr_pwm_out_state qtmr_pwm_out_state_t
 Quad Timer PWM output state.
 
typedef enum _qtmr_output_mode qtmr_output_mode_t
 Quad Timer output mode selection.
 
typedef enum _qtmr_input_capture_edge qtmr_input_capture_edge_t
 Quad Timer input capture edge mode, rising edge, or falling edge.
 
typedef enum _qtmr_preload_control qtmr_preload_control_t
 Quad Timer input capture edge mode, rising edge, or falling edge.
 
typedef enum _qtmr_debug_action qtmr_debug_action_t
 List of Quad Timer run options when in Debug mode.
 
typedef enum _qtmr_interrupt_enable qtmr_interrupt_enable_t
 List of Quad Timer interrupts.
 
typedef enum _qtmr_status_flags qtmr_status_flags_t
 List of Quad Timer flags.
 
typedef enum _qtmr_channel_selection qtmr_channel_selection_t
 List of channel selection.
 
typedef enum _qtmr_dma_enable qtmr_dma_enable_t
 List of Quad Timer DMA enable.
 
typedef struct _qtmr_config qtmr_config_t
 Quad Timer config structure.
 
#define FSL_QTMR_DRIVER_VERSION   (MAKE_VERSION(2, 2, 1))
 

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.
 
void QTMR_Deinit (TMR_Type *base, qtmr_channel_selection_t channel)
 Stops the counter and gates the Quad Timer clock.
 
void QTMR_GetDefaultConfig (qtmr_config_t *config)
 Fill in the Quad Timer config struct with the default settings.
 

Interrupt Interface

void QTMR_EnableInterrupts (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
 Enables the selected Quad Timer interrupts.
 
void QTMR_DisableInterrupts (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
 Disables the selected Quad Timer interrupts.
 
uint32_t QTMR_GetEnabledInterrupts (TMR_Type *base, qtmr_channel_selection_t channel)
 Gets the enabled Quad Timer interrupts.
 

Status Interface

uint32_t QTMR_GetStatus (TMR_Type *base, qtmr_channel_selection_t channel)
 Gets the Quad Timer status flags.
 
void QTMR_ClearStatusFlags (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
 Clears the Quad Timer status flags.
 

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.
 
void QTMR_SetCompareValue (TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
 Set compare value.
 

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.
 
void QTMR_DisableDma (TMR_Type *base, qtmr_channel_selection_t channel, uint32_t mask)
 Disable the Quad Timer DMA.
 
void QTMR_SetPwmOutputToIdle (TMR_Type *base, qtmr_channel_selection_t channel, bool idleStatus)
 Set PWM output in idle status (high or low).
 
uint8_t QTMR_GetPwmChannelStatus (TMR_Type *base, qtmr_channel_selection_t channel)
 Get the PWM channel dutycycle value.
 
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.
 

Detailed Description

Macro Definition Documentation

◆ FSL_QTMR_DRIVER_VERSION

#define FSL_QTMR_DRIVER_VERSION   (MAKE_VERSION(2, 2, 1))

Version

Typedef Documentation

◆ qtmr_config_t

typedef struct _qtmr_config qtmr_config_t

Quad Timer config structure.

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

Enumeration Type Documentation

◆ _qtmr_channel_selection

List of channel selection.

Enumerator
kQTMR_Channel_0 

TMR Channel 0

kQTMR_Channel_1 

TMR Channel 1

kQTMR_Channel_2 

TMR Channel 2

kQTMR_Channel_3 

TMR Channel 3

◆ _qtmr_counting_mode

Quad Timer counting mode selection.

Enumerator
kQTMR_NoOperation 

No operation

kQTMR_PriSrcRiseEdge 

Count rising edges of primary source

kQTMR_PriSrcRiseAndFallEdge 

Count rising and falling edges of primary source

kQTMR_PriSrcRiseEdgeSecInpHigh 

Count rise edges of pri SRC while sec inp high active

kQTMR_QuadCountMode 

Quadrature count mode, uses pri and sec sources

kQTMR_PriSrcRiseEdgeSecDir 

Count rising edges of pri SRC; sec SRC specifies dir

kQTMR_SecSrcTrigPriCnt 

Edge of sec SRC trigger primary count until compare

kQTMR_CascadeCount 

Cascaded count mode (up/down)

◆ _qtmr_debug_action

List of Quad Timer run options when in Debug mode.

Enumerator
kQTMR_RunNormalInDebug 

Continue with normal operation

kQTMR_HaltCounter 

Halt counter

kQTMR_ForceOutToZero 

Force output to logic 0

kQTMR_HaltCountForceOutZero 

Halt counter and force output to logic 0

◆ _qtmr_dma_enable

List of Quad Timer DMA enable.

Enumerator
kQTMR_InputEdgeFlagDmaEnable 

Input Edge Flag DMA Enable.

kQTMR_ComparatorPreload1DmaEnable 

Comparator Preload Register 1 DMA Enable.

kQTMR_ComparatorPreload2DmaEnable 

Comparator Preload Register 2 DMA Enable.

◆ _qtmr_input_capture_edge

Quad Timer input capture edge mode, rising edge, or falling edge.

Enumerator
kQTMR_NoCapture 

Capture is disabled

kQTMR_RisingEdge 

Capture on rising edge (IPS=0) or falling edge (IPS=1)

kQTMR_FallingEdge 

Capture on falling edge (IPS=0) or rising edge (IPS=1)

kQTMR_RisingAndFallingEdge 

Capture on both edges

◆ _qtmr_input_source

Quad Timer input sources selection.

Enumerator
kQTMR_Counter0InputPin 

Use counter 0 input pin

kQTMR_Counter1InputPin 

Use counter 1 input pin

kQTMR_Counter2InputPin 

Use counter 2 input pin

kQTMR_Counter3InputPin 

Use counter 3 input pin

◆ _qtmr_interrupt_enable

List of Quad Timer interrupts.

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.

◆ _qtmr_output_mode

Quad Timer output mode selection.

Enumerator
kQTMR_AssertWhenCountActive 

Assert OFLAG while counter is active

kQTMR_ClearOnCompare 

Clear OFLAG on successful compare

kQTMR_SetOnCompare 

Set OFLAG on successful compare

kQTMR_ToggleOnCompare 

Toggle OFLAG on successful compare

kQTMR_ToggleOnAltCompareReg 

Toggle OFLAG using alternating compare registers

kQTMR_SetOnCompareClearOnSecSrcInp 

Set OFLAG on compare, clear on sec SRC input edge

kQTMR_SetOnCompareClearOnCountRoll 

Set OFLAG on compare, clear on counter rollover

kQTMR_EnableGateClock 

Enable gated clock output while count is active

◆ _qtmr_preload_control

Quad Timer input capture edge mode, rising edge, or falling edge.

Enumerator
kQTMR_NoPreload 

Never preload

kQTMR_LoadOnComp1 

Load upon successful compare with value in COMP1

kQTMR_LoadOnComp2 

Load upon successful compare with value in COMP2

◆ _qtmr_primary_count_source

Quad Timer primary clock source selection.

Enumerator
kQTMR_ClockCounter0InputPin 

Use counter 0 input pin

kQTMR_ClockCounter1InputPin 

Use counter 1 input pin

kQTMR_ClockCounter2InputPin 

Use counter 2 input pin

kQTMR_ClockCounter3InputPin 

Use counter 3 input pin

kQTMR_ClockCounter0Output 

Use counter 0 output

kQTMR_ClockCounter1Output 

Use counter 1 output

kQTMR_ClockCounter2Output 

Use counter 2 output

kQTMR_ClockCounter3Output 

Use counter 3 output

kQTMR_ClockDivide_1 

IP bus clock divide by 1 prescaler

kQTMR_ClockDivide_2 

IP bus clock divide by 2 prescaler

kQTMR_ClockDivide_4 

IP bus clock divide by 4 prescaler

kQTMR_ClockDivide_8 

IP bus clock divide by 8 prescaler

kQTMR_ClockDivide_16 

IP bus clock divide by 16 prescaler

kQTMR_ClockDivide_32 

IP bus clock divide by 32 prescaler

kQTMR_ClockDivide_64 

IP bus clock divide by 64 prescaler

kQTMR_ClockDivide_128 

IP bus clock divide by 128 prescaler

◆ _qtmr_pwm_out_state

Quad Timer PWM output state.

Enumerator
kQTMR_PwmLow 

The output state of PWM channel is low

kQTMR_PwmHigh 

The output state of PWM channel is low

◆ _qtmr_status_flags

List of Quad Timer flags.

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

Function Documentation

◆ QTMR_ClearStatusFlags()

void QTMR_ClearStatusFlags ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint32_t  mask 
)

Clears the Quad Timer status flags.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
maskThe status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t

brief Clears the Quad Timer status flags.

param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The status flags to clear. This is a logical OR of members of the enumeration qtmr_status_flags_t

◆ QTMR_Deinit()

void QTMR_Deinit ( TMR_Type base,
qtmr_channel_selection_t  channel 
)

Stops the counter and gates the Quad Timer clock.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number

brief Stops the counter and gates the Quad Timer clock

param base Quad Timer peripheral base address param channel Quad Timer channel number

◆ QTMR_DisableDma()

void QTMR_DisableDma ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint32_t  mask 
)

Disable the Quad Timer DMA.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
maskThe DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t

brief Disable the Quad Timer DMA.

param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t

◆ QTMR_DisableInterrupts()

void QTMR_DisableInterrupts ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint32_t  mask 
)

Disables the selected Quad Timer interrupts.

Parameters
baseQuad Timer peripheral base addres
channelQuad Timer channel number
maskThe interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t

brief Disables the selected Quad Timer interrupts

param base Quad Timer peripheral base addres param channel Quad Timer channel number param mask The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t

◆ QTMR_EnableDma()

void QTMR_EnableDma ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint32_t  mask 
)

Enable the Quad Timer DMA.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
maskThe DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t

brief Enable the Quad Timer DMA.

param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The DMA to enable. This is a logical OR of members of the enumeration qtmr_dma_enable_t

◆ QTMR_EnableInterrupts()

void QTMR_EnableInterrupts ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint32_t  mask 
)

Enables the selected Quad Timer interrupts.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
maskThe interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t

brief Enables the selected Quad Timer interrupts

param base Quad Timer peripheral base address param channel Quad Timer channel number param mask The interrupts to enable. This is a logical OR of members of the enumeration qtmr_interrupt_enable_t

◆ QTMR_GetDefaultConfig()

void QTMR_GetDefaultConfig ( qtmr_config_t config)

Fill in the Quad Timer config struct with the default settings.

The default values are:

config->enableExternalForce = false;
config->enableMasterMode = false;
config->faultFilterCount = 0;
config->faultFilterPeriod = 0;
config->primarySource = kQTMR_ClockDivide_2;
config->secondarySource = kQTMR_Counter0InputPin;
@ kQTMR_RunNormalInDebug
Definition: fsl_qtmr.h:119
@ kQTMR_Counter0InputPin
Definition: fsl_qtmr.h:60
@ kQTMR_ClockDivide_2
Definition: fsl_qtmr.h:48
Definition: deflate.c:114
Parameters
configPointer to user's Quad Timer config structure.

brief Fill in the Quad Timer config struct with the default settings

The default values are: code config->debugMode = kQTMR_RunNormalInDebug; config->enableExternalForce = false; config->enableMasterMode = false; config->faultFilterCount = 0; config->faultFilterPeriod = 0; config->primarySource = kQTMR_ClockDivide_2; config->secondarySource = kQTMR_Counter0InputPin; endcode param config Pointer to user's Quad Timer config structure.

◆ QTMR_GetEnabledInterrupts()

uint32_t QTMR_GetEnabledInterrupts ( TMR_Type base,
qtmr_channel_selection_t  channel 
)

Gets the enabled Quad Timer interrupts.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
Returns
The enabled interrupts. This is the logical OR of members of the enumeration qtmr_interrupt_enable_t

brief Gets the enabled Quad Timer interrupts

param base Quad Timer peripheral base address param channel Quad Timer channel number

return The enabled interrupts. This is the logical OR of members of the enumeration qtmr_interrupt_enable_t

◆ QTMR_GetPwmChannelStatus()

uint8_t QTMR_GetPwmChannelStatus ( TMR_Type base,
qtmr_channel_selection_t  channel 
)

Get the PWM channel dutycycle value.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
Returns
Current channel dutycycle value.

brief Get the PWM channel dutycycle value.

param base Quad Timer peripheral base address param channel Quad Timer channel number

return Current channel dutycycle value.

◆ QTMR_GetStatus()

uint32_t QTMR_GetStatus ( TMR_Type base,
qtmr_channel_selection_t  channel 
)

Gets the Quad Timer status flags.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
Returns
The status flags. This is the logical OR of members of the enumeration qtmr_status_flags_t

brief Gets the Quad Timer status flags

param base Quad Timer peripheral base address param channel Quad Timer channel number

return The status flags. This is the logical OR of members of the enumeration qtmr_status_flags_t

◆ QTMR_Init()

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.

Note
This API should be called at the beginning of the application using the Quad Timer driver.
Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
configPointer to user's Quad Timer config structure

brief Ungates the Quad Timer clock and configures the peripheral for basic operation.

note This API should be called at the beginning of the application using the Quad Timer driver.

param base Quad Timer peripheral base address param channel Quad Timer channel number param config Pointer to user's Quad Timer config structure

◆ QTMR_SetCompareValue()

void QTMR_SetCompareValue ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint16_t  ticks 
)

Set compare value.

This function sets the value used for comparison with the counter value.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
ticksTimer period in units of ticks.

brief Set compare value.

This function sets the value used for comparison with the counter value.

param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks.

◆ QTMR_SetPwmClockMode()

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.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
prescalerSet prescaler value

brief This function set the value of the prescaler on QTimer channels.

param base Quad Timer peripheral base address param channel Quad Timer channel number param prescaler Set prescaler value

◆ QTMR_SetPwmOutputToIdle()

void QTMR_SetPwmOutputToIdle ( TMR_Type base,
qtmr_channel_selection_t  channel,
bool  idleStatus 
)

Set PWM output in idle status (high or low).

Note
When the PWM is set again, the counting needs to be restarted.
Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
idleStatusTrue: PWM output is high in idle status; false: PWM output is low in idle status.

brief Set PWM output in idle status (high or low).

Note: When the PWM is set again, the counting needs to be restarted.

param base Quad Timer peripheral base address param channel Quad Timer channel number param idleStatus True: PWM output is high in idle status; false: PWM output is low in idle status.

◆ QTMR_SetTimerPeriod()

void QTMR_SetTimerPeriod ( TMR_Type base,
qtmr_channel_selection_t  channel,
uint16_t  ticks 
)

Sets the timer period in 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.

Note
  1. This function will write the time period in ticks to COMP1 or COMP2 register depending on the count direction
  2. User can call the utility macros provided in fsl_common.h to convert to ticks
  3. This function supports cases, providing only primary source clock without secondary source clock.
Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
ticksTimer period in units of ticks

brief Sets the timer period in 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.

note

  1. This function will write the time period in ticks to COMP1 or COMP2 register depending on the count direction
  2. User can call the utility macros provided in fsl_common.h to convert to ticks
  3. This function supports cases, providing only primary source clock without secondary source clock.
  4. The load register is reset before the counter is reinitialized to the value specified in the load register.

param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks

◆ QTMR_SetupInputCapture()

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.

The count is stored in the capture register.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
capturePinPin through which we receive the input signal to trigger the capture
inputPolaritytrue: invert polarity of the input signal, false: no inversion
reloadOnCapturetrue: reload the counter when an input capture occurs, false: no reload
captureModeSpecifies which edge of the input signal triggers a capture

brief Allows the user to count the source clock cycles until a capture event arrives.

The count is stored in the capture register.

param base Quad Timer peripheral base address param channel Quad Timer channel number param capturePin Pin through which we receive the input signal to trigger the capture param inputPolarity true: invert polarity of the input signal, false: no inversion param reloadOnCapture true: reload the counter when an input capture occurs, false: no reload param captureMode Specifies which edge of the input signal triggers a capture

◆ QTMR_SetupPwm()

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.

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.

Parameters
baseQuad Timer peripheral base address
channelQuad Timer channel number
pwmFreqHzPWM signal frequency in Hz
dutyCyclePercentPWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle)
outputPolaritytrue: invert polarity of the output signal, false: no inversion
srcClock_HzMain counter clock in Hz.
Returns
Returns an error if there was error setting up the signal.

brief Sets up Quad timer module for PWM signal output.

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.

param base Quad Timer peripheral base address param channel Quad Timer channel number param pwmFreqHz PWM signal frequency in Hz param dutyCyclePercent PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle) param outputPolarity true: invert polarity of the output signal, false: no inversion param srcClock_Hz Main counter clock in Hz.

return Returns an error if there was error setting up the signal.