| Kinetis SDK API Reference Manual 1.0.0-beta Freescale Semiconductor, Inc.

- Introduction
- Related Pages
- API Usage

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Enumerations | Functions
FlexTimer HAL driver
FlexTimer (FTM)

The section describes the programming interface of the FlexTimer HAL driver. More...

## Data Structures
union | ftm_edge_mode_t
| FlexTimer edge mode. More...
struct | ftm_config_t
| FlexTimer module configuration. More...

## Macros
#define | HW_FTM_CHANNEL_COUNT (8U)
| Number of channels for one FTM instance. More...
#define | HW_FTM_CHANNEL_PAIR_COUNT (4U)
| Number of combined channel of one FTM instance. More...
#define | HW_CHAN0 (0U)
| Channel number for CHAN0. More...
#define | HW_CHAN1 (1U)
| Channel number for CHAN1. More...
#define | HW_CHAN2 (2U)
| Channel number for CHAN2. More...
#define | HW_CHAN3 (3U)
| Channel number for CHAN3. More...
#define | HW_CHAN4 (4U)
| Channel number for CHAN4. More...
#define | HW_CHAN5 (5U)
| Channel number for CHAN5. More...
#define | HW_CHAN6 (6U)
| Channel number for CHAN6. More...
#define | HW_CHAN7 (7U)
| Channel number for CHAN7. More...
#define | FTM_COMBINE_CHAN_CTRL_WIDTH (8U)

## Enumerations
enum | ftm_clock_source_t { kClock_source_FTM_None = 0, kClock_source_FTM_SystemClk, kClock_source_FTM_FixedClk, kClock_source_FTM_ExternalClk }
| FlexTimer clock source selection.
enum | ftm_counting_mode_t { kCounting_FTM_UP = 0, kCounting_FTM_Down }
| FlexTimer counting mode, up-down.
enum | ftm_clock_ps_t { kFtmDividedBy1 = 0, kFtmDividedBy2, kFtmDividedBy4, kFtmDividedBy8, kFtmDividedBy16, kFtmDividedBy32, kFtmDividedBy64, kFtmDividedBy128 }
| FlexTimer pre-scaler factor selection for the clock source.
enum | ftm_phase_t { kFtmPhaseA = 0, kFtmPhaseB }
| FlexTimer phase for the quadrature.
enum | ftm_deadtime_ps_t { kFtmDivided0 = 0, kFtmDivided1 = 1, kFtmDivided4 = 2, kFtmDivided16 = 3 }
| FlexTimer pre-scaler factor for the deadtime insertion.
enum | ftm_config_mode_t { kFtmInputCapture, kFtmOutputCompare, kFtmEdgeAlignedPWM, kFtmCenterAlignedPWM, kFtmCombinedPWM, kFtmDualEdgeCapture, kFtmQuadCapture }
| FlexTimer operation mode, capture, output, dual, or quad.
enum | ftm_input_capture_edge_mode_t { kFtmRisingEdge = 0, kFtmFallingEdge, kFtmRisingAndFalling }
| FlexTimer input capture edge mode, rising edge, or falling edge.
enum | ftm_output_compare_edge_mode_t { kFtmToggleOnMatch = 0, kFtmClearOnMatch, kFtmSetOnMatch }
| FlexTimer output compare edge mode. More...
enum | ftm_pwm_edge_mode_t { kFtmHighTrue = 0, kFtmLowTrue }
| FlexTimer PWM output pulse mode, high-true or low-true on match up.
enum | ftm_dual_capture_edge_mode_t { kFtmOneShout = 0, kFtmContinuous }
| FlexTimer dual capture edge mode, one shot or continuous.

