S32 SDK
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 
38 /*******************************************************************************
39  * Definitions
40  ******************************************************************************/
41 
47 typedef enum
48 {
53 
59 typedef enum
60 {
67 
73 typedef enum
74 {
76  FTM_RISING_EDGE = 0x01U,
77  FTM_FALLING_EDGE = 0x02U,
78  FTM_BOTH_EDGES = 0x03U
80 
86 typedef struct
87 {
88  uint8_t hwChannelId;
92  uint16_t filterValue;
93  bool filterEn;
98 
104 typedef struct
105 {
106  uint8_t nNumChannels;
107  uint16_t nMaxCountValue;
110 
111 /*******************************************************************************
112  * API
113  ******************************************************************************/
114 
115 #if defined(__cplusplus)
116 extern "C" {
117 #endif
118 
133 status_t FTM_DRV_InitInputCapture(uint32_t instance,
134  const ftm_input_param_t * param);
135 
145 status_t FTM_DRV_DeinitInputCapture(uint32_t instance,
146  const ftm_input_param_t * param);
147 
159 uint16_t FTM_DRV_GetInputCaptureMeasurement(uint32_t instance,
160  uint8_t channel);
161 
172  uint8_t channel);
173 
174 #if defined(__cplusplus)
175 }
176 #endif
177  /* End of addtogroup ftm_ic_driver */
181 
182 #endif /* FTM_IC_DRIVER_H */
183 /*******************************************************************************
184  * EOF
185  ******************************************************************************/
ftm_edge_alignment_mode_t edgeAlignement
Definition: ftm_ic_driver.h:90
ftm_channel_event_callback_t channelsCallbacks
Definition: ftm_ic_driver.h:96
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.
const ftm_input_ch_param_t * inputChConfig
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...
Definition: ftm_ic_driver.c:91
void * channelsCallbacksParams
Definition: ftm_ic_driver.h:95
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
FlexTimer driver Input capture parameters for each channel.
Definition: ftm_ic_driver.h:86
status_t FTM_DRV_DeinitInputCapture(uint32_t instance, const ftm_input_param_t *param)
Disables input capture mode and clears FTM timer configuration.
void(* ftm_channel_event_callback_t)(void *userData)
Channel event callback function.
Definition: ftm_common.h:114
ftm_signal_measurement_mode_t measurementType
Definition: ftm_ic_driver.h:91
ftm_signal_measurement_mode_t
FlexTimer input capture measurement type for dual edge input capture.
Definition: ftm_ic_driver.h:59
ftm_input_op_mode_t inputMode
Definition: ftm_ic_driver.h:89
ftm_input_op_mode_t
FTM status.
Definition: ftm_ic_driver.h:47
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:73