![]() |
S32 SDK
|
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_t * | ftmStatePtr [FTM_INSTANCE_COUNT] |
Pointer to runtime state structure. More... | |
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.
enum ftm_config_mode_t |
FlexTimer operation mode.
Implements : ftm_config_mode_t_Class
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
Definition at line 100 of file ftm_common.h.
|
inlinestatic |
Clears the FTM peripheral timer all channel event status.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_ClearChnEventStatus_Activity
Definition at line 710 of file ftm_common.h.
|
inlinestatic |
Clear the channel trigger flag.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_ClearChnTriggerFlag_Activity
Definition at line 945 of file ftm_common.h.
|
inlinestatic |
Clears the content of Channel (n) Status And Control.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_ClearChSC_Activity
Definition at line 399 of file ftm_common.h.
|
inlinestatic |
Clear a fault condition is detected at the fault input.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel |
Implements : FTM_DRV_ClearFaultFlagDetected_Activity
Definition at line 1029 of file ftm_common.h.
|
inlinestatic |
Clears all fault interrupt flags that are active.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_ClearFaultsIsr_Activity
Definition at line 807 of file ftm_common.h.
|
inlinestatic |
Clears the reload flag bit.
[in] | ftmBase | The 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.
[in] | instance | The FTM peripheral instance number. |
[in] | freqencyHz | Frequency value in Hz. |
Definition at line 501 of file ftm_common.c.
status_t FTM_DRV_Deinit | ( | uint32_t | instance | ) |
Shuts down the FTM driver.
[in] | instance | The FTM peripheral instance number. |
Definition at line 181 of file ftm_common.c.
|
inlinestatic |
Disables the FTM peripheral timer fault interrupt.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_DisableFaultInt_Activity
Definition at line 783 of file ftm_common.h.
|
inlinestatic |
Get the state of channel input.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChInputState_Activity
Definition at line 623 of file ftm_common.h.
|
inlinestatic |
Gets the FTM peripheral timer channel counter value.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChnCountVal_Activity
Definition at line 660 of file ftm_common.h.
|
inlinestatic |
Gets the FTM peripheral timer channel edge level.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChnEdgeLevel_Activity
Definition at line 444 of file ftm_common.h.
|
inlinestatic |
Gets the FTM peripheral timer channel event status.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChnEventStatus_Activity
Definition at line 680 of file ftm_common.h.
|
inlinestatic |
Gets the FTM peripheral timer channel mode.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChnMode_Activity
Definition at line 421 of file ftm_common.h.
|
inlinestatic |
Get the value of channel output.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetChOutputValue_Activity
Definition at line 642 of file ftm_common.h.
|
inlinestatic |
Reads the FTM filter clock divider.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetClockFilterPs_Activity
Definition at line 217 of file ftm_common.h.
|
inlinestatic |
Reads the FTM clock divider.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetClockPs_Activity
Definition at line 249 of file ftm_common.h.
|
inlinestatic |
Reads the FTM clock source.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetClockSource_Activity
Definition at line 235 of file ftm_common.h.
|
inlinestatic |
Returns the FTM peripheral current counter value.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetCounter_Activity
Definition at line 358 of file ftm_common.h.
|
inlinestatic |
Returns the FTM peripheral counter initial value.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetCounterInitVal_Activity
Definition at line 386 of file ftm_common.h.
|
inlinestatic |
Gets the FTM count direction bit.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetCpwms_Activity
Definition at line 297 of file ftm_common.h.
|
inlinestatic |
Gets the FTM detected fault input.
This function reads the status for all fault inputs
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetDetectedFaultInput_Activity
Definition at line 964 of file ftm_common.h.
|
inlinestatic |
Verify if an channels pair is used in combine mode or not.
[in] | ftmBase | The FTM base address pointer |
[in] | chnlPairNum | The FTM peripheral channel pair number |
Implements : FTM_DRV_GetDualChnCombineCmd_Activity
Definition at line 915 of file ftm_common.h.
|
inlinestatic |
Enables the FTM peripheral timer dual edge capture mode.
[in] | ftmBase | The FTM base address pointer |
[in] | chnlPairNum | The FTM peripheral channel pair number |
Implements : FTM_DRV_GetDualEdgeCaptureBit_Activity
Definition at line 895 of file ftm_common.h.
|
inlinestatic |
Gets the FTM peripheral timer status info for all channels.
[in] | ftmBase | The FTM base address pointer |
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
[in] | instance | The FTM peripheral instance number. |
Definition at line 446 of file ftm_common.c.
|
inlinestatic |
Returns the FTM peripheral counter modulo value.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetMod_Activity
Definition at line 372 of file ftm_common.h.
|
inlinestatic |
Gets the FTM counter direction in quadrature mode.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetQuadDir_Activity
Definition at line 1123 of file ftm_common.h.
|
inlinestatic |
Gets the Timer overflow direction in quadrature mode.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetQuadTimerOverflowDir_Activity
Definition at line 1139 of file ftm_common.h.
|
inlinestatic |
Get the state whether the FTM counter reached a reload point.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_GetReloadFlag_Activity
Definition at line 328 of file ftm_common.h.
|
inlinestatic |
Returns whether the trigger mode is enabled.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_GetTriggerControled_Activity
Definition at line 604 of file ftm_common.h.
|
inlinestatic |
Returns whether any event for the FTM peripheral timer channel has occurred.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_HasChnEventOccurred_Activity
Definition at line 564 of file ftm_common.h.
|
inlinestatic |
Returns the FTM peripheral timer overflow interrupt flag.
[in] | ftmBase | The FTM base address pointer |
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.
[in] | instance | The FTM peripheral instance number. |
[in] | info | The FTM user configuration structure, see ftm_user_config_t. |
[out] | state | The FTM state structure of the driver. |
Definition at line 112 of file ftm_common.c.
|
inlinestatic |
Returns whether the FTM peripheral timer channel DMA is enabled.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_IsChnDma_Activity
Definition at line 529 of file ftm_common.h.
|
inlinestatic |
Returns whether the FTM FTM counter is reset.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_IsChnIcrst_Activity
Definition at line 489 of file ftm_common.h.
|
inlinestatic |
Get FTM channel(n) interrupt enabled or not.
[in] | ftmBase | FTM module base address |
[in] | channel | The FTM peripheral channel number |
Implements : FTM_DRV_IsChnIntEnabled_Activity
Definition at line 544 of file ftm_common.h.
|
inlinestatic |
Checks whether any channel trigger event has occurred.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_IsChnTriggerGenerated_Activity
Definition at line 933 of file ftm_common.h.
|
inlinestatic |
Checks whether a fault condition is detected at the fault input.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel |
Implements : FTM_DRV_IsFaultFlagDetected_Activity
Definition at line 1013 of file ftm_common.h.
|
inlinestatic |
Checks whether the logic OR of the fault inputs is enabled.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_IsFaultInputEnabled_Activity
Definition at line 996 of file ftm_common.h.
|
inlinestatic |
Return true/false whether the Fault interrupt was enabled or not.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_IsFaultIntEnabled_Activity
Definition at line 795 of file ftm_common.h.
|
inlinestatic |
Get status of the FTMEN bit in the FTM_MODE register.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_IsFtmEnable_Activity
Definition at line 845 of file ftm_common.h.
|
inlinestatic |
Reads the bit that controls enabling the FTM timer overflow interrupt.
[in] | ftmBase | The FTM base address pointer |
Implements : FTM_DRV_IsOverflowIntEnabled_Activity
Definition at line 265 of file ftm_common.h.
|
inlinestatic |
Checks whether the write protection is enabled.
[in] | ftmBase | The FTM base address pointer |
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.
[in] | instance | The FTM peripheral instance number. |
[in] | channelsMask | The mask which will select which channels will ignore match events. |
[in] | softwareTrigger | If true a software trigger is generate to update PWM parameters. |
Definition at line 201 of file ftm_common.c.
|
inlinestatic |
Enables or disables the FTM peripheral timer capture test mode.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | Capture Test Mode Enable
|
Implements : FTM_DRV_SetCaptureTestCmd_Activity
Definition at line 829 of file ftm_common.h.
|
inlinestatic |
Enables or disables the FTM peripheral timer channel DMA.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
[in] | enable | Enable DMA transfers for the channel
|
Implements : FTM_DRV_SetChnDmaCmd_Activity
Definition at line 508 of file ftm_common.h.
|
inlinestatic |
Configure the feature of FTM counter reset by the selected input capture event.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
[in] | enable | Enable the FTM counter reset
|
Implements : FTM_DRV_SetChnIcrstCmd_Activity
Definition at line 468 of file ftm_common.h.
|
inlinestatic |
Sets the FTM peripheral timer channel output initial state 0 or 1.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
[in] | state | Initial state for channels output
|
Implements : FTM_DRV_SetChnOutputInitStateCmd_Activity
Definition at line 760 of file ftm_common.h.
|
inlinestatic |
Sets the FTM peripheral timer channel output mask.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
[in] | mask | Value to set Output Mask
|
Implements : FTM_DRV_SetChnOutputMask_Activity
Definition at line 733 of file ftm_common.h.
|
inlinestatic |
Enables or disables the channel software output control.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | Channel to be enabled or disabled |
[in] | enable | State of channel software output control
|
Implements : FTM_DRV_SetChnSoftwareCtrlCmd_Activity
Definition at line 1182 of file ftm_common.h.
|
inlinestatic |
Sets the channel software output control value.
[in] | ftmBase | The FTM base address pointer. |
[in] | channel | Channel to be configured |
[in] | enable | State of software output control value
|
Implements : FTM_DRV_SetChnSoftwareCtrlVal_Activity
Definition at line 1209 of file ftm_common.h.
|
inlinestatic |
Sets the filter Pre-scaler divider.
[in] | ftmBase | The FTM base address pointer |
[in] | filterPrescale | The FTM peripheral clock pre-scale divider |
Implements : FTM_DRV_SetClockFilterPs_Activity
Definition at line 202 of file ftm_common.h.
|
inlinestatic |
Determines if the FTM counter is re-initialized when the selected trigger for synchronization is detected.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | FTM counter re-initialization selection
|
Implements : FTM_DRV_SetCountReinitSyncCmd_Activity
Definition at line 877 of file ftm_common.h.
|
inlinestatic |
Enables or disables the channel invert for a channel pair.
[in] | ftmBase | The FTM base address pointer |
[in] | chnlPairNum | The FTM peripheral channel pair number |
[in] | enable | State of channel invert for a channel pair
|
Implements : FTM_DRV_SetDualChnInvertCmd_Activity
Definition at line 1155 of file ftm_common.h.
|
inlinestatic |
Sets the FTM extended dead-time value for the channel pair.
[in] | ftmBase | The FTM base address pointer |
[in] | channelPair | The FTM peripheral channel pair (n) |
[in] | value | The 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.
|
inlinestatic |
Set the global load mechanism.
[in] | ftmBase | The FTM base address pointer
|
Implements : FTM_DRV_SetGlobalLoadCmd_Activity
Definition at line 1235 of file ftm_common.h.
|
inlinestatic |
Enables or disables the FTM timer global time base.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of global time base
|
Implements : FTM_DRV_SetGlobalTimeBaseCmd_Activity
Definition at line 1379 of file ftm_common.h.
|
inlinestatic |
Enables or disables the FTM global time base signal generation to other FTM's.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of global time base signal
|
Implements : FTM_DRV_SetGlobalTimeBaseOutputCmd_Activity
Definition at line 1363 of file ftm_common.h.
|
inlinestatic |
Enable the half cycle reload.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of the half cycle match as a reload opportunity
|
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.
[in] | instance | The FTM peripheral instance number. |
[in] | reloadPoint | Counter value which generates the reload point. |
[in] | softwareTrigger | If true a software trigger is generate to update parameters. |
Definition at line 249 of file ftm_common.c.
|
inlinestatic |
Initializes the channels output.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | Initialize the channels output
|
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.
[in] | instance | The FTM peripheral instance number. |
[in] | counterValue | Initial counter value. |
[in] | softwareTrigger | If true a software trigger is generate to update parameters. |
Definition at line 225 of file ftm_common.c.
|
inlinestatic |
Enables or disables the FTM initialization trigger on Reload Point.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | bit controls whether an initialization trigger is generated
|
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.
[in] | instance | The FTM peripheral instance number. |
[in] | channelsPairMask | The mask which will configure which channel pair will invert the second channel. |
[in] | softwareTrigger | If true a software trigger is generate to update registers. |
Definition at line 321 of file ftm_common.c.
|
inlinestatic |
Enable the global load.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of the global load mechanism
|
Implements : FTM_DRV_SetLoadCmd_Activity
Definition at line 1250 of file ftm_common.h.
|
inlinestatic |
Sets the FTM timer TOF Frequency.
[in] | ftmBase | The FTM base address pointer |
[in] | val | Value 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.
[in] | instance | The FTM peripheral instance number. |
[in] | counterValue | Maximum counter value |
[in] | softwareTrigger | If true a software trigger is generate to update parameters |
Definition at line 344 of file ftm_common.c.
|
inlinestatic |
Sets the FTM dead-time value for the channel pair.
[in] | ftmBase | The FTM base address pointer |
[in] | channelPair | The FTM peripheral channel pair (n) |
[in] | count | The FTM peripheral selects the dead-time value
|
Implements : FTM_DRV_SetPairDeadtimeCount_Activity
Definition at line 1486 of file ftm_common.h.
|
inlinestatic |
Sets the FTM dead time divider for the channel pair.
[in] | ftmBase | The FTM base address pointer |
[in] | channelPair | The FTM peripheral channel pair (n) |
[in] | divider | The FTM peripheral pre-scaler divider
|
Implements : FTM_DRV_SetPairDeadtimePrescale_Activity
Definition at line 1447 of file ftm_common.h.
|
inlinestatic |
Includes or excludes the channel in the matching process.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | Channel to be configured |
[in] | enable | State of channel
|
Implements : FTM_DRV_SetPwmLoadChnSelCmd_Activity
Definition at line 1320 of file ftm_common.h.
|
inlinestatic |
Enables or disables the loading of MOD, CNTIN and CV with values of their write buffer.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of loading updated values
|
Implements : FTM_DRV_SetPwmLoadCmd_Activity
Definition at line 1296 of file ftm_common.h.
|
inlinestatic |
Sets the encoding mode used in quadrature decoding mode.
[in] | ftmBase | The FTM base address pointer |
[in] | quadMode | Quadrature decoder mode selection
|
Implements : FTM_DRV_SetQuadMode_Activity
Definition at line 1106 of file ftm_common.h.
|
inlinestatic |
Selects polarity for the quadrature decode phase A input.
[in] | ftmBase | The FTM base address pointer |
[in] | mode | Phase A input polarity selection
|
Implements : FTM_DRV_SetQuadPhaseAPolarity_Activity
Definition at line 1074 of file ftm_common.h.
|
inlinestatic |
Enables or disables the phase B input filter.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | State of phase B input filter
|
Implements : FTM_DRV_SetQuadPhaseBFilterCmd_Activity
Definition at line 1051 of file ftm_common.h.
|
inlinestatic |
Selects polarity for the quadrature decode phase B input.
[in] | ftmBase | The FTM base address pointer |
[in] | mode | Phase B input polarity selection
|
Implements : FTM_DRV_SetQuadPhaseBPolarity_Activity
Definition at line 1090 of file ftm_common.h.
|
inlinestatic |
Set the FTM reload interrupt enable.
[in] | ftmBase | The FTM base address pointer |
[in] | enable | - true : Reload interrupt is enabled
|
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.
[in] | instance | The FTM peripheral instance number. |
[in] | channelsValues | The values which will be software configured for channels. |
[in] | softwareTrigger | If true a software trigger is generate to update registers |
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.
[in] | instance | The FTM peripheral instance number. |
[in] | channelsMask | The mask which will configure the channels which can be software controlled. |
[in] | softwareTrigger | If true a software trigger is generate to update registers |
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).
[in] | instance | The FTM peripheral instance number. |
[in] | param | The sync configuration structure. |
Definition at line 370 of file ftm_common.c.
|
inlinestatic |
Enables or disables the trigger generation on FTM channel outputs.
[in] | ftmBase | The FTM base address pointer |
[in] | channel | The FTM peripheral channel number |
[in] | enable | Trigger mode control
|
Implements : FTM_DRV_SetTrigModeControlCmd_Activity
Definition at line 583 of file ftm_common.h.
ftm_state_t* ftmStatePtr[FTM_INSTANCE_COUNT] |
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.
const IRQn_Type g_ftmIrqId[FTM_INSTANCE_COUNT][FEATURE_FTM_CHANNEL_COUNT] |
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.