summaryrefslogtreecommitdiff
path: root/bsp/nuvoton/libraries/m460/StdDriver/inc/nu_eqei.h
blob: 1bee656d6f221cb972a47da9a9a563ab39a4c5f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
/**************************************************************************//**
 * @file     nu_eqei.h
 * @version  V3.00
 * @brief    Enhanced Quadrature Encoder Interface (EQEI) driver header file
 *
 * SPDX-License-Identifier: Apache-2.0
 * @copyright (C) 2021 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NU_EQEI_H__
#define __NU_EQEI_H__

#ifdef __cplusplus
extern "C"
{
#endif


/** @addtogroup Standard_Driver Standard Driver
  @{
*/

/** @addtogroup EQEI_Driver EQEI Driver
  @{
*/

/** @addtogroup EQEI_EXPORTED_CONSTANTS EQEI Exported Constants
  @{
*/

/*---------------------------------------------------------------------------------------------------------*/
/* EQEI counting mode selection constants definitions                                                      */
/*---------------------------------------------------------------------------------------------------------*/
#define EQEI_CTL_X4_FREE_COUNTING_MODE       (0x0<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in X4 free-counting mode      \hideinitializer */
#define EQEI_CTL_X2_FREE_COUNTING_MODE       (0x1<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in X2 free-counting mode      \hideinitializer */
#define EQEI_CTL_X4_COMPARE_COUNTING_MODE    (0x2<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in X4 compare-counting mode   \hideinitializer */
#define EQEI_CTL_X2_COMPARE_COUNTING_MODE    (0x3<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in X2 compare-counting mode   \hideinitializer */
#define EQEI_CTL_PHASE_COUNTING_MODE_TYPE1   (0x4<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in phase counting mode type 1 \hideinitializer */
#define EQEI_CTL_PHASE_COUNTING_MODE_TYPE2   (0x5<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in phase counting mode type 1 \hideinitializer */
#define EQEI_CTL_DIRECTIONAL_COUNTING_MODE   (0x6<<EQEI_CTL_MODE_Pos) /*!<EQEI operate in directional counting mode  \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/* EQEI noise filter clock pre-divide selection constants definitions                                      */
/*---------------------------------------------------------------------------------------------------------*/
#define EQEI_CTL_NFCLKSEL_DIV1   (0x0<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK    \hideinitializer */
#define EQEI_CTL_NFCLKSEL_DIV2   (0x1<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK/2  \hideinitializer */
#define EQEI_CTL_NFCLKSEL_DIV4   (0x2<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK/4  \hideinitializer */
#define EQEI_CTL_NFCLKSEL_DIV16  (0x3<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK/16 \hideinitializer */
#define EQEI_CTL_NFCLKSEL_DIV32  (0x4<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK/32 \hideinitializer */
#define EQEI_CTL_NFCLKSEL_DIV64  (0x5<<EQEI_CTL_NFCLKSEL_Pos) /*!< The sampling frequency of the noise filter is EQEI_CLK/64 \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/* EQEI Clock Rate Setting without Quadrature Mode definitions                                             */
/*---------------------------------------------------------------------------------------------------------*/
#define EQEI_CTL2_X1_COUNT_FALLING             (0x0<<EQEI_CTL2_CRS_Pos)  /*!<EQEI counter only counts the falling edge       \hideinitializer */
#define EQEI_CTL2_X1_COUNT_RISING              (0x1<<EQEI_CTL2_CRS_Pos)  /*!<EQEI counter only counts the rising  edge       \hideinitializer */
#define EQEI_CTL2_X2_COUNT_FALLING_AND_RISING  (0x2<<EQEI_CTL2_CRS_Pos)  /*!<EQEI counter counts the rising and falling edge \hideinitializer */

/*---------------------------------------------------------------------------------------------------------*/
/* EQEI Direction Signal Source Select definitions                                                         */
/*---------------------------------------------------------------------------------------------------------*/
#define EQEI_CTL2_DIRCTION_FROM_EQEI_CALC   (0x0<<EQEI_CTL2_DIRSRC_Pos)  /*!<Direction signal is determined from EQEI system calculation   \hideinitializer */
#define EQEI_CTL2_DIRCTION_TIED_HIGH        (0x2<<EQEI_CTL2_DIRSRC_Pos)  /*!<Direction signal is tied 1 only for direction up count mode   \hideinitializer */
#define EQEI_CTL2_DIRCTION_TIED_LOW         (0x3<<EQEI_CTL2_DIRSRC_Pos)  /*!<Direction signal is tied 0 only for direction down count mode \hideinitializer */

