S32 SDK
FTM Common Driver

Detailed Description

FlexTimer Peripheral Common Driver.

Data Structures

struct  ftm_state_t
 FlexTimer state structure of the driver. More...
 
struct  ftm_pwm_sync_t
 FlexTimer Registers sync parameters Please don't use software and hardware trigger simultaneously Implements : ftm_pwm_sync_t_Class. More...
 
struct  ftm_user_config_t
 Configuration structure that the user needs to set. More...
 

Typedefs

typedef void(* ftm_channel_event_callback_t) (void *userData)
 Channel event callback function. More...
 

Enumerations

enum  ftm_config_mode_t {
  FTM_MODE_NOT_INITIALIZED = 0x00U, FTM_MODE_INPUT_CAPTURE = 0x01U, FTM_MODE_OUTPUT_COMPARE = 0x02U, FTM_MODE_EDGE_ALIGNED_PWM = 0x03U,
  FTM_MODE_CEN_ALIGNED_PWM = 0x04U, FTM_MODE_QUADRATURE_DECODER = 0x05U, FTM_MODE_UP_TIMER = 0x06U, FTM_MODE_UP_DOWN_TIMER = 0x07U
}
 FlexTimer operation mode. More...
 
enum  ftm_quad_decode_mode_t { FTM_QUAD_PHASE_ENCODE = 0x00U, FTM_QUAD_COUNT_AND_DIR = 0x01U }
 FlexTimer quadrature decode modes, phase encode or count and direction mode. More...
 
enum  ftm_quad_phase_polarity_t { FTM_QUAD_PHASE_NORMAL = 0x00U, FTM_QUAD_PHASE_INVERT = 0x01U }
 FlexTimer quadrature phase polarities, normal or inverted polarity. More...
 

Functions

static void FTM_DRV_SetClockFilterPs (FTM_Type *const ftmBase, uint8_t filterPrescale)
 Sets the filter Pre-scaler divider. More...
 
static uint8_t FTM_DRV_GetClockFilterPs (const FTM_Type *ftmBase)
 Reads the FTM filter clock divider. More...
 
static uint8_t FTM_DRV_GetClockSource (const FTM_Type *ftmBase)
 Reads the FTM clock source. More...
 
static uint8_t FTM_DRV_GetClockPs (const FTM_Type *ftmBase)
 Reads the FTM clock divider. More...
 
static bool FTM_DRV_IsOverflowIntEnabled (const FTM_Type *ftmBase)
 Reads the bit that controls enabling the FTM timer overflow interrupt. More...
 
static bool FTM_DRV_HasTimerOverflowed (const FTM_Type *ftmBase)
 Returns the FTM peripheral timer overflow interrupt flag. More...
 
static bool FTM_DRV_GetCpwms (const FTM_Type *ftmBase)
 Gets the FTM count direction bit. More...
 
static void FTM_DRV_SetReIntEnabledCmd (FTM_Type *const ftmBase, bool enable)
 Set the FTM reload interrupt enable. More...
 
static bool FTM_DRV_GetReloadFlag (const FTM_Type *ftmBase)
 Get the state whether the FTM counter reached a reload point. More...
 
static void FTM_DRV_ClearReloadFlag (FTM_Type *const ftmBase)
 Clears the reload flag bit. More...
 
static uint16_t FTM_DRV_GetCounter (const FTM_Type *ftmBase)
 Returns the FTM peripheral current counter value. More...
 
static uint16_t FTM_DRV_GetMod (const FTM_Type *ftmBase)
 Returns the FTM peripheral counter modulo value. More...
 
static uint16_t FTM_DRV_GetCounterInitVal (const FTM_Type *ftmBase)
 Returns the FTM peripheral counter initial value. More...
 
static void FTM_DRV_ClearChSC (FTM_Type *const ftmBase, uint8_t channel)
 Clears the content of Channel (n) Status And Control. More...
 
