S32 SDK
FTM Input Capture Driver

Detailed Description

FlexTimer Peripheral Input Capture Driver.

Data Structures

struct  ftm_input_ch_param_t
 FlexTimer driver Input capture parameters for each channel. More...
 
struct  ftm_input_param_t
 FlexTimer driver input capture parameters. More...
 

Enumerations

enum  ftm_input_op_mode_t { FTM_EDGE_DETECT = 0U, FTM_SIGNAL_MEASUREMENT = 1U, FTM_NO_OPERATION = 2U }
 FTM status. More...
 
enum  ftm_signal_measurement_mode_t {
  FTM_NO_MEASUREMENT = 0x00U, FTM_RISING_EDGE_PERIOD_MEASUREMENT = 0x01U, FTM_FALLING_EDGE_PERIOD_MEASUREMENT = 0x02U, FTM_PERIOD_ON_MEASUREMENT = 0x03U,
  FTM_PERIOD_OFF_MEASUREMENT = 0x04U
}
 FlexTimer input capture measurement type for dual edge input capture. More...
 
enum  ftm_edge_alignment_mode_t { FTM_NO_PIN_CONTROL = 0x00U, FTM_RISING_EDGE = 0x01U, FTM_FALLING_EDGE = 0x02U, FTM_BOTH_EDGES = 0x03U }
 FlexTimer input capture edge mode, rising edge, or falling edge. More...
 

Functions

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 measurement . When the edge specified in the captureMode argument occurs on the channel the FTM counter is captured into the CnV register. The user will have to read the CnV register separately to get this value. The filter function is disabled if the filterVal argument passed in is 0. The filter function is available only on channels 0,1,2,3. More...
 
status_t FTM_DRV_DeinitInputCapture (uint32_t instance, const ftm_input_param_t *param)
 Disables input capture mode and clears FTM timer configuration. More...
 
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 C(n, n+1)V registers and stored to the static buffers. More...
 
status_t FTM_DRV_StartNewSignalMeasurement (uint32_t instance, uint8_t channel)
 Starts new single-shot signal measurement of the given channel. More...
 

Enumeration Type Documentation

FlexTimer input capture edge mode, rising edge, or falling edge.

Implements : ftm_edge_alignment_mode_t_Class

Enumerator
FTM_NO_PIN_CONTROL 

No trigger

FTM_RISING_EDGE 

Rising edge trigger

FTM_FALLING_EDGE 

Falling edge trigger

FTM_BOTH_EDGES 

Rising and falling edge trigger

Definition at line 73 of file ftm_ic_driver.h.

FTM status.

Implements : ftm_input_op_mode_t_Class

Enumerator
FTM_EDGE_DETECT 

FTM edge detect

FTM_SIGNAL_MEASUREMENT 

FTM signal measurement

FTM_NO_OPERATION 

FTM no operation

Definition at line 47 of file ftm_ic_driver.h.

FlexTimer input capture measurement type for dual edge input capture.

Implements : ftm_signal_measurement_mode_t_Class

Enumerator
FTM_NO_MEASUREMENT 

No measurement

FTM_RISING_EDGE_PERIOD_MEASUREMENT 

Period measurement between two consecutive rising edges

FTM_FALLING_EDGE_PERIOD_MEASUREMENT 

Period measurement between two consecutive falling edges

FTM_PERIOD_ON_MEASUREMENT 

The time measurement taken for the pulse to remain ON or HIGH state

FTM_PERIOD_OFF_MEASUREMENT 

The time measurement taken for the pulse to remain OFF or LOW state

Definition at line 59 of file ftm_ic_driver.h.

Function Documentation

status_t FTM_DRV_DeinitInputCapture ( uint32_t  instance,
const ftm_input_param_t param 
)

Disables input capture mode and clears FTM timer configuration.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]paramConfiguration of the output compare channel.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 236 of file ftm_ic_driver.c.

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 C(n, n+1)V registers and stored to the static buffers.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelFor getting the time stamp of the last edge (in normal input capture) this parameter represents the channel number. For getting the last measured value (in dual edge input capture) this parameter is the lowest channel number of the pair (EX: 0, 2, 4, 6).
Returns
value The measured value

Definition at line 288 of file ftm_ic_driver.c.

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 measurement . When the edge specified in the captureMode argument occurs on the channel the FTM counter is captured into the CnV register. The user will have to read the CnV register separately to get this value. The filter function is disabled if the filterVal argument passed in is 0. The filter function is available only on channels 0,1,2,3.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]paramConfiguration of the input capture channel.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 91 of file ftm_ic_driver.c.

status_t FTM_DRV_StartNewSignalMeasurement ( uint32_t  instance,
uint8_t  channel 
)

Starts new single-shot signal measurement of the given channel.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelConfiguration of the output compare channel.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 306 of file ftm_ic_driver.c.