/*@}*/ /* end of group EQEI_EXPORTED_CONSTANTS */


/** @addtogroup EQEI_EXPORTED_FUNCTIONS EQEI Exported Functions
  @{
*/

/**
  * @brief      Disable EQEI compare function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro disable EQEI counter compare function.
  * \hideinitializer
  */
#define EQEI_DISABLE_CNT_CMP(eqei)    ((eqei)->CTL &= (~EQEI_CTL_CMPEN_Msk))

/**
  * @brief      Enable EQEI compare function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro enable EQEI counter compare function.
  * \hideinitializer
  */
#define EQEI_ENABLE_CNT_CMP(eqei)     ((eqei)->CTL |= EQEI_CTL_CMPEN_Msk)

/**
  * @brief      Disable EQEI index latch function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro disable EQEI index trigger counter latch function.
  * \hideinitializer
  */
#define EQEI_DISABLE_INDEX_LATCH(eqei)     ((eqei)->CTL &= (~EQEI_CTL_IDXLATEN_Msk))

/**
  * @brief      Enable EQEI index latch function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro enable EQEI index trigger counter latch function.
  * \hideinitializer
  */
#define EQEI_ENABLE_INDEX_LATCH(eqei)     ((eqei)->CTL |= EQEI_CTL_IDXLATEN_Msk)

/**
  * @brief      Disable EQEI index reload function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro disable EQEI index trigger counter reload function.
  * \hideinitializer
  */
#define EQEI_DISABLE_INDEX_RELOAD(eqei)    ((eqei)->CTL &= (~EQEI_CTL_IDXRLDEN_Msk))

/**
  * @brief      Enable EQEI index reload function
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro enable EQEI index trigger counter reload function.
  * \hideinitializer
  */
#define EQEI_ENABLE_INDEX_RELOAD(eqei)    ((eqei)->CTL |= EQEI_CTL_IDXRLDEN_Msk)

/**
  * @brief      Disable EQEI input
  * @param[in]  eqei             The pointer of the specified EQEI module.
  * @param[in]  u32InputType    Input signal type.
  *                             - \ref EQEI_CTL_CHAEN_Msk    : QEA input
  *                             - \ref EQEI_CTL_CHAEN_Msk    : QEB input
  *                             - \ref EQEI_CTL_IDXEN_Msk    : IDX input
  * @return     None
  * @details    This macro disable specified EQEI signal input.
  * \hideinitializer
  */
#define EQEI_DISABLE_INPUT(eqei, u32InputType)     ((eqei)->CTL &= ~(u32InputType))

/**
  * @brief      Enable EQEI input
  * @param[in]  eqei             The pointer of the specified EQEI module.
  * @param[in]  u32InputType    Input signal type .
  *                             - \ref EQEI_CTL_CHAEN_Msk    : QEA input
  *                             - \ref EQEI_CTL_CHBEN_Msk    : QEB input
  *                             - \ref EQEI_CTL_IDXEN_Msk    : IDX input
  * @return     None
  * @details    This macro enable specified EQEI signal input.
  * \hideinitializer
  */
#define EQEI_ENABLE_INPUT(eqei, u32InputType)     ((eqei)->CTL |= (u32InputType))

/**
  * @brief      Disable inverted input polarity
  * @param[in]  eqei             The pointer of the specified EQEI module.
  * @param[in]  u32InputType    Input signal type .
  *                             - \ref EQEI_CTL_CHAINV_Msk   : QEA Input
  *                             - \ref EQEI_CTL_CHBINV_Msk   : QEB Input
  *                             - \ref EQEI_CTL_IDXINV_Msk   : IDX Input
  * @return     None
  * @details    This macro disable specified EQEI signal inverted input polarity.
  * \hideinitializer
  */
#define EQEI_DISABLE_INPUT_INV(eqei, u32InputType)    ((eqei)->CTL &= ~(u32InputType))

