S32 SDK
ftm_hal.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include "device_registers.h"

Go to the source code of this file.

Macros

#define FTM_RMW_SC(base, mask, value)   (((base)->SC) = ((((base)->SC) & ~(mask)) | (value)))
 FTM_SC - Read and modify and write to Status And Control (RW) More...
 
#define FTM_RMW_CNT(base, mask, value)   (((base)->CNT) = ((((base)->CNT) & ~(mask)) | (value)))
 FTM_CNT - Read and modify and write to Counter (RW) More...
 
#define FTM_RMW_MOD(base, mask, value)   (((base)->MOD) = ((((base)->MOD) & ~(mask)) | (value)))
 FTM_MOD - Read and modify and write Modulo (RW) More...
 
#define FTM_RMW_CNTIN(base, mask, value)   (((base)->CNTIN) = ((((base)->CNTIN) & ~(mask)) | (value)))
 FTM_CNTIN - Read and modify and write Counter Initial Value (RW) More...
 
#define FTM_RMW_STATUS(base, mask, value)   (((base)->STATUS) = ((((base)->STATUS) & ~(mask)) | (value)))
 FTM_STATUS - Read and modify and write Capture And Compare Status (RW) More...
 
#define FTM_RMW_MODE(base, mask, value)   (((base)->MODE) = ((((base)->MODE) & ~(mask)) | (value)))
 FTM_MODE - Read and modify and write Counter Features Mode Selection (RW) More...
 
#define FTM_RMW_CnSCV_REG(base, channel, mask, value)   (((base)->CONTROLS[channel].CnSC) = ((((base)->CONTROLS[channel].CnSC) & ~(mask)) | (value)))
 FTM_CnSCV - Read and modify and write Channel (n) Status And Control (RW) More...
 
#define FTM_RMW_DEADTIME(base, mask, value)   (((base)->DEADTIME) = ((((base)->DEADTIME) & ~(mask)) | (value)))
 FTM_DEADTIME - Read and modify and write Dead-time Insertion Control (RW) More...
 
#define FTM_RMW_EXTTRIG_REG(base, mask, value)   (((base)->EXTTRIG) = ((((base)->EXTTRIG) & ~(mask)) | (value)))
 FTM_EXTTRIG - Read and modify and write External Trigger Control (RW) More...
 
#define FTM_RMW_FLTCTRL(base, mask, value)   (((base)->FLTCTRL) = ((((base)->FLTCTRL) & ~(mask)) | (value)))
 FTM_FLTCTRL - Read and modify and write Fault Control (RW) More...
 
#define FTM_RMW_FMS(base, mask, value)   (((base)->FMS) = ((((base)->FMS) & ~(mask)) | (value)))
 FTM_FMS - Read and modify and write Fault Mode Status (RW) More...
 
#define FTM_RMW_CONF(base, mask, value)   (((base)->CONF) = ((((base)->CONF) & ~(mask)) | (value)))
 FTM_CONF - Read and modify and write Configuration (RW) More...
 
#define FTM_RMW_POL(base, mask, value)   (((base)->POL) = ((((base)->POL) & ~(mask)) | (value)))
 POL - Read and modify and write Polarity (RW) More...
 
#define FTM_RMW_FILTER(base, mask, value)   (((base)->FILTER) = ((((base)->FILTER) & ~(mask)) | (value)))
 FILTER - Read and modify and write Filter (RW) More...
 
#define FTM_RMW_SYNC(base, mask, value)   (((base)->SYNC) = ((((base)->SYNC) & ~(mask)) | (value)))
 SYNC - Read and modify and write Synchronization (RW) More...
 
#define FTM_RMW_QDCTRL(base, mask, value)   (((base)->QDCTRL) = ((((base)->QDCTRL) & ~(mask)) | (value)))
 QDCTRL - Read and modify and write Quadrature Decoder Control And Status (RW) More...
 
#define FTM_RMW_PAIR0DEADTIME(base, mask, value)   (((base)->PAIR0DEADTIME) = ((((base)->PAIR0DEADTIME) & ~(mask)) | (value)))
 FTM_PAIR0DEADTIME - Read and modify and write Dead-time Insertion Control for the pair 0 (RW) More...
 
