61 #define FTM_MAX_DUTY_CYCLE (0x8000U)
63 #define FTM_DUTY_TO_TICKS_SHIFT (15U)
429 #if defined(__cplusplus)
546 bool softwareTrigger);
569 bool softwareTrigger);
583 uint32_t channelsMask,
584 bool softwareTrigger);
599 uint16_t counterValue,
600 bool softwareTrigger);
613 uint16_t reloadPoint,
614 bool softwareTrigger);
630 uint8_t channelsValues,
631 bool softwareTrigger);
644 uint8_t channelsMask,
645 bool softwareTrigger);
658 uint8_t channelsPairMask,
659 bool softwareTrigger);
672 uint16_t counterValue,
673 bool softwareTrigger);
736 uint16_t nextComparematchValue,
738 bool softwareTrigger);
847 uint32_t freqencyHz);
849 #if defined(__cplusplus)
ftm_reg_update_t initCounterSync
ftm_fault_mode_t faultMode
ftm_pwm_sync_t syncMethod
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.
ftm_fault_mode_t
FlexTimer fault control.
status_t FTM_DRV_InitCounter(uint32_t instance, const ftm_timer_param_t *timer)
Initialize the FTM counter.
FlexTimer state structure of the driver.
void(* ftm_channel_event_callback_t)(void *userData)
Channel event callback function.
FlexTimer driver independent PWM parameter.
ftm_polarity_t
FlexTimer PWM output pulse mode, high-true or low-true on match up.
FlexTimer driver PWM parameters.
ftm_polarity_t ftmFaultPinPolarity
Configuration structure that the user needs to set.
const IRQn_Type g_ftmReloadIrqId[FTM_INSTANCE_COUNT]
status_t FTM_DRV_InitOutputCompare(uint32_t instance, const ftm_output_cmp_param_t *param)
Configures the FTM to generate timed pulses(Output compare mode).
status_t FTM_DRV_UpdatePwmPeriod(uint32_t instance, ftm_pwm_update_option_t typeOfUpdate, uint32_t newValue, bool softwareTrigger)
This function will update the new period in the frequency or in the counter value into mode register ...
FTM_Type *const g_ftmBase[FTM_INSTANCE_COUNT]
Table of base addresses for FTM instances.
status_t FTM_DRV_StartNewSignalMeasurement(uint32_t instance, uint8_t channel)
Starts new single-shot signal measurement of the given channel.
status_t FTM_DRV_QuadDecodeStop(uint32_t instance)
De-activates the quadrature decode mode.
status_t FTM_DRV_DeinitOutputCompare(uint32_t instance, const ftm_output_cmp_param_t *param)
Disables compare match output control and clears FTM timer configuration.
IRQn_Type
Defines the Interrupt Numbers definitions.
FlexTimer Registers sync parameters Please don't use software and hardware trigger simultaneously Imp...
const ftm_combined_ch_param_t * pwmCombinedChannelConfig
ftm_output_compare_mode_t chMode
ftm_output_compare_mode_t
FlexTimer Mode configuration for output compare mode.
FlexTimer driver timer mode configuration structure.
status_t FTM_DRV_SetModuloCounterValue(uint32_t instance, uint16_t counterValue, bool softwareTrigger)
This function configure the maximum counter value.
status_t FTM_DRV_QuadDecodeStart(uint32_t instance, const ftm_quad_decode_config_t *config)
Configures the quadrature mode and starts measurement.
ftm_deadtime_ps_t deadTimePrescaler
uint8_t nNumCombinedPwmChannels
status_t FTM_DRV_Init(uint32_t instance, const ftm_user_config_t *info, ftm_state_t *state)
Initializes the FTM driver.
ftm_quad_decoder_state_t FTM_DRV_QuadGetState(uint32_t instance)
Return the current quadrature decoder state (counter value, overflow flag and overflow direction) ...
ftm_reg_update_t
FTM sync source.
status_t FTM_DRV_CounterStart(uint32_t instance)
Starts the FTM counter.
ftm_quad_phase_polarity_t
FlexTimer quadrature phase polarities, normal or inverted polarity.
const IRQn_Type g_ftmFaultIrqId[FTM_INSTANCE_COUNT]
ftm_phase_params_t phaseAConfig
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 ...
status_t FTM_DRV_InitPwm(uint32_t instance, const ftm_pwm_param_t *param)
Configures the duty cycle and frequency and starts outputting the PWM on all channels configured in p...
uint32_t FTM_DRV_GetFrequency(uint32_t instance)
Retrieves the frequency of the clock source feeding the FTM counter.
status_t FTM_DRV_InitInputCapture(uint32_t instance, const ftm_input_param_t *param)
Configures Channel Input Capture for either getting time-stamps on edge detection or on signal measur...
status_t FTM_DRV_UpdatePwmChannel(uint32_t instance, uint8_t channel, ftm_pwm_update_option_t typeOfUpdate, uint16_t firstEdge, uint16_t secondEdge, bool softwareTrigger)
This function updates the waveform output in PWM mode (duty cycle and phase).
ftm_deadtime_ps_t
FlexTimer pre-scaler factor for the dead-time insertion.
const IRQn_Type g_ftmIrqId[FTM_INSTANCE_COUNT][FEATURE_FTM_CHANNEL_COUNT]
Interrupt vectors for the FTM peripheral.
ftm_phase_params_t phaseBConfig
status_t FTM_DRV_SetSoftwareOutputChannelControl(uint32_t instance, uint8_t channelsMask, bool softwareTrigger)
This function will configure which output channel can be software controlled.
uint16_t FTM_DRV_GetInputCaptureMeasurement(uint32_t instance, uint8_t channel)
This function is used to calculate the measurement and/or time stamps values which are read from the ...
FlexTimer quadrature decoder channel parameters.
ftm_clock_source_t ftmClockSource
status_t FTM_DRV_CounterStop(uint32_t instance)
Stops the FTM counter.
uint16_t FTM_DRV_ConvertFreqToPeriodTicks(uint32_t instance, uint32_t freqencyHz)
This function is used to covert the given frequency to period in ticks.
const ftm_pwm_fault_param_t * faultConfig
ftm_pwm_sync_mode_t syncPoint
ftm_quad_decode_mode_t mode
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
#define FEATURE_FTM_CHANNEL_COUNT
FlexTimer driver PWM Fault channel parameters.
FTM quadrature configure structure.
ftm_config_mode_t
FlexTimer operation mode.
#define FTM_INSTANCE_COUNT
bool pwmOutputStateOnFault
ftm_input_op_mode_t
FTM status.
ftm_second_channel_polarity_t
FlexTimer PWM channel (n+1) polarity for combine mode.
uint16_t uDutyCyclePercent
const ftm_output_cmp_ch_param_t * outputChannelConfig
FlexTimer driver combined PWM parameter.
bool enableSecondChannelOutput
uint8_t nNumIndependentPwmChannels
bool enableInitializationTrigger
ftm_quad_decode_mode_t
FlexTimer quadrature decode modes, phase encode or count and direction mode.
ftm_pwm_sync_mode_t
FTM update register.
#define FTM_FEATURE_FAULT_CHANNELS
ftm_pwm_update_option_t
FlexTimer Configure type of PWM update in the duty cycle or in ticks.
FlexTimer driver PWM parameters.
ftm_reg_update_t inverterSync
bool enableExternalTrigger
ftm_bdm_mode_t
Options for the FlexTimer behavior in BDM Mode.
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 ...
status_t FTM_DRV_Deinit(uint32_t instance)
Shuts down the FTM driver.
ftm_polarity_t mainChannelPolarity
bool enableExternalTriggerOnNextChn
ftm_config_mode_t ftmMode
status_t FTM_DRV_DeinitInputCapture(uint32_t instance, const ftm_input_param_t *param)
Disables input capture mode and clears FTM timer configuration.
ftm_signal_measurement_mode_t
FlexTimer input capture measurement type for dual edge input capture.
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.
ftm_second_channel_polarity_t secondChannelPolarity
ftm_config_mode_t ftmMode
FlexTimer driver PWM parameters.
bool enableExternalTrigger
ftm_clock_source_t
FlexTimer clock source selection.
status_t FTM_DRV_UpdateOutputCompareChannel(uint32_t instance, uint8_t channel, uint16_t nextComparematchValue, ftm_output_compare_update_t update, bool softwareTrigger)
Sets the next compare match value based on the current counter value.
ftm_reg_update_t maskRegSync
const ftm_independent_ch_param_t * pwmIndependentChannelConfig
uint8_t nNumOutputChannels
ftm_output_compare_update_t
FlexTimer input capture type of the next output compare value.
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).
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 functio...
uint32_t FTM_DRV_CounterRead(uint32_t instance)
Reads back the current value of the FTM counter.
const IRQn_Type g_ftmOverflowIrqId[FTM_INSTANCE_COUNT]
bool enableExternalTrigger
ftm_edge_alignment_mode_t
FlexTimer input capture edge mode, rising edge, or falling edge.
ftm_quad_phase_polarity_t phasePolarity
status_t FTM_DRV_DeinitPwm(uint32_t instance)
Stops all PWM channels .
ftm_clock_source_t ftmClockSource
FlexTimer driver PWM Fault parameter.
uint32_t ftmSourceClockFrequency
FTM quadrature state(counter value and flags)
ftm_reg_update_t outRegSync
ftm_clock_ps_t ftmPrescaler
ftm_clock_ps_t
FlexTimer pre-scaler factor selection for the clock source. In quadrature decoder mode set FTM_CLOCK_...
bool enableModifiedCombine