## Functions
static void | ftm_hal_set_clock_source (uint8_t instance, ftm_clock_source_t clock)
| Sets the FTM clock source. More...
static void | ftm_hal_set_clock_ps (uint8_t instance, ftm_clock_ps_t ps)
| Sets the FTM clock divider. More...
static void | ftm_hal_enable_timer_overflow_interrupt (uint8_t instance)
| Enables the FTM peripheral timer overflow interrupt. More...
static void | ftm_hal_disable_timer_overflow_interrupt (uint8_t instance)
| Disables the FTM peripheral timer overflow interrupt. More...
static bool | ftm_is_timer_overflow (uint8_t instance)
| Returns the FTM peripheral timer overflow interrupt flag. More...
static void | ftm_hal_set_cpwms (uint8_t instance, uint8_t mode)
| Sets the FTM center-aligned PWM select. More...
static void | ftm_hal_set_counter (uint8_t instance, uint16_t val)
| Sets the FTM peripheral current counter value. More...
static uint16_t | ftm_hal_get_counter (uint8_t instance)
| Returns the FTM peripheral current counter value. More...
static void | ftm_hal_set_mod (uint8_t instance, uint16_t val)
| Sets the FTM peripheral timer modulo value. More...
static uint16_t | ftm_hal_get_mod (uint8_t instance)
| Returns the FTM peripheral counter modulo value. More...
static void | ftm_hal_set_counter_init_val (uint8_t instance, uint16_t val)
| Sets the FTM peripheral timer counter initial value. More...
static uint16_t | ftm_hal_get_counter_init_val (uint8_t instance)
| Returns the FTM peripheral counter initial value. More...
static void | ftm_hal_set_channel_MSnBA_mode (uint8_t instance, uint8_t channel, uint8_t selection)
| Sets the FTM peripheral timer channel mode. More...
static void | ftm_hal_set_channel_edge_level (uint8_t instance, uint8_t channel, uint8_t level)
| Sets the FTM peripheral timer channel edge level. More...
static uint8_t | ftm_hal_get_channel_mode (uint8_t instance, uint8_t channel)
| Gets the FTM peripheral timer channel mode. More...
static uint8_t | ftm_hal_get_channel_edge_level (uint8_t instance, uint8_t channel)
| Gets the FTM peripheral timer channel edge level. More...
static void | ftm_hal_enable_channle_dma (uint8_t instance, uint8_t channel, bool val)
| Enables or disables the FTM peripheral timer channel DMA. More...
static bool | ftm_hal_is_channel_dma (uint8_t instance, uint8_t channel, bool val)
| Returns whether the FTM peripheral timer channel DMA is enabled. More...
static void | ftm_hal_enable_channel_interrupt (uint8_t instance, uint8_t channel)
| Enables the FTM peripheral timer channel(n) interrupt. More...
static void | ftm_hal_disable_channel_interrupt (uint8_t instance, uint8_t channel)
| Disables the FTM peripheral timer channel(n) interrupt. More...
static bool | ftm_is_channel_event_occurred (uint8_t instance, uint8_t channel)
| Returns whether any event for the FTM peripheral timer channel has occurred. More...
static void | ftm_hal_set_channel_count_value (uint8_t instance, uint8_t channel, uint16_t val)
| Sets the FTM peripheral timer channel counter value. More...
static uint16_t | ftm_hal_get_channel_count_value (uint8_t instance, uint8_t channel, uint16_t val)
| Gets the FTM peripheral timer channel counter value. More...
static uint32_t | ftm_hal_get_channel_event_status (uint8_t instance, uint8_t channel)
| Gets the FTM peripheral timer channel event status. More...
static void | ftm_hal_clear_channel_event_status (uint8_t instance, uint8_t channel)
| Clears the FTM peripheral timer all channel event status. More...
static void | ftm_hal_set_channel_output_mask (uint8_t instance, uint8_t channel, bool mask)
| Sets the FTM peripheral timer channel output mask. More...
static void | ftm_hal_set_channel_output_init_state (uint8_t instance, uint8_t channel, uint8_t state)
| Sets the FTM peripheral timer channel output initial state 0 or 1. More...
static void | ftm_hal_set_channel_output_polarity (uint8_t instance, uint8_t channel, uint8_t pol)
| Sets the FTM peripheral timer channel output polarity. More...
static void | ftm_hal_set_channel_fault_input_polarity (uint8_t instance, uint8_t channel, uint8_t pol)
| Sets the FTM peripheral timer channel input polarity. More...
static void | ftm_hal_enable_fault_interrupt (uint8_t instance)
| Enables the FTM peripheral timer fault interrupt. More...
static void | ftm_hal_disable_fault_interrupt (uint8_t instance)
| Disables the FTM peripheral timer fault interrupt. More...
static void | ftm_hal_set_fault_control_mode (uint8_t instance, uint8_t mode)
| Sets the FTM peripheral timer fault control mode. More...
static void | ftm_hal_enable_capture_test (uint8_t instance, bool enable)
| Enables the FTM peripheral timer capture test. More...
static void | ftm_hal_enable_write_protection (uint8_t instance, bool enable)
| Enables the FTM peripheral timer write protection. More...
static void | ftm_hal_ftm_enable (uint8_t instance, bool enable)
| Enables the FTM peripheral timer group. More...
static void | ftm_hal_enable_channel_init_output (uint8_t instance, bool enable)
| Enables the FTM peripheral timer channel output initialization. More...
static void | ftm_hal_set_pwm_sync_mdoe (uint8_t instance, bool enable)
| Sets the FTM peripheral timer sync mode. More...
static void | ftm_hal_enable_software_trigger (uint8_t instance, bool enable)
| Enables the FTM peripheral timer software trigger. More...
void | ftm_hal_set_hardware_trigger (uint8_t instance, uint8_t trigger_num, bool enable)
| Sets the FTM peripheral timer hardware trigger. More...
static void | ftm_hal_enable_output_mask_sync_by_pwm (uint8_t instance, bool enable)
| Enables the FTM peripheral timer output mask update by PWM sync. More...
static void | ftm_hal_enable_count_reinit_sync (uint8_t instance, bool enable)
| Enables the FTM peripheral timer counter re-initialized by sync. More...
static void | ftm_hal_enable_max_loading (uint8_t instance, bool enable)
| Enables the FTM peripheral timer maximum loading points. More...
static void | ftm_hal_enable_min_loading (uint8_t instance, bool enable)
| Enables the FTM peripheral timer minimum loading points. More...
static uint32_t | get_channel_pair_index (uint8_t channel)
| Combines the channel control. More...
static void | ftm_hal_enable_dual_capture (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer dual edge capture mode. More...
static void | ftm_hal_enable_dual_channel_fault (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel pair fault control. More...
static void | ftm_hal_enable_dual_channel_pwm_sync (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel pair counter PWM sync. More...
static void | ftm_hal_enable_dual_channel_deadtime (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel pair deadtime. More...
static void | ftm_hal_enable_dual_channel_decap (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel dual edge capture decap, not decapen. More...
static void | ftm_hal_enable_dual_channel_comp (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel pair output complement mode. More...
static void | ftm_hal_enable_dual_channel_combine (uint8_t instance, uint8_t channel, bool enable)
| Enables the FTM peripheral timer channel pair output combine mode. More...
static void | ftm_hal_set_deadtime_prescale (uint8_t instance, ftm_deadtime_ps_t divider)
| Set the FTM deadtime divider. More...
static void | ftm_hal_set_deadtime_count (uint8_t instance, uint8_t count)
| Sets the FTM deadtime value. More...
void | ftm_hal_enable_channel_trigger (uint8_t instance, uint8_t channel, bool val)
| Enables the generation of the FTM peripheral timer channel trigger when the FTM counter is equal to its initial value. More...
static bool | ftm_hal_is_channel_trigger_generated (uint8_t instance, uint8_t channel)
| Checks whether any channel trigger event has occurred. More...
static uint8_t | ftm_hal_get_detected_fault_input (uint8_t instance)
| Gets the FTM detected fault input. More...
static bool | ftm_hal_is_write_protection_enable (uint8_t instance)
| Checks whether the write protection is enabled. More...
static void | ftm_hal_enable_quad_capture (uint8_t instance, bool enable)
| Enables the channel quadrature decoder. More...
void | ftm_hal_set_channel_input_capture_filter (uint8_t instance, uint8_t channel, uint8_t val)
| Sets the FTM peripheral timer channel input capture filter value. More...
static void | ftm_hal_enable_channel_fault_input_filter (uint8_t instance, uint8_t channel, bool val)
| Enables the channel input filter. More...
static void | ftm_hal_enable_channel_fault_input (uint8_t instance, uint8_t channel, bool val)
| Enables the channel fault input. More...
static void | ftm_hal_enable_dual_channel_invert (uint8_t instance, uint8_t channel, bool val)
| Enables the channel invert. More...
static void | ftm_hal_enable_channel_software_ctrl (uint8_t instance, uint8_t channel, bool val)
| Enables the channel software control. More...
static void | ftm_hal_set_channel_software_ctrl_val (uint8_t instance, uint8_t channel, bool val)
| Sets the channel software control value. More...
static void | ftm_hal_enable_pwm_load (uint8_t instance, bool enable)
| Enables the FTM timer PWM loading of MOD, CNTIN and CV. More...
static void | ftm_hal_enable_pwm_load_matching_channel (uint8_t instance, uint8_t channel, bool val)
| Enables the channel matching process. More...
static void | ftm_hal_enable_global_time_base_output (uint8_t instance, bool enable)
| Enables the FTM timer global time base output. More...
static void | ftm_hal_enable_global_time_base (uint8_t instance, bool enable)
| Enables the FTM timer global time base. More...
static void | ftm_hal_set_bdm_mode (uint8_t instance, uint8_t val)
| Sets the FTM timer TOF Frequency. More...
static void | ftm_hal_set_tof_frequency (uint8_t instance, uint8_t val)
| Sets the BDM mode. More...
static void | ftm_hal_enable_hardware_sync_software_output_ctrl (uint8_t instance, bool enable)
| Enables the FTM timer hardware sync activation. More...
static void | ftm_hal_enable_hardware_sync_invert_ctrl (uint8_t instance, bool enable)
| Enables the FTM timer hardware inverting control sync. More...
static void | ftm_hal_enable_hardware_sync_output_mask (uint8_t instance, bool enable)
| Enables the FTM timer hardware outmask sync. More...
static void | ftm_hal_enable_hardware_sycn_mod_cntin_cv (uint8_t instance, bool enable)
| MOD, CNTIN, and CV registers synchronization is activated. More...
static void | ftm_hal_enable_hardware_sync_counter (uint8_t instance, bool enable)
| The FTM counter synchronization is activated by a hardware trigger. More...
static void | ftm_hal_enable_pwm_sync_swoctrl (uint8_t instance, bool enable)
| Enables the FTM timer software sync activation. More...
static void | ftm_hal_enable_enhanced_pwm_sync_mdoe (uint8_t instance, bool enable)
| Enables the FTM timer enhanced PWM sync mode. More...
static void | ftm_hal_enable_software_sync_swoctrl (uint8_t instance, bool enable)
| Enables the FTM timer software output control sync. More...
static void | ftm_hal_enable_software_sync_invert_ctrl (uint8_t instance, bool enable)
| Enables the FTM timer software inverting control sync. More...
static void | ftm_hal_enable_software_sync_output_mask (uint8_t instance, bool enable)
| Enables the FTM timer software outmask sync. More...
static void | ftm_hal_enable_software_sycn_mod_cntin_cv (uint8_t instance, bool enable)
| Enables the FTM timer software outmask sync. More...
static void | ftm_hal_enable_software_sync_counter (uint8_t instance, bool enable)
| Enables the FTM timer counter software sync. More...
static void | ftm_hal_enable_invert_sync_with_rising_edge (uint8_t instance, bool enable)
| Enables the FTM timer INVCTRL update by PWM. More...
static void | ftm_hal_enable_cntin_sync_with_rising_edge (uint8_t instance, bool enable)
| Enables the FTM timer cntin update by PWM. More...
void | ftm_hal_reset (uint8_t instance)
| Resets the FTM registers. More...
void | ftm_hal_init (uint8_t instance, ftm_config_t *config)
| Initializes the FTM. More...
void | ftm_hal_enable_pwm_mode (uint8_t instance, ftm_config_t *config)
| Enables the FTM timer when it is PWM output mode. More...
void | ftm_hal_disable_pwm_mode (uint8_t instance, ftm_config_t *config)
| Initializes the FTM timer when it is PWM output mode. More...

## Data Structure Documentation

union ftm_edge_mode_t

### Data Fields
ftm_input_capture_edge_mode_t | input_capture_edge_mode
ftm_output_compare_edge_mode_t | output_compare_edge_mode
ftm_pwm_edge_mode_t | ftm_pwm_edge_mode
ftm_dual_capture_edge_mode_t | ftm_dual_capture_edge_mode

struct ftm_config_t

### Data Fields
ftm_config_mode_t | mode
uint8_t | channel
ftm_edge_mode_t | edge_mode

## Macro Definition Documentation

#define HW_FTM_CHANNEL_COUNT (8U)

#define HW_FTM_CHANNEL_PAIR_COUNT (4U)

#define HW_CHAN0 (0U)

#define HW_CHAN1 (1U)

#define HW_CHAN2 (2U)

#define HW_CHAN3 (3U)

#define HW_CHAN4 (4U)

#define HW_CHAN5 (5U)

#define HW_CHAN6 (6U)

#define HW_CHAN7 (7U)

## Enumeration Type Documentation

enum ftm_output_compare_edge_mode_t

Toggle, clear or set.

## Function Documentation

static void ftm_hal_set_clock_source | ( | uint8_t | instance,
|  | ftm_clock_source_t | clock
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  clock | The FTM peripheral clock selection bits:00: No clock 01: system clock 10 :fixed clock 11:External clock

static void ftm_hal_set_clock_ps | ( | uint8_t | instance,
|  | ftm_clock_ps_t | ps
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  ps | The FTM peripheral clock pre-scale divider

static void ftm_hal_enable_timer_overflow_interrupt | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

static void ftm_hal_disable_timer_overflow_interrupt | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

static bool ftm_is_timer_overflow | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  true | if overflow, false if not

static void ftm_hal_set_cpwms | ( | uint8_t | instance,
|  | uint8_t | mode
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  mode | 1:upcounting mode 0:up_down counting mode

static void ftm_hal_set_counter | ( | uint8_t | instance,
|  | uint16_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  val | FTM timer counter value to be set

static uint16_t ftm_hal_get_counter | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  current | FTM timer counter value

static void ftm_hal_set_mod | ( | uint8_t | instance,
|  | uint16_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  val | The value to be set to the timer modulo

static uint16_t ftm_hal_get_mod | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  FTM | timer modulo value

static void ftm_hal_set_counter_init_val | ( | uint8_t | instance,
|  | uint16_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  val | initial value to be set

static uint16_t ftm_hal_get_counter_init_val | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  FTM | timer counter initial value

static void ftm_hal_set_channel_MSnBA_mode | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | selection
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  selection | The mode to be set valid value MSnB:MSnA :00,01, 10, 11

static void ftm_hal_set_channel_edge_level | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | level
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  level | The rising or falling edge to be set, valid value ELSnB:ELSnA :00,01, 10, 11

static uint8_t ftm_hal_get_channel_mode | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  The | MSnB:MSnA mode value, will be 00,01, 10, 11

static uint8_t ftm_hal_get_channel_edge_level | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  The | ELSnB:ELSnA mode value, will be 00,01, 10, 11

static void ftm_hal_enable_channle_dma | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  val | enable or disable

static bool ftm_hal_is_channel_dma | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  true | if enabled, false if disabled

static void ftm_hal_enable_channel_interrupt | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

static void ftm_hal_disable_channel_interrupt | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

static bool ftm_is_channel_event_occurred | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  true | if event occurred, false otherwise.

static void ftm_hal_set_channel_count_value | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint16_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  val | counter value to be set

static uint16_t ftm_hal_get_channel_count_value | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint16_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  val | return current channel counter value

static uint32_t ftm_hal_get_channel_event_status | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  val | return current channel event status value

static void ftm_hal_clear_channel_event_status | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number

Return values

  val | return current channel counter value

static void ftm_hal_set_channel_output_mask | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | mask
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  mask | mask to be set 0 or 1, unmasked or masked

static void ftm_hal_set_channel_output_init_state | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | state
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  state | counter value to be set 0 or 1

static void ftm_hal_set_channel_output_polarity | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | pol
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  pol | polarity to be set 0 or 1

static void ftm_hal_set_channel_fault_input_polarity | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | pol
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  pol | polarity to be set, 0: active high, 1:active low

static void ftm_hal_enable_fault_interrupt | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

static void ftm_hal_disable_fault_interrupt | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

static void ftm_hal_set_fault_control_mode | ( | uint8_t | instance,
|  | uint8_t | mode
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  mode,valid | number bits:00, 01, 10,11 (1, 2, 3, 4)

static void ftm_hal_enable_capture_test | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | true to enable, false to disable

static void ftm_hal_enable_write_protection | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | true to enable, false to disable

static void ftm_hal_ftm_enable | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_channel_init_output | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_set_pwm_sync_mdoe | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True no restriction both software and hardware sync, false only software sync.

static void ftm_hal_enable_software_trigger | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number.
  enable | True to enable, false to disable

void ftm_hal_set_hardware_trigger | ( | uint8_t | instance,
|  | uint8_t | trigger_num,
|  | bool | enable
| ) |  |

Parameters

  instance | The FTM peripheral instance number
  trigger_num | 0, 1,2 for trigger0, trigger1 and trigger3
  enable | True to enable, 1 to enable

static void ftm_hal_enable_output_mask_sync_by_pwm | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable PWM sync, false to enable outmask in the rising edges of the system clock

static void ftm_hal_enable_count_reinit_sync | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to update FTM counter when triggered , false to count normally

static void ftm_hal_enable_max_loading | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_min_loading | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static uint32_t get_channel_pair_index | ( | uint8_t | channel | ) |
| static

Returns an index for each channel pair.

Parameters

  channel | The FTM peripheral channel number.

Returns
  0 for channel pair 0 & 1
  1 for channel pair 2 & 3
  2 for channel pair 4 & 5
  3 for channel pair 6 & 7

static void ftm_hal_enable_dual_capture | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_fault | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_pwm_sync | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_deadtime | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_decap | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_comp | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_combine | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable channel pair to combine, false to disable

static void ftm_hal_set_deadtime_prescale | ( | uint8_t | instance,
|  | ftm_deadtime_ps_t | divider
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  divider | The FTM peripheral prescale divider 0x :divided by 1, 10: divided by 4 11:divided by 16

static void ftm_hal_set_deadtime_count | ( | uint8_t | instance,
|  | uint8_t | count
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  divider | The FTM peripheral prescale divider count: 0, no counts inserted 1: 1 count is inserted 2: 2 count is inserted....

void ftm_hal_enable_channel_trigger | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |

Channels 6 and 7 cannot be used as triggers.

Parameters

  instance | The FTM peripheral instance number
  channel | Channel to be enabled, valid value 0, 1, 2, 3, 4, 5
  enable | True to enable, false to disable

static bool ftm_hal_is_channel_trigger_generated | ( | uint8_t | instance,
|  | uint8_t | channel
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  True | if there is a trigger event, false if not.

static uint8_t ftm_hal_get_detected_fault_input | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  Return | faulty byte

static bool ftm_hal_is_write_protection_enable | ( | uint8_t | instance | ) |
| inline static

Parameters

  instance | The FTM peripheral instance number

Return values

  True | if enabled, false if not

static void ftm_hal_enable_quad_capture | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

void ftm_hal_set_channel_input_capture_filter | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | uint8_t | val
| ) |  |

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number, only 0,1,2,3, channel 4, 5,6, 7 don't have.
  val | Filter value to be set

static void ftm_hal_enable_channel_fault_input_filter | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | Channel to be enabled, valid value 0, 1, 2, 3
  enable | True to enable, false to disable

static void ftm_hal_enable_channel_fault_input | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | Channel to be enabled, valid value 0, 1, 2, 3
  enable | True to enable, false to disable

static void ftm_hal_enable_dual_channel_invert | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | The FTM peripheral channel number
  enable | True to enable, false to disable

static void ftm_hal_enable_channel_software_ctrl | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | Channel to be enabled, valid value 0, 1, 2, 3, 4,5,6,7
  enable | True to enable, false to disable

static void ftm_hal_set_channel_software_ctrl_val | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number.
  channel | Channel to be enabled, valid value 0, 1, 2, 3,5,6,7,
  bool | True to set 1, false to set 0

static void ftm_hal_enable_pwm_load | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_pwm_load_matching_channel | ( | uint8_t | instance,
|  | uint8_t | channel,
|  | bool | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  channel | Channel to be enabled, valid value 0, 1, 2, 3, 4,5,6,7
  enable | True to enable, false to disable

static void ftm_hal_enable_global_time_base_output | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_global_time_base | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_set_bdm_mode | ( | uint8_t | instance,
|  | uint8_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  val | Value of the TOF bit set frequency

static void ftm_hal_set_tof_frequency | ( | uint8_t | instance,
|  | uint8_t | val
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  val | Value of the TOF bit set frequency

static void ftm_hal_enable_hardware_sync_software_output_ctrl | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_hardware_sync_invert_ctrl | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_hardware_sync_output_mask | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_hardware_sycn_mod_cntin_cv | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

A hardware trigger activates the synchronization.

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_hardware_sync_counter | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_pwm_sync_swoctrl | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_enhanced_pwm_sync_mdoe | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_software_sync_swoctrl | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_software_sync_invert_ctrl | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_software_sync_output_mask | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_software_sycn_mod_cntin_cv | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable.

static void ftm_hal_enable_software_sync_counter | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to enable, false to disable

static void ftm_hal_enable_invert_sync_with_rising_edge | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to update with PWM, false to update with rising edge of system clock.

static void ftm_hal_enable_cntin_sync_with_rising_edge | ( | uint8_t | instance,
|  | bool | enable
| ) |  |
| inline static

Parameters

  instance | The FTM peripheral instance number
  enable | True to update with PWM, false to update with rising edge of system clock.

void ftm_hal_reset | ( | uint8_t | instance | ) |

Parameters

  instance | The FTM peripheral instance number

void ftm_hal_init | ( | uint8_t | instance,
|  | ftm_config_t * | config
| ) |  |

Parameters

  instance | The FTM peripheral instance number.

void ftm_hal_enable_pwm_mode | ( | uint8_t | instance,
|  | ftm_config_t * | config
| ) |  |

Parameters

  instance | The FTM peripheral instance number
  config | pwm config parameter

void ftm_hal_disable_pwm_mode | ( | uint8_t | instance,
|  | ftm_config_t * | config
| ) |  |

Parameters

  instance | The FTM peripheral instance number