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 
35 /*******************************************************************************
36  * Definitions
37  ******************************************************************************/
38 
44 typedef struct
45 {
48  uint8_t phaseFilterVal;
51 
57 typedef struct
58 {
60  uint16_t initialVal;
61  uint16_t maxVal;
65 
71 typedef struct
72 {
73  uint16_t counter;
74  bool overflowFlag;
81 
82 /*******************************************************************************
83  * API
84  ******************************************************************************/
85 
86 #if defined(__cplusplus)
87 extern "C" {
88 #endif
89 
100 status_t FTM_DRV_QuadDecodeStart(uint32_t instance,
101  const ftm_quad_decode_config_t * config);
102 
111 status_t FTM_DRV_QuadDecodeStop(uint32_t instance);
112 
121 
122 #if defined(__cplusplus)
123 }
124 #endif
125  /* End of addtogroup ftm_qd_driver */
129 
130 #endif /* FTM_QD_DRIVER_H */
131 /*******************************************************************************
132  * EOF
133  ******************************************************************************/
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:62
ftm_phase_params_t phaseBConfig
Definition: ftm_qd_driver.h:63
FlexTimer quadrature decoder channel parameters.
Definition: ftm_qd_driver.h:44
ftm_quad_decode_mode_t mode
Definition: ftm_qd_driver.h:59
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:357
FTM quadrature configure structure.
Definition: ftm_qd_driver.h:57
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:346
ftm_quad_phase_polarity_t phasePolarity
Definition: ftm_qd_driver.h:49
FTM quadrature state(counter value and flags)
Definition: ftm_qd_driver.h:71