ftm_ic_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
25 #ifndef FTM_IC_DRIVER_H
26 #define FTM_IC_DRIVER_H
27 
28 #include "ftm_common.h"
29 
35 /*******************************************************************************
36  * Definitions
37  ******************************************************************************/
38 
44 typedef enum
45 {
50 
56 typedef enum
57 {
64 
70 typedef enum
71 {
73  FTM_RISING_EDGE = 0x01U,
74  FTM_FALLING_EDGE = 0x02U,
75  FTM_BOTH_EDGES = 0x03U
77 
82 typedef enum
83 {
93 
99 typedef struct
100 {
101  uint8_t hwChannelId;
105  uint16_t filterValue;
106  bool filterEn;
111 
117 typedef struct
118 {
119  uint8_t nNumChannels;
120  uint16_t nMaxCountValue;
123 
124 /*******************************************************************************
125  * API
126  ******************************************************************************/
127 
128 #if defined(__cplusplus)
129 extern "C" {
130 #endif
131 
146 status_t FTM_DRV_InitInputCapture(uint32_t instance,
147  const ftm_input_param_t * param);
148 
158 status_t FTM_DRV_DeinitInputCapture(uint32_t instance,
159  const ftm_input_param_t * param);
160 
172 uint16_t FTM_DRV_GetInputCaptureMeasurement(uint32_t instance,
173  uint8_t channel);
174 
185  uint8_t channel);
200 status_t FTM_IC_DRV_SetChannelMode(uint32_t instance,
201  uint8_t channel,
202  ftm_ic_op_mode_t inputMode,
203  bool enableContinuousCapture);
204 
205 #if defined(__cplusplus)
206 }
207 #endif
208  /* End of addtogroup ftm_ic_driver */
212 
213 #endif /* FTM_IC_DRIVER_H */
214 /*******************************************************************************
215  * EOF
216  ******************************************************************************/
ftm_edge_alignment_mode_t edgeAlignement
FlexTimer driver input capture parameters.
status_t FTM_DRV_StartNewSignalMeasurement(uint32_t instance, uint8_t channel)
Starts new single-shot signal measurement of the given channel.
status_t FTM_IC_DRV_SetChannelMode(uint32_t instance, uint8_t channel, ftm_ic_op_mode_t inputMode, bool enableContinuousCapture)
Set mode operation for channel in the input captue mode.
ic_callback_t channelsCallbacks
ftm_ic_op_mode_t
The measurement type for input capture mode Implements : ftm_ic_op_mode_t_Class.
Definition: ftm_ic_driver.h:82
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
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
uint16_t nMaxCountValue
void(* ic_callback_t)(ic_event_t event, void *userData)
Definition: callbacks.h:185
FlexTimer driver Input capture parameters for each channel.
Definition: ftm_ic_driver.h:99
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 measurementType
ftm_signal_measurement_mode_t
FlexTimer input capture measurement type for dual edge input capture.
Definition: ftm_ic_driver.h:56
ftm_input_ch_param_t * inputChConfig
ftm_input_op_mode_t inputMode
ftm_input_op_mode_t
FTM status.
Definition: ftm_ic_driver.h:44
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 ...
ftm_edge_alignment_mode_t
FlexTimer input capture edge mode, rising edge, or falling edge.
Definition: ftm_ic_driver.h:70