static uint8_t FTM_DRV_GetChnMode (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel mode. More...
 
static uint8_t FTM_DRV_GetChnEdgeLevel (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel edge level. More...
 
static void FTM_DRV_SetChnIcrstCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Configure the feature of FTM counter reset by the selected input capture event. More...
 
static bool FTM_DRV_IsChnIcrst (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the FTM FTM counter is reset. More...
 
static void FTM_DRV_SetChnDmaCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the FTM peripheral timer channel DMA. More...
 
static bool FTM_DRV_IsChnDma (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the FTM peripheral timer channel DMA is enabled. More...
 
static bool FTM_DRV_IsChnIntEnabled (const FTM_Type *ftmBase, uint8_t channel)
 Get FTM channel(n) interrupt enabled or not. More...
 
static bool FTM_DRV_HasChnEventOccurred (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether any event for the FTM peripheral timer channel has occurred. More...
 
static void FTM_DRV_SetTrigModeControlCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the trigger generation on FTM channel outputs. More...
 
static bool FTM_DRV_GetTriggerControled (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the trigger mode is enabled. More...
 
static bool FTM_DRV_GetChInputState (const FTM_Type *ftmBase, uint8_t channel)
 Get the state of channel input. More...
 
static bool FTM_DRV_GetChOutputValue (const FTM_Type *ftmBase, uint8_t channel)
 Get the value of channel output. More...
 
static uint16_t FTM_DRV_GetChnCountVal (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel counter value. More...
 
static bool FTM_DRV_GetChnEventStatus (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel event status. More...
 
static uint32_t FTM_DRV_GetEventStatus (const FTM_Type *ftmBase)
 Gets the FTM peripheral timer status info for all channels. More...
 
static void FTM_DRV_ClearChnEventStatus (FTM_Type *const ftmBase, uint8_t channel)
 Clears the FTM peripheral timer all channel event status. More...
 
static void FTM_DRV_SetChnOutputMask (FTM_Type *const ftmBase, uint8_t channel, bool mask)
 Sets the FTM peripheral timer channel output mask. More...
 
static void FTM_DRV_SetChnOutputInitStateCmd (FTM_Type *const ftmBase, uint8_t channel, bool state)
 Sets the FTM peripheral timer channel output initial state 0 or 1. More...
 
static void FTM_DRV_DisableFaultInt (FTM_Type *const ftmBase)
 Disables the FTM peripheral timer fault interrupt. More...
 
static bool FTM_DRV_IsFaultIntEnabled (const FTM_Type *ftmBase)
 Return true/false whether the Fault interrupt was enabled or not. More...
 
static void FTM_DRV_ClearFaultsIsr (FTM_Type *const ftmBase)
 Clears all fault interrupt flags that are active. More...
 
static void FTM_DRV_SetCaptureTestCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM peripheral timer capture test mode. More...
 
static bool FTM_DRV_IsFtmEnable (const FTM_Type *ftmBase)
 Get status of the FTMEN bit in the FTM_MODE register. More...
 
static void FTM_DRV_SetInitChnOutputCmd (FTM_Type *const ftmBase, bool enable)
 Initializes the channels output. More...
 
static void FTM_DRV_SetCountReinitSyncCmd (FTM_Type *const ftmBase, bool enable)
 Determines if the FTM counter is re-initialized when the selected trigger for synchronization is detected. More...
 
static bool FTM_DRV_GetDualEdgeCaptureBit (const FTM_Type *ftmBase, uint8_t chnlPairNum)
 Enables the FTM peripheral timer dual edge capture mode. More...
 
static bool FTM_DRV_GetDualChnCombineCmd (const FTM_Type *ftmBase, uint8_t chnlPairNum)
 Verify if an channels pair is used in combine mode or not. More...
 
static bool FTM_DRV_IsChnTriggerGenerated (const FTM_Type *ftmBase)
 Checks whether any channel trigger event has occurred. More...
 
static void FTM_DRV_ClearChnTriggerFlag (FTM_Type *const ftmBase)
 Clear the channel trigger flag. More...
 
static bool FTM_DRV_GetDetectedFaultInput (const FTM_Type *ftmBase)
 Gets the FTM detected fault input. More...
 
static bool FTM_DRV_IsWriteProtectionEnabled (const FTM_Type *ftmBase)
 Checks whether the write protection is enabled. More...
 
static bool FTM_DRV_IsFaultInputEnabled (const FTM_Type *ftmBase)
 Checks whether the logic OR of the fault inputs is enabled. More...
 
static bool FTM_DRV_IsFaultFlagDetected (const FTM_Type *ftmBase, uint8_t channel)
 Checks whether a fault condition is detected at the fault input. More...
 
static void FTM_DRV_ClearFaultFlagDetected (FTM_Type *const ftmBase, uint8_t channel)
 Clear a fault condition is detected at the fault input. More...
 
static void FTM_DRV_SetQuadPhaseBFilterCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the phase B input filter. More...
 
static void FTM_DRV_SetQuadPhaseAPolarity (FTM_Type *const ftmBase, ftm_quad_phase_polarity_t mode)
 Selects polarity for the quadrature decode phase A input. More...
 
static void FTM_DRV_SetQuadPhaseBPolarity (FTM_Type *const ftmBase, ftm_quad_phase_polarity_t mode)
 Selects polarity for the quadrature decode phase B input. More...
 
static void FTM_DRV_SetQuadMode (FTM_Type *const ftmBase, ftm_quad_decode_mode_t quadMode)
 Sets the encoding mode used in quadrature decoding mode. More...
 
static bool FTM_DRV_GetQuadDir (const FTM_Type *ftmBase)
 Gets the FTM counter direction in quadrature mode. More...
 
static bool FTM_DRV_GetQuadTimerOverflowDir (const FTM_Type *ftmBase)
 Gets the Timer overflow direction in quadrature mode. More...
 
static void FTM_DRV_SetDualChnInvertCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disables the channel invert for a channel pair. More...
 
static void FTM_DRV_SetChnSoftwareCtrlCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the channel software output control. More...
 
static void FTM_DRV_SetChnSoftwareCtrlVal (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Sets the channel software output control value. More...
 
static void FTM_DRV_SetGlobalLoadCmd (FTM_Type *const ftmBase)
 Set the global load mechanism. More...
 
static void FTM_DRV_SetLoadCmd (FTM_Type *const ftmBase, bool enable)
 Enable the global load. More...
 
static void FTM_DRV_SetHalfCycleCmd (FTM_Type *const ftmBase, bool enable)
 Enable the half cycle reload. More...
 
static void FTM_DRV_SetPwmLoadCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the loading of MOD, CNTIN and CV with values of their write buffer. More...
 
static void FTM_DRV_SetPwmLoadChnSelCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Includes or excludes the channel in the matching process. More...
 
static void FTM_DRV_SetInitTrigOnReloadCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM initialization trigger on Reload Point. More...
 
static void FTM_DRV_SetGlobalTimeBaseOutputCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM global time base signal generation to other FTM's. More...
 
static void FTM_DRV_SetGlobalTimeBaseCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM timer global time base. More...
 
static void FTM_DRV_SetLoadFreq (FTM_Type *const ftmBase, uint8_t val)
 Sets the FTM timer TOF Frequency. More...
 
static void FTM_DRV_SetExtPairDeadtimeValue (FTM_Type *const ftmBase, uint8_t channelPair, uint8_t value)
 Sets the FTM extended dead-time value for the channel pair. More...
 
static void FTM_DRV_SetPairDeadtimePrescale (FTM_Type *const ftmBase, uint8_t channelPair, ftm_deadtime_ps_t divider)
 Sets the FTM dead time divider for the channel pair. More...
 
static void FTM_DRV_SetPairDeadtimeCount (FTM_Type *const ftmBase, uint8_t channelPair, uint8_t count)
 Sets the FTM dead-time value for the channel pair. More...
 
status_t FTM_DRV_Init (uint32_t instance, const ftm_user_config_t *info, ftm_state_t *state)
 Initializes the FTM driver. More...
 
status_t FTM_DRV_Deinit (uint32_t instance)
 Shuts down the FTM driver. More...
 
status_t FTM_DRV_MaskOutputChannels (uint32_t instance, uint32_t channelsMask, bool softwareTrigger)
 This function will mask the output of the channels and at match events will be ignored by the masked channels. More...
 
status_t FTM_DRV_SetInitialCounterValue (uint32_t instance, uint16_t counterValue, bool softwareTrigger)
 This function configure the initial counter value. The counter will get this value after an overflow event. More...
 
status_t FTM_DRV_SetHalfCycleReloadPoint (uint32_t instance, uint16_t reloadPoint, bool softwareTrigger)
 This function configure the value of the counter which will generates an reload point. More...
 
status_t FTM_DRV_SetSoftOutChnValue (uint32_t instance, uint8_t channelsValues, bool softwareTrigger)
 This function will force the output value of a channel to a specific value. Before using this function it's mandatory to mask the match events using FTM_DRV_MaskOutputChannels and to enable software output control using FTM_DRV_SetSoftwareOutputChannelControl. More...
 
status_t FTM_DRV_SetSoftwareOutputChannelControl (uint32_t instance, uint8_t channelsMask, bool softwareTrigger)
 This function will configure which output channel can be software controlled. More...
 
status_t FTM_DRV_SetInvertingControl (uint32_t instance, uint8_t channelsPairMask, bool softwareTrigger)
 This function will configure if the second channel of a pair will be inverted or not. More...
 
status_t FTM_DRV_SetModuloCounterValue (uint32_t instance, uint16_t counterValue, bool softwareTrigger)
 This function configure the maximum counter value. More...
 
status_t FTM_DRV_SetSync (uint32_t instance, const ftm_pwm_sync_t *param)
 This function configures sync mechanism for some FTM registers (MOD, CNINT, HCR, CnV, OUTMASK, INVCTRL, SWOCTRL). More...
 
uint32_t FTM_DRV_GetFrequency (uint32_t instance)
 Retrieves the frequency of the clock source feeding the FTM counter. More...
 
uint16_t FTM_DRV_ConvertFreqToPeriodTicks (uint32_t instance, uint32_t freqencyHz)
 This function is used to covert the given frequency to period in ticks. More...
 

Variables

FTM_Type *const g_ftmBase [FTM_INSTANCE_COUNT]
 Table of base addresses for FTM instances. More...
 
const IRQn_Type g_ftmIrqId [FTM_INSTANCE_COUNT][FEATURE_FTM_CHANNEL_COUNT]
 Interrupt vectors for the FTM peripheral. More...
 
const IRQn_Type g_ftmFaultIrqId [FTM_INSTANCE_COUNT]
 
const IRQn_Type g_ftmOverflowIrqId [FTM_INSTANCE_COUNT]
 
const IRQn_Type g_ftmReloadIrqId [FTM_INSTANCE_COUNT]
 
ftm_state_tftmStatePtr [FTM_INSTANCE_COUNT]
 Pointer to runtime state structure. More...
 

Typedef Documentation

typedef void(* ftm_channel_event_callback_t) (void *userData)

Channel event callback function.

Callback functions are called by the FTM driver in Input Capture mode when an event is detected(change in logical state of a pin or measurement complete)

Definition at line 114 of file ftm_common.h.

Enumeration Type Documentation

FlexTimer operation mode.

Implements : ftm_config_mode_t_Class

Enumerator
FTM_MODE_NOT_INITIALIZED 

The driver is not initialized

FTM_MODE_INPUT_CAPTURE 

Input capture

FTM_MODE_OUTPUT_COMPARE 

Output compare

FTM_MODE_EDGE_ALIGNED_PWM 

Edge aligned PWM

FTM_MODE_CEN_ALIGNED_PWM 

Center aligned PWM

FTM_MODE_QUADRATURE_DECODER 

Quadrature decoder

FTM_MODE_UP_TIMER 

Timer with up counter

FTM_MODE_UP_DOWN_TIMER 

timer with up-down counter

Definition at line 72 of file ftm_common.h.

FlexTimer quadrature decode modes, phase encode or count and direction mode.

Implements : ftm_quad_decode_mode_t_Class

Enumerator
FTM_QUAD_PHASE_ENCODE 

Phase encoding mode

FTM_QUAD_COUNT_AND_DIR 

Counter and direction encoding mode

Definition at line 89 of file ftm_common.h.

FlexTimer quadrature phase polarities, normal or inverted polarity.

Implements : ftm_quad_phase_polarity_t_Class

Enumerator
FTM_QUAD_PHASE_NORMAL 

Phase input signal is not inverted before identifying the rising and falling edges of this signal

FTM_QUAD_PHASE_INVERT 

Phase input signal is inverted before identifying the rising and falling edges of this signal

Definition at line 100 of file ftm_common.h.

Function Documentation

static void FTM_DRV_ClearChnEventStatus ( FTM_Type *const  ftmBase,
uint8_t  channel 
)
inlinestatic

Clears the FTM peripheral timer all channel event status.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number

Implements : FTM_DRV_ClearChnEventStatus_Activity

Definition at line 710 of file ftm_common.h.

static void FTM_DRV_ClearChnTriggerFlag ( FTM_Type *const  ftmBase)
inlinestatic

Clear the channel trigger flag.

Parameters
[in]ftmBaseThe FTM base address pointer

Implements : FTM_DRV_ClearChnTriggerFlag_Activity

Definition at line 945 of file ftm_common.h.

static void FTM_DRV_ClearChSC ( FTM_Type *const  ftmBase,
uint8_t  channel 
)
inlinestatic

Clears the content of Channel (n) Status And Control.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number

Implements : FTM_DRV_ClearChSC_Activity

Definition at line 399 of file ftm_common.h.

static void FTM_DRV_ClearFaultFlagDetected ( FTM_Type *const  ftmBase,
uint8_t  channel 
)
inlinestatic

Clear a fault condition is detected at the fault input.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel

Implements : FTM_DRV_ClearFaultFlagDetected_Activity

Definition at line 1029 of file ftm_common.h.

static void FTM_DRV_ClearFaultsIsr ( FTM_Type *const  ftmBase)
inlinestatic

Clears all fault interrupt flags that are active.

Parameters
[in]ftmBaseThe FTM base address pointer

Implements : FTM_DRV_ClearFaultsIsr_Activity

Definition at line 807 of file ftm_common.h.

static void FTM_DRV_ClearReloadFlag ( FTM_Type *const  ftmBase)
inlinestatic

Clears the reload flag bit.

Parameters
[in]ftmBaseThe FTM base address pointer

Implements : FTM_DRV_ClearReloadFlag_Activity

Definition at line 340 of file ftm_common.h.

uint16_t FTM_DRV_ConvertFreqToPeriodTicks ( uint32_t  instance,
uint32_t  freqencyHz 
)

This function is used to covert the given frequency to period in ticks.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]freqencyHzFrequency value in Hz.
Returns
The value in ticks of the frequency

Definition at line 501 of file ftm_common.c.

status_t FTM_DRV_Deinit ( uint32_t  instance)

Shuts down the FTM driver.

Parameters
[in]instanceThe FTM peripheral instance number.
Returns
operation status
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 181 of file ftm_common.c.

static void FTM_DRV_DisableFaultInt ( FTM_Type *const  ftmBase)
inlinestatic

Disables the FTM peripheral timer fault interrupt.

Parameters
[in]ftmBaseThe FTM base address pointer

Implements : FTM_DRV_DisableFaultInt_Activity

Definition at line 783 of file ftm_common.h.

static bool FTM_DRV_GetChInputState ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Get the state of channel input.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
State of the channel inputs
  • true : The channel input is one
  • false: The channel input is zero

Implements : FTM_DRV_GetChInputState_Activity

Definition at line 623 of file ftm_common.h.

static uint16_t FTM_DRV_GetChnCountVal ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Gets the FTM peripheral timer channel counter value.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
Channel counter value

Implements : FTM_DRV_GetChnCountVal_Activity

Definition at line 660 of file ftm_common.h.

static uint8_t FTM_DRV_GetChnEdgeLevel ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Gets the FTM peripheral timer channel edge level.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
The ELSnB:ELSnA mode value, will be 00, 01, 10, 11

Implements : FTM_DRV_GetChnEdgeLevel_Activity

Definition at line 444 of file ftm_common.h.

static bool FTM_DRV_GetChnEventStatus ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Gets the FTM peripheral timer channel event status.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
Channel event status
  • true : A channel event has occurred
  • false : No channel event has occurred

Implements : FTM_DRV_GetChnEventStatus_Activity

Definition at line 680 of file ftm_common.h.

static uint8_t FTM_DRV_GetChnMode ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Gets the FTM peripheral timer channel mode.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
The MSnB:MSnA mode value, will be 00, 01, 10, 11

Implements : FTM_DRV_GetChnMode_Activity

Definition at line 421 of file ftm_common.h.

static bool FTM_DRV_GetChOutputValue ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Get the value of channel output.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
Value of the channel outputs
  • true : The channel output is one
  • false: The channel output is zero

Implements : FTM_DRV_GetChOutputValue_Activity

Definition at line 642 of file ftm_common.h.

static uint8_t FTM_DRV_GetClockFilterPs ( const FTM_Type ftmBase)
inlinestatic

Reads the FTM filter clock divider.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The FTM filter clock pre-scale divider

Implements : FTM_DRV_GetClockFilterPs_Activity

Definition at line 217 of file ftm_common.h.

static uint8_t FTM_DRV_GetClockPs ( const FTM_Type ftmBase)
inlinestatic

Reads the FTM clock divider.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The FTM clock pre-scale divider

Implements : FTM_DRV_GetClockPs_Activity

Definition at line 249 of file ftm_common.h.

static uint8_t FTM_DRV_GetClockSource ( const FTM_Type ftmBase)
inlinestatic

Reads the FTM clock source.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The FTM clock source selection
  • 00: No clock
  • 01: system clock
  • 10: fixed clock
  • 11: External clock

Implements : FTM_DRV_GetClockSource_Activity

Definition at line 235 of file ftm_common.h.

static uint16_t FTM_DRV_GetCounter ( const FTM_Type ftmBase)
inlinestatic

Returns the FTM peripheral current counter value.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The current FTM timer counter value

Implements : FTM_DRV_GetCounter_Activity

Definition at line 358 of file ftm_common.h.

static uint16_t FTM_DRV_GetCounterInitVal ( const FTM_Type ftmBase)
inlinestatic

Returns the FTM peripheral counter initial value.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
FTM timer counter initial value

Implements : FTM_DRV_GetCounterInitVal_Activity

Definition at line 386 of file ftm_common.h.

static bool FTM_DRV_GetCpwms ( const FTM_Type ftmBase)
inlinestatic

Gets the FTM count direction bit.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The Center-Aligned PWM selection
  • 1U: Up counting mode
  • 0U: Up down counting mode

Implements : FTM_DRV_GetCpwms_Activity

Definition at line 297 of file ftm_common.h.

static bool FTM_DRV_GetDetectedFaultInput ( const FTM_Type ftmBase)
inlinestatic

Gets the FTM detected fault input.

This function reads the status for all fault inputs

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The fault byte
  • 0 : No fault condition was detected.
  • 1 : A fault condition was detected.

Implements : FTM_DRV_GetDetectedFaultInput_Activity

Definition at line 964 of file ftm_common.h.

static bool FTM_DRV_GetDualChnCombineCmd ( const FTM_Type ftmBase,
uint8_t  chnlPairNum 
)
inlinestatic

Verify if an channels pair is used in combine mode or not.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]chnlPairNumThe FTM peripheral channel pair number
Returns
Channel pair output combine mode status
  • true : Channels pair are combined
  • false: Channels pair are independent

Implements : FTM_DRV_GetDualChnCombineCmd_Activity

Definition at line 915 of file ftm_common.h.

static bool FTM_DRV_GetDualEdgeCaptureBit ( const FTM_Type ftmBase,
uint8_t  chnlPairNum 
)
inlinestatic

Enables the FTM peripheral timer dual edge capture mode.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]chnlPairNumThe FTM peripheral channel pair number
Returns
Dual edge capture mode status
  • true : To enable dual edge capture
  • false: To disable

Implements : FTM_DRV_GetDualEdgeCaptureBit_Activity

Definition at line 895 of file ftm_common.h.

static uint32_t FTM_DRV_GetEventStatus ( const FTM_Type ftmBase)
inlinestatic

Gets the FTM peripheral timer status info for all channels.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
Channel event status value

Implements : FTM_DRV_GetEventStatus_Activity

Definition at line 697 of file ftm_common.h.

uint32_t FTM_DRV_GetFrequency ( uint32_t  instance)

Retrieves the frequency of the clock source feeding the FTM counter.

Function will return a 0 if no clock source is selected and the FTM counter is disabled

Parameters
[in]instanceThe FTM peripheral instance number.
Returns
The frequency of the clock source running the FTM counter (0 if counter is disabled)

Definition at line 446 of file ftm_common.c.

static uint16_t FTM_DRV_GetMod ( const FTM_Type ftmBase)
inlinestatic

Returns the FTM peripheral counter modulo value.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
FTM timer modulo value

Implements : FTM_DRV_GetMod_Activity

Definition at line 372 of file ftm_common.h.

static bool FTM_DRV_GetQuadDir ( const FTM_Type ftmBase)
inlinestatic

Gets the FTM counter direction in quadrature mode.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The counting direction
  • 1U: if counting direction is increasing
  • 0U: if counting direction is decreasing

Implements : FTM_DRV_GetQuadDir_Activity

Definition at line 1123 of file ftm_common.h.

static bool FTM_DRV_GetQuadTimerOverflowDir ( const FTM_Type ftmBase)
inlinestatic

Gets the Timer overflow direction in quadrature mode.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
The timer overflow direction
  • 1U: if TOF bit was set on the top of counting
  • 0U: if TOF bit was set on the bottom of counting

Implements : FTM_DRV_GetQuadTimerOverflowDir_Activity

Definition at line 1139 of file ftm_common.h.

static bool FTM_DRV_GetReloadFlag ( const FTM_Type ftmBase)
inlinestatic

Get the state whether the FTM counter reached a reload point.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
State of reload point
  • true : FTM counter reached a reload point
  • false: FTM counter did not reach a reload point

Implements : FTM_DRV_GetReloadFlag_Activity

Definition at line 328 of file ftm_common.h.

static bool FTM_DRV_GetTriggerControled ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Returns whether the trigger mode is enabled.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
State of the channel outputs
  • true : Enabled a trigger generation on channel output
  • false: PWM outputs without generating a pulse

Implements : FTM_DRV_GetTriggerControled_Activity

Definition at line 604 of file ftm_common.h.

static bool FTM_DRV_HasChnEventOccurred ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Returns whether any event for the FTM peripheral timer channel has occurred.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
State of channel flag
  • true : Event occurred
  • false: No event occurred.

Implements : FTM_DRV_HasChnEventOccurred_Activity

Definition at line 564 of file ftm_common.h.

static bool FTM_DRV_HasTimerOverflowed ( const FTM_Type ftmBase)
inlinestatic

Returns the FTM peripheral timer overflow interrupt flag.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
State of Timer Overflow Flag
  • true : FTM counter has overflowed
  • false: FTM counter has not overflowed

Implements : FTM_DRV_HasTimerOverflowed_Activity

Definition at line 281 of file ftm_common.h.

status_t FTM_DRV_Init ( uint32_t  instance,
const ftm_user_config_t info,
ftm_state_t state 
)

Initializes the FTM driver.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]infoThe FTM user configuration structure, see ftm_user_config_t.
[out]stateThe FTM state structure of the driver.
Returns
operation status
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 112 of file ftm_common.c.

static bool FTM_DRV_IsChnDma ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Returns whether the FTM peripheral timer channel DMA is enabled.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
State of the FTM peripheral timer channel DMA
  • true : Enabled DMA transfers
  • false: Disabled DMA transfers

Implements : FTM_DRV_IsChnDma_Activity

Definition at line 529 of file ftm_common.h.

static bool FTM_DRV_IsChnIcrst ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Returns whether the FTM FTM counter is reset.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
Returns
State of the FTM peripheral timer channel ICRST
  • true : Enabled the FTM counter reset
  • false: Disabled the FTM counter reset

Implements : FTM_DRV_IsChnIcrst_Activity

Definition at line 489 of file ftm_common.h.

static bool FTM_DRV_IsChnIntEnabled ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Get FTM channel(n) interrupt enabled or not.

Parameters
[in]ftmBaseFTM module base address
[in]channelThe FTM peripheral channel number

Implements : FTM_DRV_IsChnIntEnabled_Activity

Definition at line 544 of file ftm_common.h.

static bool FTM_DRV_IsChnTriggerGenerated ( const FTM_Type ftmBase)
inlinestatic

Checks whether any channel trigger event has occurred.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
Channel trigger status
  • true : If there is a channel trigger event
  • false: If not.

Implements : FTM_DRV_IsChnTriggerGenerated_Activity

Definition at line 933 of file ftm_common.h.

static bool FTM_DRV_IsFaultFlagDetected ( const FTM_Type ftmBase,
uint8_t  channel 
)
inlinestatic

Checks whether a fault condition is detected at the fault input.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel
Returns
the fault condition status
  • true : A fault condition was detected at the fault input
  • false: No fault condition was detected at the fault input

Implements : FTM_DRV_IsFaultFlagDetected_Activity

Definition at line 1013 of file ftm_common.h.

static bool FTM_DRV_IsFaultInputEnabled ( const FTM_Type ftmBase)
inlinestatic

Checks whether the logic OR of the fault inputs is enabled.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
the enabled fault inputs status
  • true : The logic OR of the enabled fault inputs is 1
  • false: The logic OR of the enabled fault inputs is 0

Implements : FTM_DRV_IsFaultInputEnabled_Activity

Definition at line 996 of file ftm_common.h.

static bool FTM_DRV_IsFaultIntEnabled ( const FTM_Type ftmBase)
inlinestatic

Return true/false whether the Fault interrupt was enabled or not.

Parameters
[in]ftmBaseThe FTM base address pointer

Implements : FTM_DRV_IsFaultIntEnabled_Activity

Definition at line 795 of file ftm_common.h.

static bool FTM_DRV_IsFtmEnable ( const FTM_Type ftmBase)
inlinestatic

Get status of the FTMEN bit in the FTM_MODE register.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
the FTM Enable status
  • true : TPM compatibility. Free running counter and synchronization compatible with TPM
  • false: Free running counter and synchronization are different from TPM behaviour

Implements : FTM_DRV_IsFtmEnable_Activity

Definition at line 845 of file ftm_common.h.

static bool FTM_DRV_IsOverflowIntEnabled ( const FTM_Type ftmBase)
inlinestatic

Reads the bit that controls enabling the FTM timer overflow interrupt.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
State of Timer Overflow Interrupt
  • true : Overflow interrupt is enabled
  • false: Overflow interrupt is disabled

Implements : FTM_DRV_IsOverflowIntEnabled_Activity

Definition at line 265 of file ftm_common.h.

static bool FTM_DRV_IsWriteProtectionEnabled ( const FTM_Type ftmBase)
inlinestatic

Checks whether the write protection is enabled.

Parameters
[in]ftmBaseThe FTM base address pointer
Returns
Write-protection status
  • true : If enabled
  • false: If not

Implements : FTM_DRV_IsWriteProtectionEnabled_Activity

Definition at line 980 of file ftm_common.h.

status_t FTM_DRV_MaskOutputChannels ( uint32_t  instance,
uint32_t  channelsMask,
bool  softwareTrigger 
)

This function will mask the output of the channels and at match events will be ignored by the masked channels.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelsMaskThe mask which will select which channels will ignore match events.
[in]softwareTriggerIf true a software trigger is generate to update PWM parameters.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 201 of file ftm_common.c.

static void FTM_DRV_SetCaptureTestCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the FTM peripheral timer capture test mode.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableCapture Test Mode Enable
  • true : Capture test mode is enabled
  • false: Capture test mode is disabled

Implements : FTM_DRV_SetCaptureTestCmd_Activity

Definition at line 829 of file ftm_common.h.

static void FTM_DRV_SetChnDmaCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Enables or disables the FTM peripheral timer channel DMA.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
[in]enableEnable DMA transfers for the channel
  • true : Enabled DMA transfers
  • false: Disabled DMA transfers

Implements : FTM_DRV_SetChnDmaCmd_Activity

Definition at line 508 of file ftm_common.h.

static void FTM_DRV_SetChnIcrstCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Configure the feature of FTM counter reset by the selected input capture event.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
[in]enableEnable the FTM counter reset
  • true : FTM counter is reset
  • false: FTM counter is not reset

Implements : FTM_DRV_SetChnIcrstCmd_Activity

Definition at line 468 of file ftm_common.h.

static void FTM_DRV_SetChnOutputInitStateCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  state 
)
inlinestatic

Sets the FTM peripheral timer channel output initial state 0 or 1.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
[in]stateInitial state for channels output
  • true : The initialization value is 1
  • false: The initialization value is 0

Implements : FTM_DRV_SetChnOutputInitStateCmd_Activity

Definition at line 760 of file ftm_common.h.

static void FTM_DRV_SetChnOutputMask ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  mask 
)
inlinestatic

Sets the FTM peripheral timer channel output mask.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
[in]maskValue to set Output Mask
  • true : Channel output is masked
  • false: Channel output is not masked

Implements : FTM_DRV_SetChnOutputMask_Activity

Definition at line 733 of file ftm_common.h.

static void FTM_DRV_SetChnSoftwareCtrlCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Enables or disables the channel software output control.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelChannel to be enabled or disabled
[in]enableState of channel software output control
  • true : To enable, channel output will be affected by software output control
  • false: To disable, channel output is unaffected

Implements : FTM_DRV_SetChnSoftwareCtrlCmd_Activity

Definition at line 1182 of file ftm_common.h.

static void FTM_DRV_SetChnSoftwareCtrlVal ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Sets the channel software output control value.

Parameters
[in]ftmBaseThe FTM base address pointer.
[in]channelChannel to be configured
[in]enableState of software output control value
  • true : to force 1 to the channel output
  • false: to force 0 to the channel output

Implements : FTM_DRV_SetChnSoftwareCtrlVal_Activity

Definition at line 1209 of file ftm_common.h.

static void FTM_DRV_SetClockFilterPs ( FTM_Type *const  ftmBase,
uint8_t  filterPrescale 
)
inlinestatic

Sets the filter Pre-scaler divider.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]filterPrescaleThe FTM peripheral clock pre-scale divider

Implements : FTM_DRV_SetClockFilterPs_Activity

Definition at line 202 of file ftm_common.h.

static void FTM_DRV_SetCountReinitSyncCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Determines if the FTM counter is re-initialized when the selected trigger for synchronization is detected.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableFTM counter re-initialization selection
  • true : To update FTM counter when triggered
  • false: To count normally

Implements : FTM_DRV_SetCountReinitSyncCmd_Activity

Definition at line 877 of file ftm_common.h.

static void FTM_DRV_SetDualChnInvertCmd ( FTM_Type *const  ftmBase,
uint8_t  chnlPairNum,
bool  enable 
)
inlinestatic

Enables or disables the channel invert for a channel pair.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]chnlPairNumThe FTM peripheral channel pair number
[in]enableState of channel invert for a channel pair
  • true : To enable channel inverting
  • false: To disable channel inversion

Implements : FTM_DRV_SetDualChnInvertCmd_Activity

Definition at line 1155 of file ftm_common.h.

static void FTM_DRV_SetExtPairDeadtimeValue ( FTM_Type *const  ftmBase,
uint8_t  channelPair,
uint8_t  value 
)
inlinestatic

Sets the FTM extended dead-time value for the channel pair.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelPairThe FTM peripheral channel pair (n)
[in]valueThe FTM peripheral extend pre-scale divider using the concatenation with the dead-time value

Implements : FTM_DRV_SetExtPairDeadtimeValue_Activity

Definition at line 1408 of file ftm_common.h.

static void FTM_DRV_SetGlobalLoadCmd ( FTM_Type *const  ftmBase)
inlinestatic

Set the global load mechanism.

Parameters
[in]ftmBaseThe FTM base address pointer
  • true : LDOK bit is set
  • false: No action

Implements : FTM_DRV_SetGlobalLoadCmd_Activity

Definition at line 1235 of file ftm_common.h.

static void FTM_DRV_SetGlobalTimeBaseCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the FTM timer global time base.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of global time base
  • true : To enable
  • false: To disable

Implements : FTM_DRV_SetGlobalTimeBaseCmd_Activity

Definition at line 1379 of file ftm_common.h.

static void FTM_DRV_SetGlobalTimeBaseOutputCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the FTM global time base signal generation to other FTM's.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of global time base signal
  • true : To enable
  • false: To disable

Implements : FTM_DRV_SetGlobalTimeBaseOutputCmd_Activity

Definition at line 1363 of file ftm_common.h.

static void FTM_DRV_SetHalfCycleCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enable the half cycle reload.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of the half cycle match as a reload opportunity
  • true : Half cycle reload is enabled
  • false: Half cycle reload is disabled

Implements : FTM_DRV_SetHalfCycleCmd_Activity

Definition at line 1273 of file ftm_common.h.

status_t FTM_DRV_SetHalfCycleReloadPoint ( uint32_t  instance,
uint16_t  reloadPoint,
bool  softwareTrigger 
)

This function configure the value of the counter which will generates an reload point.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]reloadPointCounter value which generates the reload point.
[in]softwareTriggerIf true a software trigger is generate to update parameters.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 249 of file ftm_common.c.

