ftm_common.c File Reference
#include "ftm_common.h"
#include "ftm_hw_access.h"

Go to the source code of this file.

Functions

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_SetAllChnSoftwareOutputControl (uint32_t instance, uint8_t channelMask, uint8_t channelValueMask)
 This function will control list of channels by software to force the output to specified value. 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_SetOutputlevel (uint32_t instance, uint8_t channel, uint8_t level)
 This function will set the channel edge or level on the selection of the channel mode. 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...
 
status_t FTM_DRV_EnableInterrupts (uint32_t instance, uint32_t interruptMask)
 This function will enable the generation a list of interrupts. It includes the FTM overflow interrupts, the reload point interrupt, the fault interrupt and the channel (n) interrupt. More...
 
void FTM_DRV_DisableInterrupts (uint32_t instance, uint32_t interruptMask)
 This function is used to disable some interrupts. More...
 
uint32_t FTM_DRV_GetEnabledInterrupts (uint32_t instance)
 This function will get the enabled FTM interrupts. More...
 
uint32_t FTM_DRV_GetStatusFlags (uint32_t instance)
 This function will get the FTM status flags. More...
 
void FTM_DRV_ClearStatusFlags (uint32_t instance, uint32_t flagMask)
 This function is used to clear the FTM status flags. 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] = FTM_BASE_PTRS
 Table of base addresses for FTM instances. More...
 
const IRQn_Type g_ftmIrqId [FTM_INSTANCE_COUNT][FEATURE_FTM_CHANNEL_COUNT] = FTM_IRQS
 Interrupt vectors for the FTM peripheral. More...
 
const IRQn_Type g_ftmFaultIrqId [FTM_INSTANCE_COUNT] = FTM_Fault_IRQS
 
const IRQn_Type g_ftmOverflowIrqId [FTM_INSTANCE_COUNT] = FTM_Overflow_IRQS
 
const IRQn_Type g_ftmReloadIrqId [FTM_INSTANCE_COUNT] = FTM_Reload_IRQS
 
ftm_state_tftmStatePtr [FTM_INSTANCE_COUNT] = {NULL}
 Pointer to runtime state structure. More...
 
static const clock_names_t g_ftmExtClockSel [FTM_INSTANCE_COUNT][2]
 Select external clock pin or clock source for peripheral. More...
 

Variable Documentation

const clock_names_t g_ftmExtClockSel[FTM_INSTANCE_COUNT][2]
static
Initial value:

Select external clock pin or clock source for peripheral.

Definition at line 87 of file ftm_common.c.