MotorWare f2806x Driver API Documentation
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
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 {
183 } QEP_Qsrc_e;
184 
187 typedef enum
188 {
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 {
206  QEP_Swap_Swapped=(1 << 10)
207 } QEP_Swap_e;
208 
211 typedef enum
212 {
213  QEP_Igate_Disable=(0 << 9),
215 } QEP_Igate_e;
216 
219 typedef enum
220 {
221  QEP_Qap_No_Effect=(0 << 8),
223 } QEP_Qap_e;
224 
227 typedef enum
228 {
229  QEP_Qbp_No_Effect=(0 << 7),
231 } QEP_Qbp_e;
232 
234 //
235 typedef enum
236 {
237  QEP_Qip_No_Effect=(0 << 6),
239 } QEP_Qip_e;
240 
243 typedef enum
244 {
245  QEP_Qsp_No_Effect=(0 << 5),
247 } QEP_Qsp_e;
248 
251 typedef enum
252 {
257 
260 typedef enum
261 {
266 } QEPCTL_Pcrm_e;
267 
270 typedef enum
271 {
272  QEPCTL_Sei_Nothing=(0 << 10),
275 } QEPCTL_Sei_e;
276 
279 typedef enum
280 {
284 } QEPCTL_Iei_e;
285 
288 typedef enum
289 {
292 } QEPCTL_Swi_e;
293 
296 typedef enum
297 {
300 } QEPCTL_Sel_e;
301 
304 typedef enum
305 {
309 } QEPCTL_Iel_e;
310 
313 typedef enum
314 {
317 } QEPCTL_Qclm_e;
318 
321 typedef enum
322 {
326 
329 typedef enum
330 {
334 
337 typedef enum
338 {
342 
345 typedef enum
346 {
356 
359 typedef enum
360 {
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 
#define QEP_QPOSCTL_PCE
position compare enable/disable
Definition: qep.h:102
Position counter latched on rising edge of QEPS strobe (QPOSSLAT = POSCCNT)
Definition: qep.h:298
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
void QEP_disable_watchdog(QEP_Handle qepHandle)
Disable watchdog timer.
Definition: qep.h:573
uint16_t QFLG
QEP Interrupt Flag Register.
Definition: qep.h:425
direction on the first index marker
Definition: qep.h:396
#define QEP_QDECCTL_SPSEL
sync output pin selection
Definition: qep.h:76
QEP_Spsel_e
Sync output pin selection.
Definition: qep.h:187
void QEP_set_emu_control(QEP_Handle qepHandle, const QEPCTL_Freesoft_e QEPCTL_Freesoft)
Sets emulation control.
Definition: qep.h:853
position compare underflow interrupt enable
Definition: qep.h:384
2x resolution: count the rising/falling edge
Definition: qep.h:197
void QEP_set_watchdog_period(QEP_Handle qepHandle, const uint16_t watchdog_period)
Sets watchdog period.
Definition: qep.h:1099
upevnt = qclk/256
Definition: qep.h:369
void QEP_disable_gate_index(QEP_Handle qepHandle)
Disable gating of index pulse.
Definition: qep.h:506
void QEP_enable_watchdog(QEP_Handle qepHandle)
Enable watchdog timer.
Definition: qep.h:673
void QEP_set_index_polarity(QEP_Handle qepHandle, const QEP_Qip_e QEP_Qip)
Sets index polarity.
Definition: qep.h:905
#define QEP_QPOSCTL_PCLOAD
position compare shadow load mode
Definition: qep.h:100
uint16_t QEP_read_status(QEP_Handle qepHandle)
Reads status register.
Definition: qep.h:784
uint32_t QEP_read_posn_strobe_latch(QEP_Handle qepHandle)
Reads position strobe latch.
Definition: qep.h:774
uint32_t QUPRD
QEP Unit Period.
Definition: qep.h:417
uint16_t QEP_read_interrupt_flag(QEP_Handle qepHandle, const QEINT_e QEINT)
Reads interrupt flag value.
Definition: qep.h:724
quadrature direction change interrupt enable
Definition: qep.h:386
QEPCTL_Freesoft_e
Emulation control bits.
Definition: qep.h:251
position counter reset on max position
Definition: qep.h:263
position, watchdog, unit timer continues until rollover, capture counts until next unit period event ...
Definition: qep.h:254
QEP_qepsts_e
QEP status bits.
Definition: qep.h:393
void QEP_write_posn_compare(QEP_Handle qepHandle, const uint32_t posn)
Writes a value to the position compare register.
Definition: qep.h:1166
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
Strobe event initialization of position counter.
Definition: qep.h:270
#define QEP_QDECCTL_QSP
QEPS input polarity.
Definition: qep.h:83
1x resolution: count the rising edge only
Definition: qep.h:198
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
uint16_t QCAPCTL
QEP Capture Control.
Definition: qep.h:422
position compare match interrupt enable
Definition: qep.h:381
uint16_t QCPRDLAT
QEP Capture Period Latch.
Definition: qep.h:432
initializes on rising edge of QEPS signal
Definition: qep.h:273
uint32_t QEP_read_posn_latch(QEP_Handle qepHandle)
Reads position counter value.
Definition: qep.h:764
void QEP_reset_status(QEP_Handle qepHandle, const QEP_qepsts_e qepsts)
Resets the individual QEP status register bits.
Definition: qep.h:805
capclk = sysclkout/64
Definition: qep.h:353
QEP_Qsrc_e
QEP counting mode.
Definition: qep.h:177
uint32_t QPOSLAT
QEP Position Latch.
Definition: qep.h:415
position compare overflow interrupt enable
Definition: qep.h:383
void QEP_set_unit_period(QEP_Handle qepHandle, const uint32_t unit_period)
Sets unit timer period.
Definition: qep.h:1074
#define QEP_QEPCTL_SEI
strobe event initialization of position counter
Definition: qep.h:88
quadrature direction flag
Definition: qep.h:397
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
#define QEP_QDECCTL_XCR
external clock rate
Definition: qep.h:77
#define QEP_QDECCTL_QBP
QEPB input polarity.
Definition: qep.h:81
QPOSCTL_Pcload_e
Position compare shadow load mode.
Definition: qep.h:329
position counter reset on unit time event
Definition: qep.h:265
struct _QEP_Obj_ * QEP_Handle
Defines the QEP handle.
Definition: qep.h:438
quadrature count mode
Definition: qep.h:179
capture direction error flag
Definition: qep.h:400
position, watchdog, unit timer, capture timer unaffected by emu suspend
Definition: qep.h:255
#define QEP_QCAPCTL_CEN
enable QEP capture
Definition: qep.h:106
upevnt = qclk/4
Definition: qep.h:363
upevnt = qclk/64
Definition: qep.h:367
void QEP_setup_strobe_event_latch(QEP_Handle qepHandle, const QEPCTL_Sel_e QEPCTL_Sel)
QEP strobe latch event.
Definition: qep.h:1152
void QEP_set_capture_prescale(QEP_Handle qepHandle, const QCAPCTL_Ccps_e QCAPCTL_Ccps)
Sets capture pre-scaler.
Definition: qep.h:842
#define QEP_QEPCTL_SEL
strobe event latch of position counter
Definition: qep.h:91
active high pulse output
Definition: qep.h:339
uint16_t QEPCTL
QEP Control.
Definition: qep.h:421
QEPCTL_Pcrm_e
Position counter reset mode.
Definition: qep.h:260
QEP_Qap_e
Channel A polarity.
Definition: qep.h:219
#define QEP_QDECCTL_IGATE
index pulse gating option
Definition: qep.h:79
QPOSCTL_Pcpol_e
Polarity of sync output.
Definition: qep.h:337
upevnt = qclk/8
Definition: qep.h:364
#define QEP_QEPCTL_IEI
index event initialization of position counter
Definition: qep.h:89
void QEP_disable_capture(QEP_Handle qepHandle)
Disable capture.
Definition: qep.h:495
#define QEP_QEPCTL_WDE
watchdog timer enable
Definition: qep.h:96
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
void QEP_set_unit_posn_prescale(QEP_Handle qepHandle, const QCAPCTL_Upps_e QCAPCTL_Upps)
Sets unit timer prescaling.
Definition: qep.h:1086
void QEP_set_ext_clock_rate(QEP_Handle qepHandle, const QEP_Xcr_e QEP_Xcr)
Sets external clock rate.
Definition: qep.h:866
negates QEPB input
Definition: qep.h:230
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
#define QEP_QEPCTL_QPEN
quad position counter enable/software reset
Definition: qep.h:93
QEINT_e
QEP interrupt enable flags.
Definition: qep.h:376
capclk = sysclkout/32
Definition: qep.h:352
#define QEP_QEPCTL_IEL
index event latch of position counter (software index marker)
Definition: qep.h:92
void QEP_disable_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Disable individual interrupt.
Definition: qep.h:518
struct _QEP_Obj_ QEP_Obj
Defines the QEP object.
uint16_t QCTMRLAT
QEP Capture Timer Latch.
Definition: qep.h:431
#define QEP_QPOSCTL_PCSHDW
position compare shadow enable
Definition: qep.h:99
#define QEP_QPOSCTL_PCPOL
load when QPOSCNT = QPOSCMP
Definition: qep.h:101
void QEP_disable_sync_out(QEP_Handle qepHandle)
Disable output sync pulse.
Definition: qep.h:551
load when qposcnt = qposcmp
Definition: qep.h:332
upevnt = qclk/1024
Definition: qep.h:371
capture overflow error flag
Definition: qep.h:399
capclk = sysclkout/128
Definition: qep.h:354
load on qposcnt = 0
Definition: qep.h:331
QEPCTL_Iei_e
Index event initialization of position counter.
Definition: qep.h:279
#define QEP_QDECCTL_QIP
QEPI input polarity.
Definition: qep.h:82
init position counter (QPOSCNT=QPOSINIT)
Definition: qep.h:291
uint32_t QEP_read_posn_count(QEP_Handle qepHandle)
Reads position counter.
Definition: qep.h:744
uint16_t QEPSTS
QEP Status Register.
Definition: qep.h:428
negates QEPA input
Definition: qep.h:222
unit position event flag
Definition: qep.h:395
#define QEP_QDECCTL_SOEN
sync output enable
Definition: qep.h:75
index pin for sync output
Definition: qep.h:189
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
position counter error flag
Definition: qep.h:402
void QEP_enable_capture(QEP_Handle qepHandle)
Enable capture.
Definition: qep.h:584
uint16_t QDECCTL
QEP Decoder Control.
Definition: qep.h:420
#define QEP_QCAPCTL_CCPS
qep capture timer clock prescaler
Definition: qep.h:107
QEP_Igate_e
Index gating.
Definition: qep.h:211
no effect
Definition: qep.h:221
uint16_t QWDPRD
QEP Watchdog Period.
Definition: qep.h:419
void QEP_enable_counter(QEP_Handle qepHandle)
Enable counter.
Definition: qep.h:595
strobe event latch interrupt enable
Definition: qep.h:380
does nothing
Definition: qep.h:281
#define QEP_QDECCTL_QSRC
position counter source selection
Definition: qep.h:74
void QEP_set_max_posn_count(QEP_Handle qepHandle, const uint32_t max_count)
Sets max position count.
Definition: qep.h:918
void QEP_enable_sync_out(QEP_Handle qepHandle)
Enable output sync pulse.
Definition: qep.h:651
direction count mode
Definition: qep.h:180
#define QEP_QEPCTL_QCLM
QEP capture latch mode.
Definition: qep.h:94
disable gating of index pulse
Definition: qep.h:213
negates QEPS input
Definition: qep.h:246
uint16_t QEP_read_capture_period_latch(QEP_Handle qepHandle)
Reads capture period latch.
Definition: qep.h:703
upevnt = qclk/2
Definition: qep.h:362
shadow disabled, load immediate
Definition: qep.h:323
latch on unit time out
Definition: qep.h:316
QEPCTL_Iel_e
Index event latch of position counter (software index marker)
Definition: qep.h:304
QEP_Handle QEP_init(void *pMemory, const size_t numBytes)
Initializes the QEP object.
Definition: qep.c:57
#define QEP_QDECCTL_SWAP
swap quadrature clock inputs
Definition: qep.h:78
uint32_t QPOSCNT
QEP Position Counter.
Definition: qep.h:409
capclk = sysclkout/2
Definition: qep.h:348
QCAPCTL_Upps_e
Unit position event prescaler.
Definition: qep.h:359
QCAPCTL_Ccps_e
QEP capture timer clock prescaler.
Definition: qep.h:345
active low pulse output
Definition: qep.h:340
#define QEP_QEPCTL_UTE
QEP unit timer enable.
Definition: qep.h:95
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
Clockwise: position counter latched on rising edge, counter clockwise: latched on falling edge...
Definition: qep.h:299
void QEP_disable_unit_timer(QEP_Handle qepHandle)
Disable unit timer.
Definition: qep.h:562
void QEP_reset_counter(QEP_Handle qepHandle)
Resets counter.
Definition: qep.h:793
void QEP_disable_posn_compare(QEP_Handle qepHandle)
Disable position compare.
Definition: qep.h:529
Defines the QEP object.
Definition: qep.h:407
void QEP_enable_posn_compare_shadow(QEP_Handle qepHandle)
Enable position compare shadowing.
Definition: qep.h:640
quad inputs swapped
Definition: qep.h:206
direction latch flag
Definition: qep.h:398
#define QEP_QCAPCTL_UPPS
unit position event prescaler
Definition: qep.h:108
quad inputs not swapped
Definition: qep.h:205
void QEP_enable_gate_index(QEP_Handle qepHandle)
Enable gating of index pulse.
Definition: qep.h:606
#define QEP_QPOSCTL_PCSPW
selection position compare sync output pulse width
Definition: qep.h:103
upevnt = qclk/32
Definition: qep.h:366
uint32_t QEP_read_posn_index_latch(QEP_Handle qepHandle)
Reads position counter value index pulse latch register.
Definition: qep.h:754
upevnt = qclk/1
Definition: qep.h:361
QEP_Xcr_e
External clock rate.
Definition: qep.h:195
QEP_Qsp_e
Channel S polarity.
Definition: qep.h:243
uint32_t QPOSSLAT
QEP Strobe Position Latch.
Definition: qep.h:414
void QEP_set_posn_init_count(QEP_Handle qepHandle, const uint32_t init_count)
Sets initial position counter value.
Definition: qep.h:971
uint32_t QUTMR
QEP Unit Timer.
Definition: qep.h:416
unit time out interrupt enable
Definition: qep.h:378
Contains public interface to various functions related to the central processing unit (CPU) object...
QEP_Qip_e
Index polarity.
Definition: qep.h:235
uint16_t QWDTMR
QEP Watchdog Timer.
Definition: qep.h:418
uint16_t QEINT
QEP Interrupt Enable Register.
Definition: qep.h:424
ditto on falling edge of index signal
Definition: qep.h:307
#define QEP_QDECCTL_QAP
QEPA input polarity.
Definition: qep.h:80
void QEP_set_capture_period(QEP_Handle qepHandle, const uint16_t period)
Sets capture period.
Definition: qep.h:830
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
void QEP_set_QEP_source(QEP_Handle qepHandle, const QEP_Qsrc_e QEP_Qsrc)
QEP counting mode.
Definition: qep.h:1137
QEPCTL_Qclm_e
QEP capture latch mode.
Definition: qep.h:313
capclk = sysclkout/8
Definition: qep.h:350
strobe pin for sync output
Definition: qep.h:190
negates QEPI input
Definition: qep.h:238
uint32_t QPOSILAT
QEP Index Position Latch.
Definition: qep.h:413
void QEP_set_B_polarity(QEP_Handle qepHandle, const QEP_Qbp_e QEP_Qbp)
Sets B polarity.
Definition: qep.h:1124
#define QEP_QEPCTL_SWI
software initialization of position counter
Definition: qep.h:90
void QEP_disable_posn_compare_shadow(QEP_Handle qepHandle)
Disable position compare shadowing.
Definition: qep.h:540
upevnt = qclk/128
Definition: qep.h:368
uint16_t QCTMR
QEP Capture Timer.
Definition: qep.h:429
initializes on falling edge of QEPS signal
Definition: qep.h:283
uint16_t QCPRD
QEP Capture Period.
Definition: qep.h:430
no effect
Definition: qep.h:245
index event latch interrupt enable
Definition: qep.h:379
uint16_t QCLR
QEP Interrupt Clear Register.
Definition: qep.h:426
#define QEP_QEPCTL_FREESOFT
emulation control bit
Definition: qep.h:86
position counter interrupt enable
Definition: qep.h:388
void QEP_enable_unit_timer(QEP_Handle qepHandle)
Enable unit timer.
Definition: qep.h:662
QEPCTL_Sel_e
Strobe event latch of position counter.
Definition: qep.h:296
QEPCTL_Swi_e
Software initialization of position counter.
Definition: qep.h:288
position counter reset on index event
Definition: qep.h:262
void QEP_clear_posn_counter(QEP_Handle qepHandle)
Clears the position counter.
Definition: qep.h:473
upevnt = qclk/16
Definition: qep.h:365
void QEP_set_strobe_polarity(QEP_Handle qepHandle, const QEP_Qsp_e QEP_Qsp)
Sets up strobe polarity.
Definition: qep.h:1035
position compare watchdog time out interrupt enable
Definition: qep.h:385
first index marker flag
Definition: qep.h:401
capclk = sysclkout/16
Definition: qep.h:351
enable gating of index pulse
Definition: qep.h:214
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
latches position counter on rising edge of index signal
Definition: qep.h:306
uint32_t QPOSMAX
QEP Maximum Position Count.
Definition: qep.h:411
#define QEP_QEPCTL_PCRM
emulation control bit
Definition: qep.h:87
uint16_t QPOSCTL
QEP Position Compare Control.
Definition: qep.h:423
down count mode for frequency measurement (QCLK=XCLK, QDIR=0)
Definition: qep.h:182
does nothing
Definition: qep.h:290
latch on position counter read by cpu
Definition: qep.h:315
QEP_Swap_e
Swap A/B channels.
Definition: qep.h:203
void QEP_disable_all_interrupts(QEP_Handle qepHandle)
Disables all interrupts.
Definition: qep.h:484
upevnt = qclk/2048
Definition: qep.h:372
upevnt = qclk/512
Definition: qep.h:370
void QEP_set_A_polarity(QEP_Handle qepHandle, const QEP_Qap_e QEP_Qap)
Sets A polarity.
Definition: qep.h:1111
no effect
Definition: qep.h:229
quadrature phase error interrupt enable
Definition: qep.h:387
void QEP_clear_interrupt_flag(QEP_Handle qepHandle, const QEINT_e QEINT)
Clears a single interrupt flag.
Definition: qep.h:462
initializes on rising edge of QEPI signal
Definition: qep.h:282
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
uint32_t QPOSCMP
QEP Position Compare.
Definition: qep.h:412
void QEP_force_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Manually force QEP interrupt.
Definition: qep.h:685
does nothing
Definition: qep.h:272
capclk = sysclkout/1
Definition: qep.h:347
position compare ready interrupt enable
Definition: qep.h:382
uint32_t QEP_read_posn_compare(QEP_Handle qepHandle)
Reads position compare register.
Definition: qep.h:734
uint16_t QFRC
QEP Interrupt Force Register.
Definition: qep.h:427
QPOSCTL_Pcshdw_e
Position compare shadow enable.
Definition: qep.h:321
initializes on rising/falling edge of QEPS signal
Definition: qep.h:274
software index marker. See data sheet.
Definition: qep.h:308
void QEP_set_capture_latch_mode(QEP_Handle qepHandle, const QEPCTL_Qclm_e QEPCTL_Qclm)
Sets capture latch mode.
Definition: qep.h:817
shadow enabled
Definition: qep.h:324
no effect
Definition: qep.h:237
uint32_t QPOSINIT
QEP Initialization Position Count.
Definition: qep.h:410
capclk = sysclkout/4
Definition: qep.h:349
position, watchdog, unit timer, capture timer stops immediately
Definition: qep.h:253
void QEP_enable_posn_compare(QEP_Handle qepHandle)
Enable position compare.
Definition: qep.h:629
QEP_Qbp_e
Channel B polarity.
Definition: qep.h:227
uint16_t QEP_read_capture_timer_latch(QEP_Handle qepHandle)
Reads timer latch.
Definition: qep.h:713
void QEP_clear_all_interrupt_flags(QEP_Handle qepHandle)
Clears all QEP interrupt flags.
Definition: qep.h:450
up count mode for frequency measurement (QCLK=XCLK, QDIR=1)
Definition: qep.h:181
void QEP_enable_interrupt(QEP_Handle qepHandle, const QEINT_e QEINT)
Enable individual interrupt.
Definition: qep.h:618
position counter reset on first index event
Definition: qep.h:264