static void FTM_DRV_SetInitChnOutputCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Initializes the channels output.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableInitialize the channels output
  • true : The channels output is initialized according to the state of OUTINIT reg
  • false: No effect

Implements : FTM_DRV_SetInitChnOutputCmd_Activity

Definition at line 860 of file ftm_common.h.

status_t FTM_DRV_SetInitialCounterValue ( uint32_t  instance,
uint16_t  counterValue,
bool  softwareTrigger 
)

This function configure the initial counter value. The counter will get this value after an overflow event.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]counterValueInitial counter value.
[in]softwareTriggerIf true a software trigger is generate to update parameters.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 225 of file ftm_common.c.

static void FTM_DRV_SetInitTrigOnReloadCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the FTM initialization trigger on Reload Point.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enablebit controls whether an initialization trigger is generated
  • true : Trigger is generated when a reload point is reached
  • false: Trigger is generated on counter wrap events

Implements : FTM_DRV_SetInitTrigOnReloadCmd_Activity

Definition at line 1347 of file ftm_common.h.

status_t FTM_DRV_SetInvertingControl ( uint32_t  instance,
uint8_t  channelsPairMask,
bool  softwareTrigger 
)

This function will configure if the second channel of a pair will be inverted or not.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelsPairMaskThe mask which will configure which channel pair will invert the second channel.
[in]softwareTriggerIf true a software trigger is generate to update registers.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 321 of file ftm_common.c.