#define FTM_RMW_PAIR1DEADTIME(base, mask, value)   (((base)->PAIR1DEADTIME) = ((((base)->PAIR1DEADTIME) & ~(mask)) | (value)))
 FTM_PAIR1DEADTIME - Read and modify and write Dead-time Insertion Control for the pair 1 (RW) More...
 
#define FTM_RMW_PAIR2DEADTIME(base, mask, value)   (((base)->PAIR2DEADTIME) = ((((base)->PAIR2DEADTIME) & ~(mask)) | (value)))
 FTM_PAIR2DEADTIME - Read and modify and write Dead-time Insertion Control for the pair 2 (RW) More...
 
#define FTM_RMW_PAIR3DEADTIME(base, mask, value)   (((base)->PAIR3DEADTIME) = ((((base)->PAIR3DEADTIME) & ~(mask)) | (value)))
 FTM_PAIR3DEADTIME - Read and modify and write Dead-time Insertion Control for the pair 3 (RW) More...
 
#define CHAN0_IDX   (0U)
 Channel number for CHAN1. More...
 
#define CHAN1_IDX   (1U)
 Channel number for CHAN2. More...
 
#define CHAN2_IDX   (2U)
 Channel number for CHAN3. More...
 
#define CHAN3_IDX   (3U)
 Channel number for CHAN4. More...
 
#define CHAN4_IDX   (4U)
 Channel number for CHAN5. More...
 
#define CHAN5_IDX   (5U)
 Channel number for CHAN6. More...
 
#define CHAN6_IDX   (6U)
 Channel number for CHAN7. More...
 
#define CHAN7_IDX   (7U)
 
FTM instance number
#define FTM0_IDX   (0U)
 Instance number for FTM0. More...
 
#define FTM1_IDX   (1U)
 Instance number for FTM2. More...
 
#define FTM2_IDX   (2U)
 Instance number for FTM3. More...
 
#define FTM3_IDX   (3U)
 

Enumerations

enum  ftm_clock_source_t { FTM_CLOCK_SOURCE_NONE = 0x00U, FTM_CLOCK_SOURCE_SYSTEMCLK = 0x01U, FTM_CLOCK_SOURCE_FIXEDCLK = 0x02U, FTM_CLOCK_SOURCE_EXTERNALCLK = 0x03U }
 FlexTimer clock source selection. More...
 
enum  ftm_clock_ps_t {
  FTM_CLOCK_DIVID_BY_1 = 0x00U, FTM_CLOCK_DIVID_BY_2 = 0x01U, FTM_CLOCK_DIVID_BY_4 = 0x02U, FTM_CLOCK_DIVID_BY_8 = 0x03U,
  FTM_CLOCK_DIVID_BY_16 = 0x04U, FTM_CLOCK_DIVID_BY_32 = 0x05U, FTM_CLOCK_DIVID_BY_64 = 0x06U, FTM_CLOCK_DIVID_BY_128 = 0x07U
}
 FlexTimer pre-scaler factor selection for the clock source. In quadrature decoder mode set FTM_CLOCK_DIVID_BY_1. More...
 
enum  ftm_deadtime_ps_t { FTM_DEADTIME_DIVID_BY_1 = 0x01U, FTM_DEADTIME_DIVID_BY_4 = 0x02U, FTM_DEADTIME_DIVID_BY_16 = 0x03U }
 FlexTimer pre-scaler factor for the dead-time insertion. More...
 
enum  ftm_polarity_t { FTM_POLARITY_LOW = 0x00U, FTM_POLARITY_HIGH = 0x01U }
 FlexTimer PWM output pulse mode, high-true or low-true on match up. More...
 
enum  ftm_second_channel_polarity_t { FTM_MAIN_INVERTED = 0x01U, FTM_MAIN_DUPLICATED = 0x00U }
 FlexTimer PWM channel (n+1) polarity for combine 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...
 
enum  ftm_bdm_mode_t { FTM_BDM_MODE_00 = 0x00U, FTM_BDM_MODE_01 = 0x01U, FTM_BDM_MODE_10 = 0x02U, FTM_BDM_MODE_11 = 0x03U }
 Options for the FlexTimer behavior in BDM Mode. More...
 
enum  ftm_fault_mode_t { FTM_FAULT_CONTROL_DISABLED = 0x00U, FTM_FAULT_CONTROL_MAN_EVEN = 0x01U, FTM_FAULT_CONTROL_MAN_ALL = 0x02U, FTM_FAULT_CONTROL_AUTO_ALL = 0x03U }
 FlexTimer fault control. More...
 
