S32 SDK
ftm_qd_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_QD_DRIVER_H
26 #define FTM_QD_DRIVER_H
27 
28 #include "ftm_common.h"
29 
38 /*******************************************************************************
39  * Definitions
40  ******************************************************************************/
41 
47 typedef struct
48 {
51  uint8_t phaseFilterVal;
54 
60 typedef struct
61 {
63  uint16_t initialVal;
64  uint16_t maxVal;
68 
74 typedef struct
75 {
76  uint16_t counter;
77  bool overflowFlag;
84 
85 /*******************************************************************************
86  * API
87  ******************************************************************************/
88 
89 #if defined(__cplusplus)
90 extern "C" {
91 #endif
92 
103 status_t FTM_DRV_QuadDecodeStart(uint32_t instance,
104  const ftm_quad_decode_config_t * config);
105 
114 status_t FTM_DRV_QuadDecodeStop(uint32_t instance);
115 
124 
125 #if defined(__cplusplus)
126 }
127 #endif
128  /* End of addtogroup ftm_qd_driver */
132 
133 #endif /* FTM_QD_DRIVER_H */
134 /*******************************************************************************
135  * EOF
136  ******************************************************************************/
status_t FTM_DRV_QuadDecodeStart(uint32_t instance, const ftm_quad_decode_config_t *config)
Configures the quadrature mode and starts measurement.
Definition: ftm_qd_driver.c:50
ftm_phase_params_t phaseAConfig
Definition: ftm_qd_driver.h:65
ftm_phase_params_t phaseBConfig
Definition: ftm_qd_driver.h:66
FlexTimer quadrature decoder channel parameters.
Definition: ftm_qd_driver.h:47
ftm_quad_decode_mode_t mode
Definition: ftm_qd_driver.h:62
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
ftm_quad_phase_polarity_t
FlexTimer quadrature phase polarities, normal or inverted polarity.
Definition: ftm_common.h:100
FTM quadrature configure structure.
Definition: ftm_qd_driver.h:60
ftm_quad_decoder_state_t FTM_DRV_QuadGetState(uint32_t instance)
Return the current quadrature decoder state (counter value, overflow flag and overflow direction) ...
status_t FTM_DRV_QuadDecodeStop(uint32_t instance)
De-activates the quadrature decode mode.
ftm_quad_decode_mode_t
FlexTimer quadrature decode modes, phase encode or count and direction mode.
Definition: ftm_common.h:89
ftm_quad_phase_polarity_t phasePolarity
Definition: ftm_qd_driver.h:52
FTM quadrature state(counter value and flags)
Definition: ftm_qd_driver.h:74