static void FTM_DRV_SetLoadCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enable the global load.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of the global load mechanism
  • true : Global Load OK enabled
  • false: Global Load OK disabled

Implements : FTM_DRV_SetLoadCmd_Activity

Definition at line 1250 of file ftm_common.h.

static void FTM_DRV_SetLoadFreq ( FTM_Type *const  ftmBase,
uint8_t  val 
)
inlinestatic

Sets the FTM timer TOF Frequency.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]valValue of the TOF bit set frequency

Implements : FTM_DRV_SetLoadFreq_Activity

Definition at line 1393 of file ftm_common.h.

status_t FTM_DRV_SetModuloCounterValue ( uint32_t  instance,
uint16_t  counterValue,
bool  softwareTrigger 
)

This function configure the maximum counter value.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]counterValueMaximum counter value
[in]softwareTriggerIf true a software trigger is generate to update parameters
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 344 of file ftm_common.c.

static void FTM_DRV_SetPairDeadtimeCount ( FTM_Type *const  ftmBase,
uint8_t  channelPair,
uint8_t  count 
)
inlinestatic

Sets the FTM dead-time value for the channel pair.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelPairThe FTM peripheral channel pair (n)
[in]countThe FTM peripheral selects the dead-time value
  • 0U : no counts inserted
  • 1U : 1 count is inserted
  • 2U : 2 count is inserted
  • ... up to a possible 63 counts