/**
  * @brief      Enable inverted input polarity
  * @param[in]  eqei             The pointer of the specified EQEI module.
  * @param[in]  u32InputType    Input signal type.
  *                             - \ref EQEI_CTL_CHAINV_Msk   : QEA Input
  *                             - \ref EQEI_CTL_CHBINV_Msk   : QEB Input
  *                             - \ref EQEI_CTL_IDXINV_Msk   : IDX Input
  * @return     None
  * @details    This macro inverse specified EQEI signal input polarity.
  * \hideinitializer
  */
#define EQEI_ENABLE_INPUT_INV(eqei, u32InputType)     ((qei)->CTL |= (u32InputType))

/**
  * @brief      Disable EQEI interrupt
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32IntSel   Interrupt type selection.
  *                         - \ref EQEI_CTL_DIRIEN_Msk   : Direction change interrupt
  *                         - \ref EQEI_CTL_OVUNIEN_Msk  : Counter overflow or underflow interrupt
  *                         - \ref EQEI_CTL_CMPIEN_Msk   : Compare-match interrupt
  *                         - \ref EQEI_CTL_IDXIEN_Msk   : Index detected interrupt
  * @return     None
  * @details    This macro disable specified EQEI interrupt.
  * \hideinitializer
  */
#define EQEI_DISABLE_INT(eqei, u32IntSel)     ((eqei)->CTL &= ~(u32IntSel))

/**
  * @brief      Enable EQEI interrupt
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32IntSel   Interrupt type selection.
  *                         - \ref EQEI_CTL_DIRIEN_Msk   : Direction change interrupt
  *                         - \ref EQEI_CTL_OVUNIEN_Msk  : Counter overflow or underflow interrupt
  *                         - \ref EQEI_CTL_CMPIEN_Msk   : Compare-match interrupt
  *                         - \ref EQEI_CTL_IDXIEN_Msk   : Index detected interrupt
  * @return     None
  * @details    This macro enable specified EQEI interrupt.
  * \hideinitializer
  */
#define EQEI_ENABLE_INT(eqei, u32IntSel)      ((eqei)->CTL |= (u32IntSel))

/**
  * @brief      Disable EQEI noise filter
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @return     None
  * @details    This macro disable EQEI noise filter function.
  * \hideinitializer
  */
#define EQEI_DISABLE_NOISE_FILTER(eqei)       ((eqei)->CTL |= EQEI_CTL_NFDIS_Msk)

/**
  * @brief      Enable EQEI noise filter
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32ClkSel   The sampling frequency of the noise filter clock.
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV1
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV2
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV4
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV16
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV32
  *                         - \ref EQEI_CTL_NFCLKSEL_DIV64
  * @return     None
  * @details    This macro enable EQEI noise filter function and select noise filter clock.
  * \hideinitializer
  */
#define EQEI_ENABLE_NOISE_FILTER(eqei, u32ClkSel)     ((eqei)->CTL = ((eqei)->CTL & (~(EQEI_CTL_NFDIS_Msk|EQEI_CTL_NFCLKSEL_Msk))) | (u32ClkSel))

/**
  * @brief      Get EQEI counter value
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     EQEI pulse counter register value.
  * @details    This macro get EQEI pulse counter value.
  * \hideinitializer
  */
#define EQEI_GET_CNT_VALUE(eqei)      ((eqei)->CNT)

/**
  * @brief      Get EQEI counting direction
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @retval     0       EQEI counter is in down-counting.
  * @retval     1       EQEI counter is in up-counting.
  * @details    This macro get EQEI counting direction.
  * \hideinitializer
  */
#define EQEI_GET_DIR(eqei)    (((eqei)->STATUS & (EQEI_STATUS_DIRF_Msk))?1:0)

/**
  * @brief      Get EQEI counter hold value
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     EQEI pulse counter hold register value.
  * @details    This macro get EQEI pulse counter hold value, which is updated with counter value in hold counter value control.
  * \hideinitializer
  */
#define EQEI_GET_HOLD_VALUE(eqei)     ((eqei)->CNTHOLD)

/**
  * @brief      Get EQEI counter index latch value
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @return     EQEI pulse counter index latch value
  * @details    This macro get EQEI pulse counter index latch value, which is updated with counter value when the index is detected.
  * \hideinitializer
  */