enum  ftm_reg_update_t { FTM_SYSTEM_CLOCK = 0U, FTM_PWM_SYNC = 1U }
 FTM sync source. More...
 
enum  ftm_pwm_sync_mode_t { FTM_WAIT_LOADING_POINTS = 0U, FTM_UPDATE_NOW = 1U }
 FTM update register. More...
 

Functions

static void FTM_HAL_SetHalfCycleValue (FTM_Type *const ftmBase, uint16_t value)
 Sets the value for the half cycle reload register. More...
 
static void FTM_HAL_SetClockFilterPs (FTM_Type *const ftmBase, uint8_t filterPrescale)
 Sets the filter Pre-scaler divider. More...
 
static uint8_t FTM_HAL_GetClockFilterPs (const FTM_Type *ftmBase)
 Reads the FTM filter clock divider. More...
 
static void FTM_HAL_SetClockSource (FTM_Type *const ftmBase, ftm_clock_source_t clock)
 Sets the FTM clock source. More...
 
static uint8_t FTM_HAL_GetClockSource (const FTM_Type *ftmBase)
 Reads the FTM clock source. More...
 
static void FTM_HAL_SetClockPs (FTM_Type *const ftmBase, ftm_clock_ps_t ps)
 Sets the FTM clock divider. More...
 
static uint8_t FTM_HAL_GetClockPs (const FTM_Type *ftmBase)
 Reads the FTM clock divider. More...
 
static void FTM_HAL_SetTimerOverflowInt (FTM_Type *const ftmBase, bool state)
 Enables the FTM peripheral timer overflow interrupt. More...
 
static bool FTM_HAL_IsOverflowIntEnabled (const FTM_Type *ftmBase)
 Reads the bit that controls enabling the FTM timer overflow interrupt. More...
 
static void FTM_HAL_EnablePwmChannelOutputs (FTM_Type *const ftmBase, uint8_t channel)
 Enable PWM channel Outputs. More...
 
static void FTM_HAL_DisablePwmChannelOutputs (FTM_Type *const ftmBase, uint8_t channel)
 Disable PWM channel Outputs. More...
 
static void FTM_HAL_ClearTimerOverflow (FTM_Type *const ftmBase)
 Clears the timer overflow interrupt flag. More...
 
static bool FTM_HAL_HasTimerOverflowed (const FTM_Type *ftmBase)
 Returns the FTM peripheral timer overflow interrupt flag. More...
 
static void FTM_HAL_SetCpwms (FTM_Type *const ftmBase, bool mode)
 Sets the FTM count direction bit. More...
 
static bool FTM_HAL_GetCpwms (const FTM_Type *ftmBase)
 Gets the FTM count direction bit. More...
 
static void FTM_HAL_SetReIntEnabledCmd (FTM_Type *const ftmBase, bool enable)
 Set the FTM reload interrupt enable. More...
 
static bool FTM_HAL_GetReloadFlag (const FTM_Type *ftmBase)
 Get the state whether the FTM counter reached a reload point. More...
 
static void FTM_HAL_ClearReloadFlag (FTM_Type *const ftmBase)
 Clears the reload flag bit. More...
 
static void FTM_HAL_SetCounter (FTM_Type *const ftmBase, uint16_t value)
 Sets the FTM peripheral current counter value. More...
 
static uint16_t FTM_HAL_GetCounter (const FTM_Type *ftmBase)
 Returns the FTM peripheral current counter value. More...
 
static void FTM_HAL_SetMod (FTM_Type *const ftmBase, uint16_t value)
 Sets the FTM peripheral timer modulo value. More...
 
static uint16_t FTM_HAL_GetMod (const FTM_Type *ftmBase)
 Returns the FTM peripheral counter modulo value. More...
 
static void FTM_HAL_SetCounterInitVal (FTM_Type *const ftmBase, uint16_t value)
 Sets the FTM peripheral timer counter initial value. More...
 
static uint16_t FTM_HAL_GetCounterInitVal (const FTM_Type *ftmBase)
 Returns the FTM peripheral counter initial value. More...
 
static void FTM_HAL_SetChnMSnBAMode (FTM_Type *const ftmBase, uint8_t channel, uint8_t selection)
 Sets the FTM peripheral timer channel mode. More...
 