Implements : FTM_DRV_SetPairDeadtimeCount_Activity

Definition at line 1486 of file ftm_common.h.

static void FTM_DRV_SetPairDeadtimePrescale ( FTM_Type *const  ftmBase,
uint8_t  channelPair,
ftm_deadtime_ps_t  divider 
)
inlinestatic

Sets the FTM dead time divider for the channel pair.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelPairThe FTM peripheral channel pair (n)
[in]dividerThe FTM peripheral pre-scaler divider
  • FTM_DEADTIME_DIVID_BY_1 : Divide by 1
  • FTM_DEADTIME_DIVID_BY_4 : Divide by 4
  • FTM_DEADTIME_DIVID_BY_16: Divide by 16

Implements : FTM_DRV_SetPairDeadtimePrescale_Activity

Definition at line 1447 of file ftm_common.h.

static void FTM_DRV_SetPwmLoadChnSelCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Includes or excludes the channel in the matching process.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelChannel to be configured
[in]enableState of channel
  • true : means include the channel in the matching process
  • false: means do not include channel in the matching process

Implements : FTM_DRV_SetPwmLoadChnSelCmd_Activity

Definition at line 1320 of file ftm_common.h.

static void FTM_DRV_SetPwmLoadCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the loading of MOD, CNTIN and CV with values of their write buffer.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of loading updated values
  • true : To enable
  • false: To disable