#define EQEI_GET_INDEX_LATCH_VALUE(eqei)     ((eqei)->CNTLATCH)

/**
  * @brief      Set EQEI counter index latch value
  * @param[in]  eqei     The pointer of the specified EQEI module.
  * @param[in]  u32Val  The latch value.
  * @return     EQEI pulse counter index latch value
  * @details    This macro set EQEI pulse counter index latch value, which is updated with counter value when the index is detected.
  * \hideinitializer
  */
#define EQEI_SET_INDEX_LATCH_VALUE(eqei,u32Val)     ((eqei)->CNTLATCH = (u32Val))

/**
  * @brief      Get EQEI interrupt flag status
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32IntSel   Interrupt type selection.
*                           - \ref EQEI_STATUS_DIRF_Msk      : Counting direction flag
  *                         - \ref EQEI_STATUS_DIRCHGF_Msk   : Direction change flag
  *                         - \ref EQEI_STATUS_OVUNF_Msk     : Counter overflow or underflow flag
  *                         - \ref EQEI_STATUS_CMPF_Msk      : Compare-match flag
  *                         - \ref EQEI_STATUS_IDXF_Msk      : Index detected flag
  * @retval     0           EQEI specified interrupt flag is not set.
  * @retval     1           EQEI specified interrupt flag is set.
  * @details    This macro get EQEI specified interrupt flag status.
  * \hideinitializer
  */
#define EQEI_GET_INT_FLAG(eqei, u32IntSel)        (((eqei)->STATUS & (u32IntSel))?1:0)


/**
  * @brief      Clear EQEI interrupt flag
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32IntSel   Interrupt type selection.
  *                         - \ref EQEI_STATUS_DIRCHGF_Msk   : Direction change flag
  *                         - \ref EQEI_STATUS_OVUNF_Msk     : Counter overflow or underflow flag
  *                         - \ref EQEI_STATUS_CMPF_Msk      : Compare-match flag
  *                         - \ref EQEI_STATUS_IDXF_Msk      : Index detected flag
  * @return     None
  * @details    This macro clear EQEI specified interrupt flag.
  * \hideinitializer
  */
#define EQEI_CLR_INT_FLAG(eqei, u32IntSel)     ((eqei)->STATUS = (u32IntSel))

/**
  * @brief      Set EQEI counter compare value
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Value    The counter compare value.
  * @return     None
  * @details    This macro set EQEI pulse counter compare value.
  * \hideinitializer
  */
#define EQEI_SET_CNT_CMP(eqei, u32Value)      ((eqei)->CNTCMP = (u32Value))

/**
  * @brief      Set EQEI counter value
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Value    The counter compare value.
  * @return     None
  * @details    This macro set EQEI pulse counter value.
  * \hideinitializer
  */
#define EQEI_SET_CNT_VALUE(eqei, u32Value)      ((eqei)->CNT = (u32Value))

/**
  * @brief      Enable EQEI counter hold mode
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Type     The triggered type.
  *                         - \ref EQEI_CTL_HOLDCNT_Msk      : Hold EQEI_CNT control
  *                         - \ref EQEI_CTL_HOLDTMR0_Msk     : Hold EQEI_CNT by Timer0
  *                         - \ref EQEI_CTL_HOLDTMR1_Msk     : Hold EQEI_CNT by Timer1
  *                         - \ref EQEI_CTL_HOLDTMR2_Msk     : Hold EQEI_CNT by Timer2
  *                         - \ref EQEI_CTL_HOLDTMR3_Msk     : Hold EQEI_CNT by Timer3
  * @return     None
  * @details    This macro enable EQEI counter hold mode.
  * \hideinitializer
  */
#define EQEI_ENABLE_HOLD_TRG_SRC(eqei, u32Type)      ((eqei)->CTL |= (u32Type))

