MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

qep.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2 * Copyright (c) 2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * --/COPYRIGHT--*/
32 #ifndef _QEP_H_
33 #define _QEP_H_
34
40
41
42 // **************************************************************************
43 // the includes
44
45 // drivers
46 #include "sw/drivers/cpu/src/32b/f28x/f2806x/cpu.h"
47
48
49 // modules
50 #include "sw/modules/math/src/32b/math.h"
51 #include "sw/modules/types/src/types.h"
52
53
58
59
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65
66 // **************************************************************************
67 // the defines
68
69 #define QEP1_BASE_ADDR (0x00006B00)
70
71 #define QEP2_BASE_ADDR (0x00006B40)
72
73 // QDECCTL Register
74 #define QEP_QDECCTL_QSRC (3 << 14)
75 #define QEP_QDECCTL_SOEN (1 << 13)
76 #define QEP_QDECCTL_SPSEL (1 << 12)
77 #define QEP_QDECCTL_XCR (1 << 11)
78 #define QEP_QDECCTL_SWAP (1 << 10)
79 #define QEP_QDECCTL_IGATE (1 << 9)
80 #define QEP_QDECCTL_QAP (1 << 8)
81 #define QEP_QDECCTL_QBP (1 << 7)
82 #define QEP_QDECCTL_QIP (1 << 6)
83 #define QEP_QDECCTL_QSP (1 << 5)
84
85 // QEPCTL Register
86 #define QEP_QEPCTL_FREESOFT ( 3 << 14)
87 #define QEP_QEPCTL_PCRM ( 3 << 12)
88 #define QEP_QEPCTL_SEI ( 3 << 10)
89 #define QEP_QEPCTL_IEI ( 3 << 8)
90 #define QEP_QEPCTL_SWI ( 1 << 7)
91 #define QEP_QEPCTL_SEL ( 1 << 6)
92 #define QEP_QEPCTL_IEL ( 3 << 4)
93 #define QEP_QEPCTL_QPEN ( 1 << 3)
94 #define QEP_QEPCTL_QCLM ( 1 << 2)
95 #define QEP_QEPCTL_UTE ( 1 << 1)
96 #define QEP_QEPCTL_WDE ( 1 << 0)
97
98 // QPOSCTL Register
99 #define QEP_QPOSCTL_PCSHDW ( 1 << 15)
100 #define QEP_QPOSCTL_PCLOAD ( 1 << 14)
101 #define QEP_QPOSCTL_PCPOL ( 1 << 13)
102 #define QEP_QPOSCTL_PCE ( 1 << 12)
103 #define QEP_QPOSCTL_PCSPW (4095 << 0)
104
105 // QCAPCTL Register
106 #define QEP_QCAPCTL_CEN ( 1 << 15)
107 #define QEP_QCAPCTL_CCPS ( 7 << 4)
108 #define QEP_QCAPCTL_UPPS ( 15 << 0)
109
110 // QEINT Register
111 #define QEP_QEINT_UTO ( 1 << 11)
112 #define QEP_QEINT_IEL ( 1 << 10)
113 #define QEP_QEINT_SEL ( 1 << 9)
114 #define QEP_QEINT_PCM ( 1 << 8)
115 #define QEP_QEINT_PCR ( 1 << 7)
116 #define QEP_QEINT_PCO ( 1 << 6)
117 #define QEP_QEINT_PCU ( 1 << 5)
118 #define QEP_QEINT_WTO ( 1 << 4)
119 #define QEP_QEINT_QDC ( 1 << 3)
120 #define QEP_QEINT_QPE ( 1 << 2)
121 #define QEP_QEINT_PCE ( 1 << 1)
122
123 // QFLG Register
124 #define QEP_QFLG_UTO ( 1 << 11)
125 #define QEP_QFLG_IEL ( 1 << 10)
126 #define QEP_QFLG_SEL ( 1 << 9)
127 #define QEP_QFLG_PCM ( 1 << 8)
128 #define QEP_QFLG_PCR ( 1 << 7)
129 #define QEP_QFLG_PCO ( 1 << 6)
130 #define QEP_QFLG_PCU ( 1 << 5)
131 #define QEP_QFLG_WTO ( 1 << 4)
132 #define QEP_QFLG_QDC ( 1 << 3)
133 #define QEP_QFLG_QPE ( 1 << 2)
134 #define QEP_QFLG_PCE ( 1 << 1)
135
136 // QCLR Register
137 #define QEP_QCLR_UTO ( 1 << 11)
138 #define QEP_QCLR_IEL ( 1 << 10)
139 #define QEP_QCLR_SEL ( 1 << 9)
140 #define QEP_QCLR_PCM ( 1 << 8)
141 #define QEP_QCLR_PCR ( 1 << 7)
142 #define QEP_QCLR_PCO ( 1 << 6)
143 #define QEP_QCLR_PCU ( 1 << 5)
144 #define QEP_QCLR_WTO ( 1 << 4)
145 #define QEP_QCLR_QDC ( 1 << 3)
146 #define QEP_QCLR_QPE ( 1 << 2)
147 #define QEP_QCLR_PCE ( 1 << 1)
148
149 // QFRC Register
150 #define QEP_QFRC_UTO ( 1 << 11)
151 #define QEP_QFRC_IEL ( 1 << 10)
152 #define QEP_QFRC_SEL ( 1 << 9)
153 #define QEP_QFRC_PCM ( 1 << 8)
154 #define QEP_QFRC_PCR ( 1 << 7)
155 #define QEP_QFRC_PCO ( 1 << 6)
156 #define QEP_QFRC_PCU ( 1 << 5)
157 #define QEP_QFRC_WTO ( 1 << 4)
158 #define QEP_QFRC_QDC ( 1 << 3)
159 #define QEP_QFRC_QPE ( 1 << 2)
160 #define QEP_QFRC_PCE ( 1 << 1)
161
162 // QEPSTS Register
163 #define QEP_QEPSTS_UPEVNT ( 1 << 7)
164 #define QEP_QEPSTS_FDF ( 1 << 6)
165 #define QEP_QEPSTS_QDF ( 1 << 5)
166 #define QEP_QEPSTS_QDLF ( 1 << 4)
167 #define QEP_QEPSTS_COEF ( 1 << 3)
168 #define QEP_QEPSTS_CDEF ( 1 << 2)
169 #define QEP_QEPSTS_FIMF ( 1 << 1)
170 #define QEP_QEPSTS_PCEF ( 1 << 0)
171
172 // **************************************************************************
173 // the typedefs
174
177 typedef enum
178 {
179 QEP_Qsrc_Quad_Count_Mode=(0 << 14),
180 QEP_Qsrc_Dir_Count_Mode=(1 << 14),
181 QEP_Qsrc_Up_Count_Mode=(2 << 14),
182 QEP_Qsrc_Down_Count_Mode=(3 << 14)
183 } QEP_Qsrc_e;
184
187 typedef enum
188 {
189 QEP_Spsel_Index_Pin_Sync_Output=(0 << 12),
190 QEP_Spsel_Strobe_Pin_Sync_Output=(1 << 12)
191 } QEP_Spsel_e;
192
195 typedef enum
196 {
197 QEP_Xcr_2x_Res=(0 << 11),
198 QEP_Xcr_1x_Res=(1 << 11)
199 } QEP_Xcr_e;
200
203 typedef enum
204 {
205 QEP_Swap_Not_Swapped=(0 << 10),
206 QEP_Swap_Swapped=(1 << 10)
207 } QEP_Swap_e;
208
211 typedef enum
212 {
213 QEP_Igate_Disable=(0 << 9),
214 QEP_Igate_Enable=(1 << 9)
215 } QEP_Igate_e;
216
219 typedef enum
220 {
221 QEP_Qap_No_Effect=(0 << 8),
222 QEP_Qap_Inverted=(1 << 8)
223 } QEP_Qap_e;
224
227 typedef enum
228 {
229 QEP_Qbp_No_Effect=(0 << 7),
230 QEP_Qbp_Inverted=(1 << 7)
231 } QEP_Qbp_e;
232
234 //
235 typedef enum
236 {
237 QEP_Qip_No_Effect=(0 << 6),
238 QEP_Qip_Inverted=(1 << 6)
239 } QEP_Qip_e;
240
243 typedef enum
244 {
245 QEP_Qsp_No_Effect=(0 << 5),
246 QEP_Qsp_Inverted=(1 << 5)
247 } QEP_Qsp_e;
248
251 typedef enum
252 {
253 QEPCTL_Freesoft_Immediate_Halt=(0 << 14),
254 QEPCTL_Freesoft_Rollover_Halt=(1 << 14),
255 QEPCTL_Freesoft_Unaffected_Halt=(2 << 14)
256 } QEPCTL_Freesoft_e;
257
260 typedef enum
261 {
262 QEPCTL_Pcrm_Index_Reset=(0 << 12),
263 QEPCTL_Pcrm_Max_Reset=(1 << 12),
264 QEPCTL_Pcrm_First_Index_Reset=(2 << 12),
265 QEPCTL_Pcrm_Unit_Time_Reset=(3 << 12)
266 } QEPCTL_Pcrm_e;
267
270 typedef enum
271 {
272 QEPCTL_Sei_Nothing=(0 << 10),
273 QEPCTL_Sei_Rising_Edge_Init=(2 << 10),
274 QEPCTL_Sei_Rising_Falling_Edge_Init=(3 << 10)
275 } QEPCTL_Sei_e;
276
279 typedef enum
280 {
281 QEPCTL_Iei_Nothing=(0 << 8),
282 QEPCTL_Iei_Rising_Edge_Init=(2 << 8),
283 QEPCTL_Iei_Rising_Falling_Edge_Init=(3 << 8)
284 } QEPCTL_Iei_e;
285
288 typedef enum
289 {
290 QEPCTL_Swi_Nothing=(0 << 7),
291 QEPCTL_Swi_Auto_Init_Counter=(1 << 7)
292 } QEPCTL_Swi_e;
293
296 typedef enum
297 {
298 QEPCTL_Sel_Rising_Edge=(0 << 6),
299 QEPCTL_Sel_Rising_Falling_Edge=(1 << 6)
300 } QEPCTL_Sel_e;
301
304 typedef enum
305 {
306 QEPCTL_Iel_Rising_Edge=(1 << 4),
307 QEPCTL_Iel_Falling_Edge=(2 << 4),
308 QEPCTL_Iel_Software_Index_Marker=(3 << 4)
309 } QEPCTL_Iel_e;
310
313 typedef enum
314 {
315 QEPCTL_Qclm_Latch_on_CPU_Read=(0 << 2),
316 QEPCTL_Qclm_Latch_on_Unit_Timeout=(1 << 2)
317 } QEPCTL_Qclm_e;
318
321 typedef enum
322 {
323 QPOSCTL_Pcshdw_Load_Immediate=(0 << 15),
324 QPOSCTL_Pcshdw_Shadow_Enabled=(1 << 15)
325 } QPOSCTL_Pcshdw_e;
326
329 typedef enum
330 {
331 QPOSCTL_Pcload_Load_Posn_Count_Zero=(0 << 14),
332 QPOSCTL_Pcload_Load_Posn_Count_Equal_Compare=(1 << 14)
333 } QPOSCTL_Pcload_e;
334
337 typedef enum
338 {
339 QPOSCTL_Pcpol_Active_High=(0 << 13),
340 QPOSCTL_Pcpol_Active_Low=(1 << 13)
341 } QPOSCTL_Pcpol_e;
342
345 typedef enum
346 {
347 QCAPCTL_Ccps_Capture_Div_1=(0 << 4),
348 QCAPCTL_Ccps_Capture_Div_2=(1 << 4),
349 QCAPCTL_Ccps_Capture_Div_4=(2 << 4),
350 QCAPCTL_Ccps_Capture_Div_8=(3 << 4),
351 QCAPCTL_Ccps_Capture_Div_16=(4 << 4),
352 QCAPCTL_Ccps_Capture_Div_32=(5 << 4),
353 QCAPCTL_Ccps_Capture_Div_64=(6 << 4),
354 QCAPCTL_Ccps_Capture_Div_128=(7 << 4)
355 } QCAPCTL_Ccps_e;
356
359 typedef enum
360 {
361 QCAPCTL_Upps_Div_1_Prescale=(0 << 0),
362 QCAPCTL_Upps_Div_2_Prescale=(1 << 0),
363 QCAPCTL_Upps_Div_4_Prescale=(2 << 0),
364 QCAPCTL_Upps_Div_8_Prescale=(3 << 0),
365 QCAPCTL_Upps_Div_16_Prescale=(4 << 0),
366 QCAPCTL_Upps_Div_32_Prescale=(5 << 0),
367 QCAPCTL_Upps_Div_64_Prescale=(6 << 0),
368 QCAPCTL_Upps_Div_128_Prescale=(7 << 0),
369 QCAPCTL_Upps_Div_256_Prescale=(8 << 0),
370 QCAPCTL_Upps_Div_512_Prescale=(9 << 0),
371 QCAPCTL_Upps_Div_1024_Prescale=(10 << 0),
372 QCAPCTL_Upps_Div_2048_Prescale=(11 << 0)
373 } QCAPCTL_Upps_e;
374
376 typedef enum
377 {
378 QEINT_Uto=(1 << 11),
379 QEINT_Iel=(1 << 10),
380 QEINT_Sel=(1 << 9),
381 QEINT_Pcm=(1 << 8),
382 QEINT_Pcr=(1 << 7),
383 QEINT_Pco=(1 << 6),
384 QEINT_Pcu=(1 << 5),
385 QEINT_Wto=(1 << 4),
386 QEINT_Qdc=(1 << 3),
387 QEINT_Qpe=(1 << 2),
388 QEINT_Pce=(1 << 1)
389 } QEINT_e;
390
391
393 typedef enum
394 {
395 UPEVNT=(1 << 7),
396 FDF= (1 << 6),
397 QDF= (1 << 5),
398 QDLF= (1 << 4),
399 COEF= (1 << 3),
400 CDEF= (1 << 2),
401 FIMF= (1 << 1),
402 PCEF= (1 << 0)
403 } QEP_qepsts_e;
404
407 typedef struct _QEP_Obj_
408 {
409 uint32_t QPOSCNT;
410 uint32_t QPOSINIT;
411 uint32_t QPOSMAX;
412 uint32_t QPOSCMP;
413 uint32_t QPOSILAT;
414 uint32_t QPOSSLAT;
415 uint32_t QPOSLAT;
416 uint32_t QUTMR;
417 uint32_t QUPRD;
418 uint16_t QWDTMR;
419 uint16_t QWDPRD;
420 uint16_t QDECCTL;
421 uint16_t QEPCTL;
422 uint16_t QCAPCTL;
423 uint16_t QPOSCTL;
424 uint16_t QEINT;
425 uint16_t QFLG;
426 uint16_t QCLR;
427 uint16_t QFRC;
428 uint16_t QEPSTS;
429 uint16_t QCTMR;
430 uint16_t QCPRD;
431 uint16_t QCTMRLAT;
432 uint16_t QCPRDLAT;
433 } QEP_Obj;
434
435
438 typedef struct _QEP_Obj_ *QEP_Handle;
439
440
441 // **************************************************************************
442 // the globals
443
444
445 // **************************************************************************
446 // the function prototypes
447
450 inline void QEP_clear_all_interrupt_flags (QEP_Handle qepHandle)
451 {
452 QEP_Obj *qep = (QEP_Obj *)qepHandle;
453
454 qep->QCLR = 0xfff;
455
456 return;
457 } // end of QEP_clear_all_interrupt_flags() function
458
462 inline void QEP_clear_interrupt_flag (QEP_Handle qepHandle, const QEINT_e QEINT)
463 {
464 QEP_Obj *qep = (QEP_Obj *)qepHandle;
465
466 qep->QCLR |= QEINT;
467
468 return;
469 } // end of QEP_clear_interrupt_flag() function
470
473 inline void QEP_clear_posn_counter (QEP_Handle qepHandle)
474 {
475 QEP_Obj *qep = (QEP_Obj *)qepHandle;
476
477 qep->QPOSCNT = 0;
478
479 return;
480 } // end of QEP_clear_posn_counter() function
481
484 inline void QEP_disable_all_interrupts (QEP_Handle qepHandle)
485 {
486 QEP_Obj *qep = (QEP_Obj *)qepHandle;
487
488 qep->QEINT = 0;
489
490 return;
491 } // end of QEP_disable_all_interrupts () function
492
495 inline void QEP_disable_capture (QEP_Handle qepHandle)
496 {
497 QEP_Obj *qep = (QEP_Obj *)qepHandle;
498
499 qep->QCAPCTL &= (~QEP_QCAPCTL_CEN);
500
501 return;
502 } // end of QEP_disable_capture () function
503
506 inline void QEP_disable_gate_index (QEP_Handle qepHandle)
507 {
508 QEP_Obj *qep = (QEP_Obj *)qepHandle;
509
510 qep->QDECCTL &= (~QEP_QDECCTL_IGATE);
511
512 return;
513 } // end of QEP_disable_gate_index () function
514
518 inline void QEP_disable_interrupt (QEP_Handle qepHandle, const QEINT_e QEINT)
519 {
520 QEP_Obj *qep = (QEP_Obj *)qepHandle;
521
522 qep->QEINT &= (~QEINT);
523
524 return;
525 } // end of QEP_disable_interrupt
526
529 inline void QEP_disable_posn_compare (QEP_Handle qepHandle)
530 {
531 QEP_Obj *qep = (QEP_Obj *)qepHandle;
532
533 qep->QPOSCTL &= (~QEP_QPOSCTL_PCE);
534
535 return;
536 } // end of QEP_disable_posn_compare () function
537
540 inline void QEP_disable_posn_compare_shadow (QEP_Handle qepHandle)
541 {
542 QEP_Obj *qep = (QEP_Obj *)qepHandle;
543
544 qep->QPOSCTL &= (~QEP_QPOSCTL_PCSHDW);
545
546 return;
547 } // end of QEP_disable_posn_compare_shadow () function
548
551 inline void QEP_disable_sync_out (QEP_Handle qepHandle)
552 {
553 QEP_Obj *qep = (QEP_Obj *)qepHandle;
554
555 qep->QDECCTL &= (~QEP_QDECCTL_SOEN);
556
557 return;
558 } // end of QEP_disable_sync_out () function
559
562 inline void QEP_disable_unit_timer (QEP_Handle qepHandle)
563 {
564 QEP_Obj *qep = (QEP_Obj *)qepHandle;
565
566 qep->QEPCTL &= (~QEP_QEPCTL_UTE);
567
568 return;
569 } // end of QEP_disable_unit_timer () function
570
573 inline void QEP_disable_watchdog (QEP_Handle qepHandle)
574 {
575 QEP_Obj *qep = (QEP_Obj *)qepHandle;
576
577 qep->QEPCTL &= (~QEP_QEPCTL_WDE);
578
579 return;
580 } // end of QEP_disable_watchdog () function
581
584 inline void QEP_enable_capture (QEP_Handle qepHandle)
585 {
586 QEP_Obj *qep = (QEP_Obj *)qepHandle;
587
588 qep->QCAPCTL |= (uint16_t)QEP_QCAPCTL_CEN;
589
590 return;
591 } // end of QEP_enable_capture () function
592
595 inline void QEP_enable_counter (QEP_Handle qepHandle)
596 {
597 QEP_Obj *qep = (QEP_Obj *)qepHandle;
598
599 qep->QEPCTL |= QEP_QEPCTL_QPEN;
600
601 return;
602 } // end of QEP_enable_counter () function
603
606 inline void QEP_enable_gate_index (QEP_Handle qepHandle)
607 {
608 QEP_Obj *qep = (QEP_Obj *)qepHandle;
609
610 qep->QDECCTL |= QEP_Igate_Enable;
611
612 return;
613 } // end of QEP_enable_gate_index () function
614
618 inline void QEP_enable_interrupt (QEP_Handle qepHandle, const QEINT_e QEINT)
619 {
620 QEP_Obj *qep = (QEP_Obj *)qepHandle;
621
622 qep->QEINT |= QEINT;
623
624 return;
625 } // end of QEP_enable_interrupt () function
626
629 inline void QEP_enable_posn_compare (QEP_Handle qepHandle)
630 {
631 QEP_Obj *qep = (QEP_Obj *)qepHandle;
632
633 qep->QPOSCTL |= QEP_QPOSCTL_PCE;
634
635 return;
636 } // end of QEP_enable_posn_compare () function
637
640 inline void QEP_enable_posn_compare_shadow (QEP_Handle qepHandle)
641 {
642 QEP_Obj *qep = (QEP_Obj *)qepHandle;
643
644 qep->QPOSCTL |= (uint16_t)QEP_QPOSCTL_PCSHDW;
645
646 return;
647 } // end of QEP_enable_posn_compare_shadow () function
648
651 inline void QEP_enable_sync_out (QEP_Handle qepHandle)
652 {
653 QEP_Obj *qep = (QEP_Obj *)qepHandle;
654
655 qep->QDECCTL |= QEP_QDECCTL_SOEN;
656
657 return;
658 } // end of QEP_enable_sync_out () function
659
662 inline void QEP_enable_unit_timer (QEP_Handle qepHandle)
663 {
664 QEP_Obj *qep = (QEP_Obj *)qepHandle;
665
666 qep->QEPCTL |= QEP_QEPCTL_UTE;
667
668 return;
669 } // end of QEP_enable_unit_timer () function
670
673 inline void QEP_enable_watchdog (QEP_Handle qepHandle)
674 {
675 QEP_Obj *qep = (QEP_Obj *)qepHandle;
676
677 qep->QEPCTL |= QEP_QEPCTL_WDE;
678
679 return;
680 } // end of QEP_enable_watchdog () function
681
685 inline void QEP_force_interrupt (QEP_Handle qepHandle, const QEINT_e QEINT)
686 {
687 QEP_Obj *qep = (QEP_Obj *)qepHandle;
688
689 qep->QFRC |= QEINT;
690
691 return;
692 } // end of QEP_force_interrupt () function
693
698 extern QEP_Handle QEP_init(void *pMemory,const size_t numBytes);
699
703 inline uint16_t QEP_read_capture_period_latch (QEP_Handle qepHandle)
704 {
705 QEP_Obj *qep = (QEP_Obj *)qepHandle;
706
707 return(qep->QCPRDLAT);
708 } // end of QEP_read_capture_period_latch () function
709
713 inline uint16_t QEP_read_capture_timer_latch (QEP_Handle qepHandle)
714 {
715 QEP_Obj *qep = (QEP_Obj *)qepHandle;
716
717 return(qep->QCTMRLAT);
718 } // end of QEP_read_capture_timer_latch () function
719
724 inline uint16_t QEP_read_interrupt_flag (QEP_Handle qepHandle, const QEINT_e QEINT)
725 {
726 QEP_Obj *qep = (QEP_Obj *)qepHandle;
727
728 return((uint16_t)(qep->QFLG & QEINT));
729 } // end of QEP_read_interrupt_flag () function
730
734 inline uint32_t QEP_read_posn_compare (QEP_Handle qepHandle)
735 {
736 QEP_Obj *qep = (QEP_Obj *)qepHandle;
737
738 return(qep->QPOSCMP);
739 } // end of QEP_read_posn_compare () function
740
744 inline uint32_t QEP_read_posn_count (QEP_Handle qepHandle)
745 {
746 QEP_Obj *qep = (QEP_Obj *)qepHandle;
747
748 return(qep->QPOSCNT);
749 } // end of QEP_read_posn_count () function
750
754 inline uint32_t QEP_read_posn_index_latch (QEP_Handle qepHandle)
755 {
756 QEP_Obj *qep = (QEP_Obj *)qepHandle;
757
758 return(qep->QPOSILAT);
759 } // end of QEP_read_posn_index_latch () function
760
764 inline uint32_t QEP_read_posn_latch (QEP_Handle qepHandle)
765 {
766 QEP_Obj *qep = (QEP_Obj *)qepHandle;
767
768 return(qep->QPOSLAT);
769 } // end of QEP_read_posn_latch () function
770
774 inline uint32_t QEP_read_posn_strobe_latch (QEP_Handle qepHandle)
775 {
776 QEP_Obj *qep = (QEP_Obj *)qepHandle;
777
778 return(qep->QPOSSLAT);
779 } // end of QEP_read_posn_strobe_latch () function
780
784 inline uint16_t QEP_read_status (QEP_Handle qepHandle)
785 {
786 QEP_Obj *qep = (QEP_Obj *)qepHandle;
787
788 return(qep->QEPSTS);
789 } // end of QEP_read_status () function
790
793 inline void QEP_reset_counter (QEP_Handle qepHandle)
794 {
795 QEP_Obj *qep = (QEP_Obj *)qepHandle;
796
797 qep->QEPCTL &= (~QEP_QEPCTL_QPEN);
798
799 return;
800 } // end of QEP_reset_counter () function
801
805 inline void QEP_reset_status (QEP_Handle qepHandle, const QEP_qepsts_e qepsts)
806 {
807 QEP_Obj *qep = (QEP_Obj *)qepHandle;
808
809 qep->QEPSTS |= (qepsts);
810
811 return;
812 } // end of QEP_reset_status() function
813
817 inline void QEP_set_capture_latch_mode (QEP_Handle qepHandle, const QEPCTL_Qclm_e QEPCTL_Qclm)
818 {
819 QEP_Obj *qep = (QEP_Obj *)qepHandle;
820
821 qep->QEPCTL &= (~QEP_QEPCTL_QCLM);
822 qep->QEPCTL |= QEPCTL_Qclm;
823
824 return;
825 } // end of QEP_set_capture_latch_mode () function
826
830 inline void QEP_set_capture_period (QEP_Handle qepHandle, const uint16_t period)
831 {
832 QEP_Obj *qep = (QEP_Obj *)qepHandle;
833
834 qep->QCPRD = period;
835
836 return;
837 } // end of QEP_set_capture_period () function
838
842 inline void QEP_set_capture_prescale (QEP_Handle qepHandle, const QCAPCTL_Ccps_e QCAPCTL_Ccps)
843 {
844 QEP_Obj *qep = (QEP_Obj *)qepHandle;
845
846 qep->QCAPCTL &= (~QEP_QCAPCTL_CCPS);
847 qep->QCAPCTL |= QCAPCTL_Ccps;
848 } // end of QEP_set_capture_prescale () function
849
853 inline void QEP_set_emu_control (QEP_Handle qepHandle, const QEPCTL_Freesoft_e QEPCTL_Freesoft)
854 {
855 QEP_Obj *qep = (QEP_Obj *)qepHandle;
856
857 qep->QEPCTL &= (~QEP_QEPCTL_FREESOFT);
858 qep->QEPCTL |= QEPCTL_Freesoft;
859
860 return;
861 } // end of QEP_set_emu_control () function
862
866 inline void QEP_set_ext_clock_rate (QEP_Handle qepHandle, const QEP_Xcr_e QEP_Xcr)
867 {
868 QEP_Obj *qep = (QEP_Obj *)qepHandle;
869
870 qep->QDECCTL &= (~QEP_QDECCTL_XCR);
871 qep->QDECCTL |= QEP_Xcr;
872
873 return;
874 } // end of QEP_set_ext_clock_rate () function
875
879 inline void QEP_set_index_event_init (QEP_Handle qepHandle, const QEPCTL_Iei_e QEPCTL_Iei)
880 {
881 QEP_Obj *qep = (QEP_Obj *)qepHandle;
882
883 qep->QEPCTL &= (~QEP_QEPCTL_IEI);
884 qep->QEPCTL |= QEPCTL_Iei;
885
886 return;
887 } // end of QEP_set_index_event_init () function
888
892 inline void QEP_set_index_event_latch (QEP_Handle qepHandle, const QEPCTL_Iel_e QEPCTL_Iel)
893 {
894 QEP_Obj *qep = (QEP_Obj *)qepHandle;
895
896 qep->QEPCTL &= (~QEP_QEPCTL_IEL);
897 qep->QEPCTL |= QEPCTL_Iel;
898
899 return;
900 } // end of QEP_set_index_event_latch
901
905 inline void QEP_set_index_polarity (QEP_Handle qepHandle, const QEP_Qip_e QEP_Qip)
906 {
907 QEP_Obj *qep = (QEP_Obj *)qepHandle;
908
909 qep->QDECCTL &= (~QEP_QDECCTL_QIP);
910 qep->QDECCTL |= QEP_Qip;
911
912 return;
913 } // end of QEP_set_index_polarity () function
914
918 inline void QEP_set_max_posn_count (QEP_Handle qepHandle, const uint32_t max_count)
919 {
920 QEP_Obj *qep = (QEP_Obj *)qepHandle;
921
922 qep->QPOSMAX = max_count;
923
924 return;
925 } // end of QEP_set_max_posn_count () function
926
930 inline void QEP_set_posn_compare_pulse_width (QEP_Handle qepHandle, const uint16_t pulse_width)
931 {
932 QEP_Obj *qep = (QEP_Obj *)qepHandle;
933 uint16_t pulse_width_masked;
934
935 pulse_width_masked = pulse_width & 4095;
936 qep->QPOSCTL &= (~QEP_QPOSCTL_PCSPW);
937 qep->QPOSCTL |= pulse_width_masked;
938
939 return;
940 } // end of QEP_set_posn_compare_pulse_width () function
941
945 inline void QEP_set_posn_compare_shadow_load (QEP_Handle qepHandle, const QPOSCTL_Pcload_e QPOSCTL_Pcload)
946 {
947 QEP_Obj *qep = (QEP_Obj *)qepHandle;
948
949 qep->QPOSCTL &= (~QEP_QPOSCTL_PCLOAD);
950 qep->QPOSCTL |= QPOSCTL_Pcload;
951
952 return;
953 } // end of QEP_set_posn_compare_shadow_load () function
954
958 inline void QEP_set_posn_count_reset_mode (QEP_Handle qepHandle, const QEPCTL_Pcrm_e QEPCTL_Pcrm)
959 {
960 QEP_Obj *qep = (QEP_Obj *)qepHandle;
961
962 qep->QEPCTL &= (~QEP_QEPCTL_PCRM);
963 qep->QEPCTL |= QEPCTL_Pcrm;
964
965 return;
966 } // end of QEP_set_posn_count_reset_mode () function
967
971 inline void QEP_set_posn_init_count (QEP_Handle qepHandle, const uint32_t init_count)
972 {
973 QEP_Obj *qep = (QEP_Obj *)qepHandle;
974
975 qep->QPOSINIT = init_count;
976
977 return;
978 } // end of QEP_set_posn_init_count () function
979
983 inline void QEP_set_select_sync_pin (QEP_Handle qepHandle, const QEP_Spsel_e QEP_SPsel)
984 {
985 QEP_Obj *qep = (QEP_Obj *)qepHandle;
986
987 qep->QDECCTL &= (~QEP_QDECCTL_SPSEL);
988 qep->QDECCTL |= QEP_SPsel;
989
990 return;
991 } // end of QEP_set_select_sync_pin () function
992
996 inline void QEP_set_soft_init (QEP_Handle qepHandle, const QEPCTL_Swi_e QEPCTL_Swi)
997 {
998 QEP_Obj *qep = (QEP_Obj *)qepHandle;
999
1000 qep->QEPCTL &= (~QEP_QEPCTL_SWI);
1001 qep->QEPCTL |= QEPCTL_Swi;
1002
1003 return;
1004 } // end of QEP_set_soft_init () function
1005
1009 inline void QEP_set_strobe_event_init (QEP_Handle qepHandle, const QEPCTL_Sei_e QEPCTL_Sei)
1010 {
1011 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1012
1013 qep->QEPCTL &= (~QEP_QEPCTL_SEI);
1014 qep->QEPCTL |= QEPCTL_Sei;
1015
1016 return;
1017 } // end of QEP_set_strobe_event_init () function
1018
1022 inline void QEP_set_strobe_event_latch (QEP_Handle qepHandle, const QEPCTL_Sel_e QEPCTL_Sel)
1023 {
1024 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1025
1026 qep->QEPCTL &= (~QEP_QEPCTL_SEL);
1027 qep->QEPCTL |= QEPCTL_Sel;
1028
1029 return;
1030 } // end of QEP_set_strobe_event_latch () function
1031
1035 inline void QEP_set_strobe_polarity (QEP_Handle qepHandle, const QEP_Qsp_e QEP_Qsp)
1036 {
1037 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1038
1039 qep->QDECCTL &= (~QEP_QDECCTL_QSP);
1040 qep->QDECCTL |= QEP_Qsp;
1041
1042 return;
1043 } // end of QEP_set_strobe_polarity () function
1044
1048 inline void QEP_set_swap_quad_inputs (QEP_Handle qepHandle, QEP_Swap_e QEP_Swap)
1049 {
1050 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1051
1052 qep->QDECCTL &= (~QEP_QDECCTL_SWAP);
1053 qep->QDECCTL |= QEP_Swap;
1054
1055 return;
1056 } // end of QEP_set_swap_quad_inputs () function
1057
1061 inline void QEP_set_synch_output_compare_polarity (QEP_Handle qepHandle, const QPOSCTL_Pcpol_e QPOSCTL_Pcpol)
1062 {
1063 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1064
1065 qep->QPOSCTL &= (~QEP_QPOSCTL_PCPOL);
1066 qep->QPOSCTL |= QPOSCTL_Pcpol;
1067
1068 return;
1069 } // end of QEP_set_synch_output_compare_polarity () function
1070
1074 inline void QEP_set_unit_period (QEP_Handle qepHandle, const uint32_t unit_period)
1075 {
1076 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1077
1078 qep->QUPRD = unit_period;
1079
1080 return;
1081 } // end of QEP_set_unit_period () function
1082
1086 inline void QEP_set_unit_posn_prescale (QEP_Handle qepHandle, const QCAPCTL_Upps_e QCAPCTL_Upps)
1087 {
1088 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1089
1090 qep->QCAPCTL &= (~QEP_QCAPCTL_UPPS);
1091 qep->QCAPCTL |= QCAPCTL_Upps;
1092
1093 return;
1094 } // end of QEP_set_unit_posn_prescale () function
1095
1099 inline void QEP_set_watchdog_period (QEP_Handle qepHandle, const uint16_t watchdog_period)
1100 {
1101 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1102
1103 qep->QWDPRD = watchdog_period;
1104
1105 return;
1106 } // end of QEP_set_watchdog_period () function
1107
1111 inline void QEP_set_A_polarity (QEP_Handle qepHandle, const QEP_Qap_e QEP_Qap)
1112 {
1113 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1114
1115 qep->QDECCTL &= (~QEP_QDECCTL_QAP);
1116 qep->QDECCTL |= QEP_Qap;
1117
1118 return;
1119 } // end of QEP_set_A_polarity () function
1120
1124 inline void QEP_set_B_polarity (QEP_Handle qepHandle, const QEP_Qbp_e QEP_Qbp)
1125 {
1126 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1127
1128 qep->QDECCTL &= (~QEP_QDECCTL_QBP);
1129 qep->QDECCTL |= QEP_Qbp;
1130
1131 return;
1132 } // end of QEP_set_B_polarity () function
1133
1137 inline void QEP_set_QEP_source (QEP_Handle qepHandle, const QEP_Qsrc_e QEP_Qsrc)
1138 {
1139 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1140
1141 // set the value
1142 qep->QDECCTL &= (~QEP_QDECCTL_QSRC);
1143 qep->QDECCTL |= QEP_Qsrc;
1144
1145 return;
1146 } // end of QEP_set_QEP_source () function
1147
1148
1152 inline void QEP_setup_strobe_event_latch (QEP_Handle qepHandle, const QEPCTL_Sel_e QEPCTL_Sel)
1153 {
1154 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1155
1156 qep->QEPCTL &= (~QEP_QEPCTL_SEL);
1157 qep->QEPCTL |= QEPCTL_Sel;
1158
1159 return;
1160 } // end of QEP_setup_strobe_event_latch () function
1161
1162
1166 inline void QEP_write_posn_compare (QEP_Handle qepHandle, const uint32_t posn)
1167 {
1168 QEP_Obj *qep = (QEP_Obj *)qepHandle;
1169
1170 qep->QPOSCMP = posn;
1171
1172 return;
1173 } // end of QEP_write_posn_compare () function
1174
1175 #ifdef __cplusplus
1176 }
1177 #endif // extern "C"
1178
1180 #endif // end of _QEP_H_ definition
1181
QEP_QPOSCTL_PCE
#define QEP_QPOSCTL_PCE
position compare enable/disable
Definition: qep.h:102
QEPCTL_Sel_Rising_Edge
Position counter latched on rising edge of QEPS strobe (QPOSSLAT = POSCCNT)
Definition: qep.h:298
QEP_set_select_sync_pin
void QEP_set_select_sync_pin(QEP_Handle qepHandle, const QEP_Spsel_e QEP_SPsel)
Selects whether index or strobe pin is used for sync output.
Definition: qep.h:983
QEP_disable_watchdog
void QEP_disable_watchdog(QEP_Handle qepHandle)
Disable watchdog timer.
Definition: qep.h:573
_QEP_Obj_::QFLG
uint16_t QFLG
QEP Interrupt Flag Register.
Definition: qep.h:425
FDF
direction on the first index marker
Definition: qep.h:396
QEP_QDECCTL_SPSEL
#define QEP_QDECCTL_SPSEL
sync output pin selection
Definition: qep.h:76
QEP_Spsel_e
QEP_Spsel_e
Sync output pin selection.
Definition: qep.h:187
QEP_set_emu_control
void QEP_set_emu_control(QEP_Handle qepHandle, const QEPCTL_Freesoft_e QEPCTL_Freesoft)
Sets emulation control.
Definition: qep.h:853
QEINT_Pcu
position compare underflow interrupt enable
Definition: qep.h:384
QEP_Xcr_2x_Res
2x resolution: count the rising/falling edge
Definition: qep.h:197
QEP_set_watchdog_period
void QEP_set_watchdog_period(QEP_Handle qepHandle, const uint16_t watchdog_period)
Sets watchdog period.
Definition: qep.h:1099
QCAPCTL_Upps_Div_256_Prescale
upevnt = qclk/256
Definition: qep.h:369
QEP_disable_gate_index
void QEP_disable_gate_index(QEP_Handle qepHandle)
Disable gating of index pulse.
Definition: qep.h:506
QEP_enable_watchdog
void QEP_enable_watchdog(QEP_Handle qepHandle)
Enable watchdog timer.
Definition: qep.h:673
QEP_set_index_polarity
void QEP_set_index_polarity(QEP_Handle qepHandle, const QEP_Qip_e QEP_Qip)
Sets index polarity.
Definition: qep.h:905
QEP_QPOSCTL_PCLOAD
#define QEP_QPOSCTL_PCLOAD
position compare shadow load mode
Definition: qep.h:100
QEP_read_status
uint16_t QEP_read_status(QEP_Handle qepHandle)
Reads status register.
Definition: qep.h:784
QEP_read_posn_strobe_latch
uint32_t QEP_read_posn_strobe_latch(QEP_Handle qepHandle)
Reads position strobe latch.
Definition: qep.h:774
_QEP_Obj_::QUPRD
uint32_t QUPRD
QEP Unit Period.
Definition: qep.h:417
QEP_read_interrupt_flag
uint16_t QEP_read_interrupt_flag(QEP_Handle qepHandle, const QEINT_e QEINT)
Reads interrupt flag value.
Definition: qep.h:724
QEINT_Qdc
quadrature direction change interrupt enable
Definition: qep.h:386
QEPCTL_Freesoft_e
QEPCTL_Freesoft_e
Emulation control bits.
Definition: qep.h:251
QEPCTL_Pcrm_Max_Reset
position counter reset on max position
Definition: qep.h:263
QEPCTL_Freesoft_Rollover_Halt
position, watchdog, unit timer continues until rollover, capture counts until next unit period event ...
Definition: qep.h:254
QEP_qepsts_e
QEP_qepsts_e
QEP status bits.
Definition: qep.h:393
QEP_write_posn_compare
void QEP_write_posn_compare(QEP_Handle qepHandle, const uint32_t posn)
Writes a value to the position compare register.
Definition: qep.h:1166
QEP_set_posn_compare_shadow_load
void QEP_set_posn_compare_shadow_load(QEP_Handle qepHandle, const QPOSCTL_Pcload_e QPOSCTL_Pcload)
Sets position compare shadow load mode.
Definition: qep.h:945
QEPCTL_Sei_e
QEPCTL_Sei_e
Strobe event initialization of position counter.
Definition: qep.h:270
QEP_QDECCTL_QSP
#define QEP_QDECCTL_QSP
QEPS input polarity.
Definition: qep.h:83
QEP_Xcr_1x_Res
1x resolution: count the rising edge only
Definition: qep.h:198
QEP_set_soft_init
void QEP_set_soft_init(QEP_Handle qepHandle, const QEPCTL_Swi_e QEPCTL_Swi)
Determines if software initialization of position counter enabled.
Definition: qep.h:996
_QEP_Obj_::QCAPCTL
uint16_t QCAPCTL
QEP Capture Control.
Definition: qep.h:422
QEINT_Pcm
position compare match interrupt enable
Definition: qep.h:381
_QEP_Obj_::QCPRDLAT
uint16_t QCPRDLAT
QEP Capture Period Latch.
Definition: qep.h:432
QEPCTL_Sei_Rising_Edge_Init
initializes on rising edge of QEPS signal
Definition: qep.h:273
QEP_read_posn_latch
uint32_t QEP_read_posn_latch(QEP_Handle qepHandle)
Reads position counter value.
Definition: qep.h:764
QEP_reset_status
void QEP_reset_status(QEP_Handle qepHandle, const QEP_qepsts_e qepsts)
Resets the individual QEP status register bits.
Definition: qep.h:805
QCAPCTL_Ccps_Capture_Div_64
capclk = sysclkout/64
Definition: qep.h:353
QEP_Qsrc_e
QEP_Qsrc_e
QEP counting mode.
Definition: qep.h:177
_QEP_Obj_::QPOSLAT
uint32_t QPOSLAT
QEP Position Latch.
Definition: qep.h:415
QEINT_Pco
position compare overflow interrupt enable
Definition: qep.h:383
QEP_set_unit_period
void QEP_set_unit_period(QEP_Handle qepHandle, const uint32_t unit_period)
Sets unit timer period.
Definition: qep.h:1074
QEP_QEPCTL_SEI
#define QEP_QEPCTL_SEI
strobe event initialization of position counter
Definition: qep.h:88
QDF
quadrature direction flag
Definition: qep.h:397
QEP_set_strobe_event_latch
void QEP_set_strobe_event_latch(QEP_Handle qepHandle, const QEPCTL_Sel_e QEPCTL_Sel)
Sets up strobe latch of position counter.
Definition: qep.h:1022
QEP_QDECCTL_XCR
#define QEP_QDECCTL_XCR
external clock rate
Definition: qep.h:77
QEP_QDECCTL_QBP
#define QEP_QDECCTL_QBP
QEPB input polarity.
Definition: qep.h:81
QPOSCTL_Pcload_e
QPOSCTL_Pcload_e
Position compare shadow load mode.
Definition: qep.h:329
QEPCTL_Pcrm_Unit_Time_Reset
position counter reset on unit time event
Definition: qep.h:265
QEP_Handle
struct _QEP_Obj_ * QEP_Handle
Defines the QEP handle.
Definition: qep.h:438
QEP_Qsrc_Quad_Count_Mode
quadrature count mode
Definition: qep.h:179
CDEF
capture direction error flag
Definition: qep.h:400
QEPCTL_Freesoft_Unaffected_Halt
position, watchdog, unit timer, capture timer unaffected by emu suspend
Definition: qep.h:255
QEP_QCAPCTL_CEN
#define QEP_QCAPCTL_CEN
enable QEP capture
Definition: qep.h:106
QCAPCTL_Upps_Div_4_Prescale
upevnt = qclk/4
Definition: qep.h:363
QCAPCTL_Upps_Div_64_Prescale
upevnt = qclk/64
Definition: qep.h:367
QEP_setup_strobe_event_latch
void QEP_setup_strobe_event_latch(QEP_Handle qepHandle, const QEPCTL_Sel_e QEPCTL_Sel)
QEP strobe latch event.
Definition: qep.h:1152
QEP_set_capture_prescale
void QEP_set_capture_prescale(QEP_Handle qepHandle, const QCAPCTL_Ccps_e QCAPCTL_Ccps)
Sets capture pre-scaler.
Definition: qep.h:842
QEP_QEPCTL_SEL
#define QEP_QEPCTL_SEL
strobe event latch of position counter
Definition: qep.h:91
QPOSCTL_Pcpol_Active_High
active high pulse output
Definition: qep.h:339
_QEP_Obj_::QEPCTL
uint16_t QEPCTL
QEP Control.
Definition: qep.h:421
QEPCTL_Pcrm_e
QEPCTL_Pcrm_e
Position counter reset mode.
Definition: qep.h:260
QEP_Qap_e
QEP_Qap_e
Channel A polarity.
Definition: qep.h:219
QEP_QDECCTL_IGATE
#define QEP_QDECCTL_IGATE
index pulse gating option
Definition: qep.h:79
QPOSCTL_Pcpol_e
QPOSCTL_Pcpol_e
Polarity of sync output.
Definition: qep.h:337
QCAPCTL_Upps_Div_8_Prescale
upevnt = qclk/8
Definition: qep.h:364
QEP_QEPCTL_IEI
#define QEP_QEPCTL_IEI
index event initialization of position counter
Definition: qep.h:89
QEP_disable_capture
void QEP_disable_capture(QEP_Handle qepHandle)
Disable capture.
Definition: qep.h:495
QEP_QEPCTL_WDE
#define QEP_QEPCTL_WDE
watchdog timer enable
Definition: qep.h:96
QEP_set_posn_compare_pulse_width
void QEP_set_posn_compare_pulse_width(QEP_Handle qepHandle, const uint16_t pulse_width)
Sets output pulse width when a match occur.
Definition: qep.h:930
QEP_set_unit_posn_prescale
void QEP_set_unit_posn_prescale(QEP_Handle qepHandle, const QCAPCTL_Upps_e QCAPCTL_Upps)
Sets unit timer prescaling.
Definition: qep.h:1086
QEP_set_ext_clock_rate
void QEP_set_ext_clock_rate(QEP_Handle qepHandle, const QEP_Xcr_e QEP_Xcr)
Sets external clock rate.
Definition: qep.h:866
QEP_Qbp_Inverted
negates QEPB input
Definition: qep.h:230
QEP_set_swap_quad_inputs
void QEP_set_swap_quad_inputs(QEP_Handle qepHandle, QEP_Swap_e QEP_Swap)
Sets up swapping of A/B channels.
Definition: qep.h:1048
QEP_QEPCTL_QPEN
#define QEP_QEPCTL_QPEN
quad position counter enable/software reset
Definition: qep.h:93
QEINT_e
QEINT_e
QEP interrupt enable flags.
Definition: qep.h:376
QCAPCTL_Ccps_Capture_Div_32
capclk = sysclkout/32
Definition: qep.h:352
QEP_QEPCTL_IEL
#define QEP_QEPCTL_IEL
index event latch of position counter (software index marker)
Definition: qep.h:92
QEP_disable_interrupt
void QEP_disable_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Disable individual interrupt.
Definition: qep.h:518
QEP_Obj
struct _QEP_Obj_ QEP_Obj
Defines the QEP object.
_QEP_Obj_::QCTMRLAT
uint16_t QCTMRLAT
QEP Capture Timer Latch.
Definition: qep.h:431
QEP_QPOSCTL_PCSHDW
#define QEP_QPOSCTL_PCSHDW
position compare shadow enable
Definition: qep.h:99
QEP_QPOSCTL_PCPOL
#define QEP_QPOSCTL_PCPOL
load when QPOSCNT = QPOSCMP
Definition: qep.h:101
QEP_disable_sync_out
void QEP_disable_sync_out(QEP_Handle qepHandle)
Disable output sync pulse.
Definition: qep.h:551
QPOSCTL_Pcload_Load_Posn_Count_Equal_Compare
load when qposcnt = qposcmp
Definition: qep.h:332
QCAPCTL_Upps_Div_1024_Prescale
upevnt = qclk/1024
Definition: qep.h:371
COEF
capture overflow error flag
Definition: qep.h:399
QCAPCTL_Ccps_Capture_Div_128
capclk = sysclkout/128
Definition: qep.h:354
QPOSCTL_Pcload_Load_Posn_Count_Zero
load on qposcnt = 0
Definition: qep.h:331
QEPCTL_Iei_e
QEPCTL_Iei_e
Index event initialization of position counter.
Definition: qep.h:279
QEP_QDECCTL_QIP
#define QEP_QDECCTL_QIP
QEPI input polarity.
Definition: qep.h:82
QEPCTL_Swi_Auto_Init_Counter
init position counter (QPOSCNT=QPOSINIT)
Definition: qep.h:291
QEP_read_posn_count
uint32_t QEP_read_posn_count(QEP_Handle qepHandle)
Reads position counter.
Definition: qep.h:744
_QEP_Obj_::QEPSTS
uint16_t QEPSTS
QEP Status Register.
Definition: qep.h:428
QEP_Qap_Inverted
negates QEPA input
Definition: qep.h:222
UPEVNT
unit position event flag
Definition: qep.h:395
QEP_QDECCTL_SOEN
#define QEP_QDECCTL_SOEN
sync output enable
Definition: qep.h:75
QEP_Spsel_Index_Pin_Sync_Output
index pin for sync output
Definition: qep.h:189
QEP_set_synch_output_compare_polarity
void QEP_set_synch_output_compare_polarity(QEP_Handle qepHandle, const QPOSCTL_Pcpol_e QPOSCTL_Pcpol)
Sets synch output compare polarity.
Definition: qep.h:1061
PCEF
position counter error flag
Definition: qep.h:402
QEP_enable_capture
void QEP_enable_capture(QEP_Handle qepHandle)
Enable capture.
Definition: qep.h:584
_QEP_Obj_::QDECCTL
uint16_t QDECCTL
QEP Decoder Control.
Definition: qep.h:420
QEP_QCAPCTL_CCPS
#define QEP_QCAPCTL_CCPS
qep capture timer clock prescaler
Definition: qep.h:107
QEP_Igate_e
QEP_Igate_e
Index gating.
Definition: qep.h:211
QEP_Qap_No_Effect
no effect
Definition: qep.h:221
_QEP_Obj_::QWDPRD
uint16_t QWDPRD
QEP Watchdog Period.
Definition: qep.h:419
QEP_enable_counter
void QEP_enable_counter(QEP_Handle qepHandle)
Enable counter.
Definition: qep.h:595
QEINT_Sel
strobe event latch interrupt enable
Definition: qep.h:380
QEPCTL_Iei_Nothing
does nothing
Definition: qep.h:281
QEP_QDECCTL_QSRC
#define QEP_QDECCTL_QSRC
position counter source selection
Definition: qep.h:74
QEP_set_max_posn_count
void QEP_set_max_posn_count(QEP_Handle qepHandle, const uint32_t max_count)
Sets max position count.
Definition: qep.h:918
QEP_enable_sync_out
void QEP_enable_sync_out(QEP_Handle qepHandle)
Enable output sync pulse.
Definition: qep.h:651
QEP_Qsrc_Dir_Count_Mode
direction count mode
Definition: qep.h:180
QEP_QEPCTL_QCLM
#define QEP_QEPCTL_QCLM
QEP capture latch mode.
Definition: qep.h:94
QEP_Igate_Disable
disable gating of index pulse
Definition: qep.h:213
QEP_Qsp_Inverted
negates QEPS input
Definition: qep.h:246
QEP_read_capture_period_latch
uint16_t QEP_read_capture_period_latch(QEP_Handle qepHandle)
Reads capture period latch.
Definition: qep.h:703
QCAPCTL_Upps_Div_2_Prescale
upevnt = qclk/2
Definition: qep.h:362
QPOSCTL_Pcshdw_Load_Immediate
shadow disabled, load immediate
Definition: qep.h:323
QEPCTL_Qclm_Latch_on_Unit_Timeout
latch on unit time out
Definition: qep.h:316
QEPCTL_Iel_e
QEPCTL_Iel_e
Index event latch of position counter (software index marker)
Definition: qep.h:304
QEP_init
QEP_Handle QEP_init(void *pMemory, const size_t numBytes)
Initializes the QEP object.
Definition: qep.c:57
QEP_QDECCTL_SWAP
#define QEP_QDECCTL_SWAP
swap quadrature clock inputs
Definition: qep.h:78
_QEP_Obj_::QPOSCNT
uint32_t QPOSCNT
QEP Position Counter.
Definition: qep.h:409
QCAPCTL_Ccps_Capture_Div_2
capclk = sysclkout/2
Definition: qep.h:348
QCAPCTL_Upps_e
QCAPCTL_Upps_e
Unit position event prescaler.
Definition: qep.h:359
QCAPCTL_Ccps_e
QCAPCTL_Ccps_e
QEP capture timer clock prescaler.
Definition: qep.h:345
QPOSCTL_Pcpol_Active_Low
active low pulse output
Definition: qep.h:340
QEP_QEPCTL_UTE
#define QEP_QEPCTL_UTE
QEP unit timer enable.
Definition: qep.h:95
QEP_set_strobe_event_init
void QEP_set_strobe_event_init(QEP_Handle qepHandle, const QEPCTL_Sei_e QEPCTL_Sei)
Determines strobe initialization of position counter.
Definition: qep.h:1009
QEPCTL_Sel_Rising_Falling_Edge
Clockwise: position counter latched on rising edge, counter clockwise: latched on falling edge...
Definition: qep.h:299
QEP_disable_unit_timer
void QEP_disable_unit_timer(QEP_Handle qepHandle)
Disable unit timer.
Definition: qep.h:562
QEP_reset_counter
void QEP_reset_counter(QEP_Handle qepHandle)
Resets counter.
Definition: qep.h:793
QEP_disable_posn_compare
void QEP_disable_posn_compare(QEP_Handle qepHandle)
Disable position compare.
Definition: qep.h:529
_QEP_Obj_
Defines the QEP object.
Definition: qep.h:407
QEP_enable_posn_compare_shadow
void QEP_enable_posn_compare_shadow(QEP_Handle qepHandle)
Enable position compare shadowing.
Definition: qep.h:640
QEP_Swap_Swapped
quad inputs swapped
Definition: qep.h:206
QDLF
direction latch flag
Definition: qep.h:398
QEP_QCAPCTL_UPPS
#define QEP_QCAPCTL_UPPS
unit position event prescaler
Definition: qep.h:108
QEP_Swap_Not_Swapped
quad inputs not swapped
Definition: qep.h:205
QEP_enable_gate_index
void QEP_enable_gate_index(QEP_Handle qepHandle)
Enable gating of index pulse.
Definition: qep.h:606
QEP_QPOSCTL_PCSPW
#define QEP_QPOSCTL_PCSPW
selection position compare sync output pulse width
Definition: qep.h:103
QCAPCTL_Upps_Div_32_Prescale
upevnt = qclk/32
Definition: qep.h:366
QEP_read_posn_index_latch
uint32_t QEP_read_posn_index_latch(QEP_Handle qepHandle)
Reads position counter value index pulse latch register.
Definition: qep.h:754
QCAPCTL_Upps_Div_1_Prescale
upevnt = qclk/1
Definition: qep.h:361
QEP_Xcr_e
QEP_Xcr_e
External clock rate.
Definition: qep.h:195
QEP_Qsp_e
QEP_Qsp_e
Channel S polarity.
Definition: qep.h:243
_QEP_Obj_::QPOSSLAT
uint32_t QPOSSLAT
QEP Strobe Position Latch.
Definition: qep.h:414
QEP_set_posn_init_count
void QEP_set_posn_init_count(QEP_Handle qepHandle, const uint32_t init_count)
Sets initial position counter value.
Definition: qep.h:971
_QEP_Obj_::QUTMR
uint32_t QUTMR
QEP Unit Timer.
Definition: qep.h:416
QEINT_Uto
unit time out interrupt enable
Definition: qep.h:378
cpu.h
Contains public interface to various functions related to the central processing unit (CPU) object...
QEP_Qip_e
QEP_Qip_e
Index polarity.
Definition: qep.h:235
_QEP_Obj_::QWDTMR
uint16_t QWDTMR
QEP Watchdog Timer.
Definition: qep.h:418
_QEP_Obj_::QEINT
uint16_t QEINT
QEP Interrupt Enable Register.
Definition: qep.h:424
QEPCTL_Iel_Falling_Edge
ditto on falling edge of index signal
Definition: qep.h:307
QEP_QDECCTL_QAP
#define QEP_QDECCTL_QAP
QEPA input polarity.
Definition: qep.h:80
QEP_set_capture_period
void QEP_set_capture_period(QEP_Handle qepHandle, const uint16_t period)
Sets capture period.
Definition: qep.h:830
QEP_set_index_event_init
void QEP_set_index_event_init(QEP_Handle qepHandle, const QEPCTL_Iei_e QEPCTL_Iei)
Sets the event which initializes the counter register.
Definition: qep.h:879
QEP_set_QEP_source
void QEP_set_QEP_source(QEP_Handle qepHandle, const QEP_Qsrc_e QEP_Qsrc)
QEP counting mode.
Definition: qep.h:1137
QEPCTL_Qclm_e
QEPCTL_Qclm_e
QEP capture latch mode.
Definition: qep.h:313
QCAPCTL_Ccps_Capture_Div_8
capclk = sysclkout/8
Definition: qep.h:350
QEP_Spsel_Strobe_Pin_Sync_Output
strobe pin for sync output
Definition: qep.h:190
QEP_Qip_Inverted
negates QEPI input
Definition: qep.h:238
_QEP_Obj_::QPOSILAT
uint32_t QPOSILAT
QEP Index Position Latch.
Definition: qep.h:413
QEP_set_B_polarity
void QEP_set_B_polarity(QEP_Handle qepHandle, const QEP_Qbp_e QEP_Qbp)
Sets B polarity.
Definition: qep.h:1124
QEP_QEPCTL_SWI
#define QEP_QEPCTL_SWI
software initialization of position counter
Definition: qep.h:90
QEP_disable_posn_compare_shadow
void QEP_disable_posn_compare_shadow(QEP_Handle qepHandle)
Disable position compare shadowing.
Definition: qep.h:540
QCAPCTL_Upps_Div_128_Prescale
upevnt = qclk/128
Definition: qep.h:368
_QEP_Obj_::QCTMR
uint16_t QCTMR
QEP Capture Timer.
Definition: qep.h:429
QEPCTL_Iei_Rising_Falling_Edge_Init
initializes on falling edge of QEPS signal
Definition: qep.h:283
_QEP_Obj_::QCPRD
uint16_t QCPRD
QEP Capture Period.
Definition: qep.h:430
QEP_Qsp_No_Effect
no effect
Definition: qep.h:245
QEINT_Iel
index event latch interrupt enable
Definition: qep.h:379
_QEP_Obj_::QCLR
uint16_t QCLR
QEP Interrupt Clear Register.
Definition: qep.h:426
QEP_QEPCTL_FREESOFT
#define QEP_QEPCTL_FREESOFT
emulation control bit
Definition: qep.h:86
QEINT_Pce
position counter interrupt enable
Definition: qep.h:388
QEP_enable_unit_timer
void QEP_enable_unit_timer(QEP_Handle qepHandle)
Enable unit timer.
Definition: qep.h:662
QEPCTL_Sel_e
QEPCTL_Sel_e
Strobe event latch of position counter.
Definition: qep.h:296
QEPCTL_Swi_e
QEPCTL_Swi_e
Software initialization of position counter.
Definition: qep.h:288
QEPCTL_Pcrm_Index_Reset
position counter reset on index event
Definition: qep.h:262
QEP_clear_posn_counter
void QEP_clear_posn_counter(QEP_Handle qepHandle)
Clears the position counter.
Definition: qep.h:473
QCAPCTL_Upps_Div_16_Prescale
upevnt = qclk/16
Definition: qep.h:365
QEP_set_strobe_polarity
void QEP_set_strobe_polarity(QEP_Handle qepHandle, const QEP_Qsp_e QEP_Qsp)
Sets up strobe polarity.
Definition: qep.h:1035
QEINT_Wto
position compare watchdog time out interrupt enable
Definition: qep.h:385
FIMF
first index marker flag
Definition: qep.h:401
QCAPCTL_Ccps_Capture_Div_16
capclk = sysclkout/16
Definition: qep.h:351
QEP_Igate_Enable
enable gating of index pulse
Definition: qep.h:214
QEP_set_index_event_latch
void QEP_set_index_event_latch(QEP_Handle qepHandle, const QEPCTL_Iel_e QEPCTL_Iel)
Sets the index event which latches the position counter.
Definition: qep.h:892
QEPCTL_Iel_Rising_Edge
latches position counter on rising edge of index signal
Definition: qep.h:306
_QEP_Obj_::QPOSMAX
uint32_t QPOSMAX
QEP Maximum Position Count.
Definition: qep.h:411
QEP_QEPCTL_PCRM
#define QEP_QEPCTL_PCRM
emulation control bit
Definition: qep.h:87
_QEP_Obj_::QPOSCTL
uint16_t QPOSCTL
QEP Position Compare Control.
Definition: qep.h:423
QEP_Qsrc_Down_Count_Mode
down count mode for frequency measurement (QCLK=XCLK, QDIR=0)
Definition: qep.h:182
QEPCTL_Swi_Nothing
does nothing
Definition: qep.h:290
QEPCTL_Qclm_Latch_on_CPU_Read
latch on position counter read by cpu
Definition: qep.h:315
QEP_Swap_e
QEP_Swap_e
Swap A/B channels.
Definition: qep.h:203
QEP_disable_all_interrupts
void QEP_disable_all_interrupts(QEP_Handle qepHandle)
Disables all interrupts.
Definition: qep.h:484
QCAPCTL_Upps_Div_2048_Prescale
upevnt = qclk/2048
Definition: qep.h:372
QCAPCTL_Upps_Div_512_Prescale
upevnt = qclk/512
Definition: qep.h:370
QEP_set_A_polarity
void QEP_set_A_polarity(QEP_Handle qepHandle, const QEP_Qap_e QEP_Qap)
Sets A polarity.
Definition: qep.h:1111
QEP_Qbp_No_Effect
no effect
Definition: qep.h:229
QEINT_Qpe
quadrature phase error interrupt enable
Definition: qep.h:387
QEP_clear_interrupt_flag
void QEP_clear_interrupt_flag(QEP_Handle qepHandle, const QEINT_e QEINT)
Clears a single interrupt flag.
Definition: qep.h:462
QEPCTL_Iei_Rising_Edge_Init
initializes on rising edge of QEPI signal
Definition: qep.h:282
QEP_set_posn_count_reset_mode
void QEP_set_posn_count_reset_mode(QEP_Handle qepHandle, const QEPCTL_Pcrm_e QEPCTL_Pcrm)
Sets position counter reset mode.
Definition: qep.h:958
_QEP_Obj_::QPOSCMP
uint32_t QPOSCMP
QEP Position Compare.
Definition: qep.h:412
QEP_force_interrupt
void QEP_force_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Manually force QEP interrupt.
Definition: qep.h:685
QEPCTL_Sei_Nothing
does nothing
Definition: qep.h:272
QCAPCTL_Ccps_Capture_Div_1
capclk = sysclkout/1
Definition: qep.h:347
QEINT_Pcr
position compare ready interrupt enable
Definition: qep.h:382
QEP_read_posn_compare
uint32_t QEP_read_posn_compare(QEP_Handle qepHandle)
Reads position compare register.
Definition: qep.h:734
_QEP_Obj_::QFRC
uint16_t QFRC
QEP Interrupt Force Register.
Definition: qep.h:427
QPOSCTL_Pcshdw_e
QPOSCTL_Pcshdw_e
Position compare shadow enable.
Definition: qep.h:321
QEPCTL_Sei_Rising_Falling_Edge_Init
initializes on rising/falling edge of QEPS signal
Definition: qep.h:274
QEPCTL_Iel_Software_Index_Marker
software index marker. See data sheet.
Definition: qep.h:308
QEP_set_capture_latch_mode
void QEP_set_capture_latch_mode(QEP_Handle qepHandle, const QEPCTL_Qclm_e QEPCTL_Qclm)
Sets capture latch mode.
Definition: qep.h:817
QPOSCTL_Pcshdw_Shadow_Enabled
shadow enabled
Definition: qep.h:324
QEP_Qip_No_Effect
no effect
Definition: qep.h:237
_QEP_Obj_::QPOSINIT
uint32_t QPOSINIT
QEP Initialization Position Count.
Definition: qep.h:410
QCAPCTL_Ccps_Capture_Div_4
capclk = sysclkout/4
Definition: qep.h:349
QEPCTL_Freesoft_Immediate_Halt
position, watchdog, unit timer, capture timer stops immediately
Definition: qep.h:253
QEP_enable_posn_compare
void QEP_enable_posn_compare(QEP_Handle qepHandle)
Enable position compare.
Definition: qep.h:629
QEP_Qbp_e
QEP_Qbp_e
Channel B polarity.
Definition: qep.h:227
QEP_read_capture_timer_latch
uint16_t QEP_read_capture_timer_latch(QEP_Handle qepHandle)
Reads timer latch.
Definition: qep.h:713
QEP_clear_all_interrupt_flags
void QEP_clear_all_interrupt_flags(QEP_Handle qepHandle)
Clears all QEP interrupt flags.
Definition: qep.h:450
QEP_Qsrc_Up_Count_Mode
up count mode for frequency measurement (QCLK=XCLK, QDIR=1)
Definition: qep.h:181
QEP_enable_interrupt
void QEP_enable_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Enable individual interrupt.
Definition: qep.h:618
QEPCTL_Pcrm_First_Index_Reset
position counter reset on first index event
Definition: qep.h:264