Implements : FTM_DRV_SetPwmLoadCmd_Activity

Definition at line 1296 of file ftm_common.h.

static void FTM_DRV_SetQuadMode ( FTM_Type *const  ftmBase,
ftm_quad_decode_mode_t  quadMode 
)
inlinestatic

Sets the encoding mode used in quadrature decoding mode.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]quadModeQuadrature decoder mode selection
  • FTM_QUAD_PHASE_ENCODE: Phase A and Phase B encoding mode
  • FTM_QUAD_COUNT_AND_DIR: Count and direction encoding mode

Implements : FTM_DRV_SetQuadMode_Activity

Definition at line 1106 of file ftm_common.h.

static void FTM_DRV_SetQuadPhaseAPolarity ( FTM_Type *const  ftmBase,
ftm_quad_phase_polarity_t  mode 
)
inlinestatic

Selects polarity for the quadrature decode phase A input.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]modePhase A input polarity selection
  • FTM_QUAD_PHASE_NORMAL: Normal polarity
  • FTM_QUAD_PHASE_INVERT: Inverted polarity

Implements : FTM_DRV_SetQuadPhaseAPolarity_Activity

Definition at line 1074 of file ftm_common.h.

static void FTM_DRV_SetQuadPhaseBFilterCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Enables or disables the phase B input filter.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enableState of phase B input filter
  • true : Enables the phase input filter
  • false: Disables the filter