/**
  * @brief      Disable EQEI counter hold mode
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Type     The triggered type.
  *                         - \ref EQEI_CTL_HOLDCNT_Msk      : Hold EQEI_CNT control
  *                         - \ref EQEI_CTL_HOLDTMR0_Msk     : Hold EQEI_CNT by Timer0
  *                         - \ref EQEI_CTL_HOLDTMR1_Msk     : Hold EQEI_CNT by Timer1
  *                         - \ref EQEI_CTL_HOLDTMR2_Msk     : Hold EQEI_CNT by Timer2
  *                         - \ref EQEI_CTL_HOLDTMR3_Msk     : Hold EQEI_CNT by Timer3
  * @return     None
  * @details    This macro disable EQEI counter hold mode.
  * \hideinitializer
  */
#define EQEI_DISABLE_HOLD_TRG_SRC(eqei, u32Type)      ((eqei)->CTL &= ~(u32Type))

/**
  * @brief      Set EQEI maximum count value
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Value    The counter maximum value.
  * @return     EQEI maximum count value
  * @details    This macro set EQEI maximum count value.
  * \hideinitializer
  */
#define EQEI_SET_CNT_MAX(eqei, u32Value)      ((eqei)->CNTMAX = (u32Value))

/**
  * @brief      Set EQEI counting mode
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Mode     EQEI counting mode.
  *                         - \ref EQEI_CTL_X4_FREE_COUNTING_MODE
  *                         - \ref EQEI_CTL_X2_FREE_COUNTING_MODE
  *                         - \ref EQEI_CTL_X4_COMPARE_COUNTING_MODE
  *                         - \ref EQEI_CTL_X2_COMPARE_COUNTING_MODE
  *                         - \ref EQEI_CTL_PHASE_COUNTING_MODE_TYPE1
  *                         - \ref EQEI_CTL_PHASE_COUNTING_MODE_TYPE2
  *                         - \ref EQEI_CTL_DIRECTIONAL_COUNTING_MODE
  * @return     None
  * @details    This macro set EQEI counting mode.
  * \hideinitializer
  */
#define EQEI_SET_CNT_MODE(eqei, u32Mode)       ((eqei)->CTL = ((eqei)->CTL & (~EQEI_CTL_MODE_Msk)) | (u32Mode))

/**
  * @brief      Set EQEI clock rate setting without quadrature mode
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Mode     EQEI clock rate setting without quadrature mode.
  *                         - \ref EQEI_CTL2_X1_COUNT_FALLING
  *                         - \ref EQEI_CTL2_X1_COUNT_RISING
  *                         - \ref EQEI_CTL2_X2_COUNT_FALLING_AND_RISING
  * @return     None
  * @details    This macro set EQEI clock rate setting without quadrature mode.
  * \hideinitializer
  */
#define EQEI_SET_CRS_MODE(eqei, u32Mode)       ((eqei)->CTL2 = ((eqei)->CTL2 & (~EQEI_CTL2_CRS_Msk)) | (u32Mode))

/**
  * @brief      Set EQEI direction signal source select
  * @param[in]  eqei         The pointer of the specified EQEI module.
  * @param[in]  u32Mode     EQEI direction signal source select.
  *                         - \ref EQEI_CTL2_DIRCTION_FROM_EQEI_CALC
  *                         - \ref EQEI_CTL2_DIRCTION_TIED_HIGH
  *                         - \ref EQEI_CTL2_DIRCTION_TIED_LOW
  * @return     None
  * @details    This macro set EQEI direction signal source select.
  * \hideinitializer
  */
#define EQEI_SET_DIRSRC_MODE(eqei, u32Mode)       ((eqei)->CTL2 = ((eqei)->CTL2 & (~EQEI_CTL2_DIRSRC_Msk)) | (u32Mode))



void EQEI_Close(EQEI_T *eqei);
void EQEI_DisableInt(EQEI_T *eqei, uint32_t u32IntSel);
void EQEI_EnableInt(EQEI_T *eqei, uint32_t u32IntSel);
void EQEI_Open(EQEI_T *eqei, uint32_t u32Mode, uint32_t u32Value);
void EQEI_Start(EQEI_T *eqei);
void EQEI_Stop(EQEI_T *eqei);


/*@}*/ /* end of group EQEI_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group EQEI_Driver */

/*@}*/ /* end of group Standard_Driver */

#ifdef __cplusplus
}
#endif

#endif /* __NU_EQEI_H__ */

/*** (C) COPYRIGHT 2021 Nuvoton Technology Corp. ***/