static void FTM_HAL_SetChnEdgeLevel (FTM_Type *const ftmBase, uint8_t channel, uint8_t level)
 Sets the FTM peripheral timer channel edge level. More...
 
static void FTM_HAL_ClearChSC (FTM_Type *const ftmBase, uint8_t channel)
 Clears the content of Channel (n) Status And Control. More...
 
static uint8_t FTM_HAL_GetChnMode (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel mode. More...
 
static uint8_t FTM_HAL_GetChnEdgeLevel (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel edge level. More...
 
static void FTM_HAL_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_HAL_IsChnIcrst (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the FTM FTM counter is reset. More...
 
static void FTM_HAL_SetChnDmaCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the FTM peripheral timer channel DMA. More...
 
static bool FTM_HAL_IsChnDma (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the FTM peripheral timer channel DMA is enabled. More...
 
static bool FTM_HAL_IsChnIntEnabled (const FTM_Type *ftmBase, uint8_t channel)
 Get FTM channel(n) interrupt enabled or not. More...
 
static void FTM_HAL_EnableChnInt (FTM_Type *const ftmBase, uint8_t channel)
 Enables the FTM peripheral timer channel(n) interrupt. More...
 
static void FTM_HAL_DisableChnInt (FTM_Type *const ftmBase, uint8_t channel)
 Disables the FTM peripheral timer channel(n) interrupt. More...
 
static bool FTM_HAL_HasChnEventOccurred (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether any event for the FTM peripheral timer channel has occurred. More...
 
static void FTM_HAL_ClearChnEventFlag (FTM_Type *const ftmBase, uint8_t channel)
 Clear the channel flag by writing a 0 to the CHF bit. More...
 
static void FTM_HAL_SetTrigModeControlCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the trigger generation on FTM channel outputs. More...
 
static bool FTM_HAL_GetTriggerControled (const FTM_Type *ftmBase, uint8_t channel)
 Returns whether the trigger mode is enabled. More...
 
static bool FTM_HAL_GetChInputState (const FTM_Type *ftmBase, uint8_t channel)
 Get the state of channel input. More...
 
static bool FTM_HAL_GetChOutputValue (const FTM_Type *ftmBase, uint8_t channel)
 Get the value of channel output. More...
 
static void FTM_HAL_SetChnCountVal (FTM_Type *const ftmBase, uint8_t channel, uint16_t value)
 Sets the FTM peripheral timer channel counter value. More...
 
static uint16_t FTM_HAL_GetChnCountVal (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel counter value. More...
 
static bool FTM_HAL_GetChnEventStatus (const FTM_Type *ftmBase, uint8_t channel)
 Gets the FTM peripheral timer channel event status. More...
 
static uint32_t FTM_HAL_GetEventStatus (const FTM_Type *ftmBase)
 Gets the FTM peripheral timer status info for all channels. More...
 
static void FTM_HAL_ClearChnEventStatus (FTM_Type *const ftmBase, uint8_t channel)
 Clears the FTM peripheral timer all channel event status. More...
 
static void FTM_HAL_SetOutmaskReg (FTM_Type *const ftmBase, uint32_t regVal)
 Writes the provided value to the OUTMASK register. More...
 
static void FTM_HAL_SetChnOutputMask (FTM_Type *const ftmBase, uint8_t channel, bool mask)
 Sets the FTM peripheral timer channel output mask. More...
 
static void FTM_HAL_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_HAL_SetChnOutputPolarityCmd (FTM_Type *const ftmBase, uint8_t channel, ftm_polarity_t polarity)
 Sets the FTM peripheral timer channel output polarity. More...
 
static void FTM_HAL_SetChnFaultInputPolarityCmd (FTM_Type *const ftmBase, uint8_t fltChannel, ftm_polarity_t polarity)
 Sets the FTM peripheral timer channel fault input polarity. More...
 
static void FTM_HAL_SetFaultInt (FTM_Type *const ftmBase, bool state)
 Enables/disables the FTM peripheral timer fault interrupt. More...
 
static void FTM_HAL_DisableFaultInt (FTM_Type *const ftmBase)
 Disables the FTM peripheral timer fault interrupt. More...
 
static bool FTM_HAL_IsFaultIntEnabled (const FTM_Type *ftmBase)
 Return true/false whether the Fault interrupt was enabled or not. More...
 
static void FTM_HAL_ClearFaultsIsr (FTM_Type *const ftmBase)
 Clears all fault interrupt flags that are active. More...
 
static void FTM_HAL_SetFaultControlMode (FTM_Type *const ftmBase, ftm_fault_mode_t mode)
 Defines the FTM fault control mode. More...
 
static void FTM_HAL_SetCaptureTestCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM peripheral timer capture test mode. More...
 
static void FTM_HAL_SetWriteProtectionCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM write protection. More...
 
static void FTM_HAL_Enable (FTM_Type *const ftmBase, bool enable)
 Enables the FTM peripheral timer group. More...
 
static bool FTM_HAL_IsFtmEnable (const FTM_Type *ftmBase)
 Get status of the FTMEN bit in the FTM_MODE register. More...
 
static void FTM_HAL_SetInitChnOutputCmd (FTM_Type *const ftmBase, bool enable)
 Initializes the channels output. More...
 
static void FTM_HAL_SetPwmSyncMode (FTM_Type *const ftmBase, bool enable)
 Sets the FTM peripheral timer sync mode. More...
 
static void FTM_HAL_SetSoftwareTriggerCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM peripheral timer software trigger. More...
 
static void FTM_HAL_SetHardwareSyncTriggerSrc (FTM_Type *const ftmBase, uint8_t trigger_num, bool enable)
 Sets the FTM hardware synchronization trigger. More...
 
static void FTM_HAL_SetOutmaskPwmSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Determines when the OUTMASK register is updated with the value of its buffer. More...
 
static void FTM_HAL_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 void FTM_HAL_SetMaxLoadingCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM peripheral timer maximum loading points. More...
 
static void FTM_HAL_SetMinLoadingCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM peripheral timer minimum loading points. More...
 
static void FTM_HAL_SetDualChnMofCombineCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables the FTM peripheral timer channel modified combine mode. More...
 
static void FTM_HAL_SetDualChnFaultCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables the FTM peripheral timer channel pair fault control. More...
 
static void FTM_HAL_SetDualChnPwmSyncCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disables the FTM peripheral timer channel pair counter PWM sync. More...
 
static void FTM_HAL_SetDualChnDeadtimeCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disabled the FTM peripheral timer channel pair deadtime insertion. More...
 
static void FTM_HAL_SetDualChnDecapCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disables the FTM peripheral timer channel dual edge capture. More...
 
static void FTM_HAL_SetDualEdgeCaptureCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables the FTM peripheral timer dual edge capture mode. More...
 
static bool FTM_HAL_GetDualEdgeCaptureBit (const FTM_Type *ftmBase, uint8_t chnlPairNum)
 Enables the FTM peripheral timer dual edge capture mode. More...
 
static void FTM_HAL_SetDualChnCompCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, ftm_second_channel_polarity_t polarity)
 Enables or disables the FTM peripheral timer channel pair output complement mode. More...
 
static void FTM_HAL_SetDualChnCombineCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disables the FTM peripheral timer channel pair output combine mode. More...
 
static bool FTM_HAL_GetDualChnCombineCmd (const FTM_Type *ftmBase, uint8_t chnlPairNum)
 Verify if an channels pair is used in combine mode or not. More...
 
static bool FTM_HAL_GetDualChnMofCombineCmd (const FTM_Type *ftmBase, uint8_t chnlPairNum)
 Verify if an channels pair is used in the modified combine mode or not. More...
 
static void FTM_HAL_SetExtDeadtimeValue (FTM_Type *const ftmBase, uint8_t value)
 Sets the FTM extended dead-time value. More...
 
static void FTM_HAL_SetDeadtimePrescale (FTM_Type *const ftmBase, ftm_deadtime_ps_t divider)
 Sets the FTM dead time divider. More...
 
static void FTM_HAL_SetDeadtimeCount (FTM_Type *const ftmBase, uint8_t count)
 Sets the FTM deadtime value. More...
 
static void FTM_HAL_SetInitTriggerCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the generation of the trigger when the FTM counter is equal to the CNTIN register. More...
 
static bool FTM_HAL_IsChnTriggerGenerated (const FTM_Type *ftmBase)
 Checks whether any channel trigger event has occurred. More...
 
static void FTM_HAL_ClearChnTriggerFlag (FTM_Type *const ftmBase)
 Clear the channel trigger flag. More...
 
static bool FTM_HAL_GetDetectedFaultInput (const FTM_Type *ftmBase)
 Gets the FTM detected fault input. More...
 
static bool FTM_HAL_IsWriteProtectionEnabled (const FTM_Type *ftmBase)
 Checks whether the write protection is enabled. More...
 
static bool FTM_HAL_IsFaultInputEnabled (const FTM_Type *ftmBase)
 Checks whether the logic OR of the fault inputs is enabled. More...
 
static bool FTM_HAL_IsFaultFlagDetected (const FTM_Type *ftmBase, uint8_t channel)
 Checks whether a fault condition is detected at the fault input. More...
 
static void FTM_HAL_ClearFaultFlagDetected (FTM_Type *const ftmBase, uint8_t channel)
 Clear a fault condition is detected at the fault input. More...
 
static void FTM_HAL_SetQuadDecoderCmd (FTM_Type *const ftmBase, bool enable)
 Enables the channel quadrature decoder. More...
 
static void FTM_HAL_SetQuadPhaseAFilterCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the phase A input filter. More...
 
static void FTM_HAL_SetQuadPhaseBFilterCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the phase B input filter. More...
 
static void FTM_HAL_SetQuadPhaseAPolarity (FTM_Type *const ftmBase, ftm_quad_phase_polarity_t mode)
 Selects polarity for the quadrature decode phase A input. More...
 
static void FTM_HAL_SetQuadPhaseBPolarity (FTM_Type *const ftmBase, ftm_quad_phase_polarity_t mode)
 Selects polarity for the quadrature decode phase B input. More...
 
static void FTM_HAL_SetQuadMode (FTM_Type *const ftmBase, ftm_quad_decode_mode_t quadMode)
 Sets the encoding mode used in quadrature decoding mode. More...
 
static bool FTM_HAL_GetQuadDir (const FTM_Type *ftmBase)
 Gets the FTM counter direction in quadrature mode. More...
 
static bool FTM_HAL_GetQuadTimerOverflowDir (const FTM_Type *ftmBase)
 Gets the Timer overflow direction in quadrature mode. More...
 
static void FTM_HAL_SetFaultInputFilterVal (FTM_Type *const ftmBase, uint32_t value)
 Sets the fault input filter value. More...
 
static void FTM_HAL_SetFaultInputFilterCmd (FTM_Type *const ftmBase, uint8_t inputNum, bool enable)
 Enables or disables the fault input filter. More...
 
static void FTM_HAL_ClearFaultControl (FTM_Type *const ftmBase)
 Clears the entire content value of the Fault control register. More...
 
static void FTM_HAL_SetFaultInputCmd (FTM_Type *const ftmBase, uint8_t inputNum, bool enable)
 Enables or disables the fault input. More...
 
static void FTM_HAL_SetPwmFaultBehavior (FTM_Type *const ftmBase, bool enable)
 Configures the behavior of the PWM outputs when a fault is detected. More...
 
static void FTM_HAL_SetDualChnInvertCmd (FTM_Type *const ftmBase, uint8_t chnlPairNum, bool enable)
 Enables or disables the channel invert for a channel pair. More...
 
static void FTM_HAL_SetInvctrlReg (FTM_Type *const ftmBase, uint32_t regVal)
 Writes the provided value to the Inverting control register. More...
 
static void FTM_HAL_SetChnSoftwareCtrlCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the channel software output control. More...
 
static void FTM_HAL_SetAllChnSoftwareCtrlCmd (FTM_Type *const ftmBase, uint8_t channelsMask)
 Enables or disables the channel software output control.The main difference between this function and FTM_HAL_SetChnSoftwareCtrlCmd is that this can configure all the channels in the same time. More...
 
static void FTM_HAL_SetChnSoftwareCtrlVal (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Sets the channel software output control value. More...
 
static void FTM_HAL_SetAllChnSoftwareCtrlVal (FTM_Type *const ftmBase, uint8_t channelsValues)
 Sets the channel software output control value. More...
 
static void FTM_HAL_SetGlobalLoadCmd (FTM_Type *const ftmBase)
 Set the global load mechanism. More...
 
static void FTM_HAL_SetLoadCmd (FTM_Type *const ftmBase, bool enable)
 Enable the global load. More...
 
static void FTM_HAL_SetHalfCycleCmd (FTM_Type *const ftmBase, bool enable)
 Enable the half cycle reload. More...
 
static void FTM_HAL_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_HAL_SetPwmLoadChnSelCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Includes or excludes the channel in the matching process. More...
 
static void FTM_HAL_SetInitTrigOnReloadCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM initialization trigger on Reload Point. More...
 
static void FTM_HAL_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_HAL_SetGlobalTimeBaseCmd (FTM_Type *const ftmBase, bool enable)
 Enables or disables the FTM timer global time base. More...
 
static void FTM_HAL_SetBdmMode (FTM_Type *const ftmBase, ftm_bdm_mode_t val)
 Sets the BDM mode. More...
 
static void FTM_HAL_SetLoadFreq (FTM_Type *const ftmBase, uint8_t val)
 Sets the FTM timer TOF Frequency. More...
 
static void FTM_HAL_SetSwoctrlHardwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets the sync mode for the FTM SWOCTRL register when using a hardware trigger. More...
 
static void FTM_HAL_SetInvctrlHardwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM INVCTRL register when using a hardware trigger. More...
 
static void FTM_HAL_SetOutmaskHardwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM OUTMASK register when using a hardware trigger. More...
 
static void FTM_HAL_SetModCntinCvHardwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM MOD, CNTIN and CV registers when using a hardware trigger. More...
 
static void FTM_HAL_SetCounterHardwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM counter register when using a hardware trigger. More...
 
static void FTM_HAL_SetSwoctrlSoftwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM SWOCTRL register when using a software trigger. More...
 
static void FTM_HAL_SetInvctrlSoftwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM INVCTRL register when using a software trigger. More...
 
static void FTM_HAL_SetOutmaskSoftwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM OUTMASK register when using a software trigger. More...
 
static void FTM_HAL_SetModCntinCvSoftwareSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets sync mode for FTM MOD, CNTIN and CV registers when using a software trigger. More...
 
static void FTM_HAL_SetHwTriggerSyncModeCmd (FTM_Type *const ftmBase, bool enable)
 Sets hardware trigger mode. More...
 
static void FTM_HAL_SetCounterSoftwareSyncModeCmd (FTM_Type *const ftmBase, ftm_pwm_sync_mode_t update_mode)
 Sets sync mode for FTM counter register when using a software trigger. More...
 
static void FTM_HAL_SetPwmSyncModeCmd (FTM_Type *const ftmBase, bool mode)
 Sets the PWM synchronization mode to enhanced or legacy. More...
 
static void FTM_HAL_SetSwoctrlPwmSyncModeCmd (FTM_Type *const ftmBase, ftm_reg_update_t mode)
 Sets the SWOCTRL register PWM synchronization mode. More...
 
static void FTM_HAL_SetInvctrlPwmSyncModeCmd (FTM_Type *const ftmBase, ftm_reg_update_t mode)
 Sets the INVCTRL register PWM synchronization mode. More...
 
static void FTM_HAL_SetCntinPwmSyncModeCmd (FTM_Type *const ftmBase, ftm_reg_update_t mode)
 Sets the CNTIN register PWM synchronization mode. More...
 
static void FTM_HAL_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_HAL_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_HAL_SetPairDeadtimeCount (FTM_Type *const ftmBase, uint8_t channelPair, uint8_t count)
 Sets the FTM dead-time value for the channel pair. More...
 
void FTM_HAL_Reset (FTM_Type *const ftmBase)
 Resets the FTM registers. All the register use in the driver should be reset to default value of each register. More...
 
void FTM_HAL_Init (FTM_Type *const ftmBase, ftm_clock_ps_t ftmClockPrescaler)
 Initializes the FTM. This function will enable the flexTimer module and selects one pre-scale factor for the FTM clock source. More...
 
void FTM_HAL_SetChnTriggerCmd (FTM_Type *const ftmBase, uint8_t channel, bool enable)
 Enables or disables the generation of the FTM peripheral timer channel trigger when the FTM counter is equal to its initial value. More...
 
void FTM_HAL_SetChnInputCaptureFilter (FTM_Type *const ftmBase, uint8_t channel, uint8_t value)
 Sets the FTM peripheral timer channel input capture filter value. More...