Implements : FTM_DRV_SetQuadPhaseBFilterCmd_Activity

Definition at line 1051 of file ftm_common.h.

static void FTM_DRV_SetQuadPhaseBPolarity ( FTM_Type *const  ftmBase,
ftm_quad_phase_polarity_t  mode 
)
inlinestatic

Selects polarity for the quadrature decode phase B input.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]modePhase B input polarity selection
  • FTM_QUAD_PHASE_NORMAL: Normal polarity
  • FTM_QUAD_PHASE_INVERT: Inverted polarity

Implements : FTM_DRV_SetQuadPhaseBPolarity_Activity

Definition at line 1090 of file ftm_common.h.

static void FTM_DRV_SetReIntEnabledCmd ( FTM_Type *const  ftmBase,
bool  enable 
)
inlinestatic

Set the FTM reload interrupt enable.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]enable- true : Reload interrupt is enabled
  • false: Reload interrupt is disabled

Implements : FTM_DRV_SetReIntEnabledCmd_Activity

Definition at line 311 of file ftm_common.h.

status_t FTM_DRV_SetSoftOutChnValue ( uint32_t  instance,
uint8_t  channelsValues,
bool  softwareTrigger 
)

This function will force the output value of a channel to a specific value. Before using this function it's mandatory to mask the match events using FTM_DRV_MaskOutputChannels and to enable software output control using FTM_DRV_SetSoftwareOutputChannelControl.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelsValuesThe values which will be software configured for channels.
[in]softwareTriggerIf true a software trigger is generate to update registers
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 275 of file ftm_common.c.

status_t FTM_DRV_SetSoftwareOutputChannelControl ( uint32_t  instance,
uint8_t  channelsMask,
bool  softwareTrigger 
)

This function will configure which output channel can be software controlled.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelsMaskThe mask which will configure the channels which can be software controlled.
[in]softwareTriggerIf true a software trigger is generate to update registers
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 298 of file ftm_common.c.

status_t FTM_DRV_SetSync ( uint32_t  instance,
const ftm_pwm_sync_t param 
)

This function configures sync mechanism for some FTM registers (MOD, CNINT, HCR, CnV, OUTMASK, INVCTRL, SWOCTRL).

Parameters
[in]instanceThe FTM peripheral instance number.
[in]paramThe sync configuration structure.
Returns
operation status
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 370 of file ftm_common.c.

static void FTM_DRV_SetTrigModeControlCmd ( FTM_Type *const  ftmBase,
uint8_t  channel,
bool  enable 
)
inlinestatic

Enables or disables the trigger generation on FTM channel outputs.

Parameters
[in]ftmBaseThe FTM base address pointer
[in]channelThe FTM peripheral channel number
[in]enableTrigger mode control
  • false : Enable PWM output without generating a pulse
  • true : Disable a trigger generation on channel output

Implements : FTM_DRV_SetTrigModeControlCmd_Activity

Definition at line 583 of file ftm_common.h.

Variable Documentation

Pointer to runtime state structure.

Definition at line 83 of file ftm_common.c.

FTM_Type* const g_ftmBase[FTM_INSTANCE_COUNT]

Table of base addresses for FTM instances.

Definition at line 70 of file ftm_common.c.

const IRQn_Type g_ftmFaultIrqId[FTM_INSTANCE_COUNT]

Definition at line 74 of file ftm_common.c.

Interrupt vectors for the FTM peripheral.

Definition at line 73 of file ftm_common.c.

const IRQn_Type g_ftmOverflowIrqId[FTM_INSTANCE_COUNT]

Definition at line 75 of file ftm_common.c.

const IRQn_Type g_ftmReloadIrqId[FTM_INSTANCE_COUNT]

Definition at line 76 of file ftm_common.c.