]> begriffs open source - cmsis-freertos/blob - Demo/CORTEX_LM3S811_GCC/hw_include/qei.h
Initial commit
[cmsis-freertos] / Demo / CORTEX_LM3S811_GCC / hw_include / qei.h
1 //*****************************************************************************
2 //
3 // qei.h - Prototypes for the Quadrature Encoder Driver.
4 //
5 // Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
6 //
7 // Software License Agreement
8 //
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
10 // exclusively on LMI's Stellaris Family of microcontroller products.
11 //
12 // The software is owned by LMI and/or its suppliers, and is protected under
13 // applicable copyright laws.  All rights are reserved.  Any use in violation
14 // of the foregoing restrictions may subject the user to criminal sanctions
15 // under applicable laws, as well as to civil liability for the breach of the
16 // terms and conditions of this license.
17 //
18 // THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23 //
24 // This is part of revision 991 of the Stellaris Driver Library.
25 //
26 //*****************************************************************************
27
28 #ifndef __QEI_H__
29 #define __QEI_H__
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 //*****************************************************************************
37 //
38 // Values that can be passed to QEIConfigure as the ulConfig paramater.
39 //
40 //*****************************************************************************
41 #define QEI_CONFIG_CAPTURE_A    0x00000000  // Count on ChA edges only
42 #define QEI_CONFIG_CAPTURE_A_B  0x00000008  // Count on ChA and ChB edges
43 #define QEI_CONFIG_NO_RESET     0x00000000  // Do not reset on index pulse
44 #define QEI_CONFIG_RESET_IDX    0x00000010  // Reset position on index pulse
45 #define QEI_CONFIG_QUADRATURE   0x00000000  // ChA and ChB are quadrature
46 #define QEI_CONFIG_CLOCK_DIR    0x00000004  // ChA and ChB are clock and dir
47 #define QEI_CONFIG_NO_SWAP      0x00000000  // Do not swap ChA and ChB
48 #define QEI_CONFIG_SWAP         0x00000002  // Swap ChA and ChB
49
50 //*****************************************************************************
51 //
52 // Values that can be passed to QEIVelocityConfigure as the ulPreDiv parameter.
53 //
54 //*****************************************************************************
55 #define QEI_VELDIV_1            0x00000000  // Predivide by 1
56 #define QEI_VELDIV_2            0x00000040  // Predivide by 2
57 #define QEI_VELDIV_4            0x00000080  // Predivide by 4
58 #define QEI_VELDIV_8            0x000000C0  // Predivide by 8
59 #define QEI_VELDIV_16           0x00000100  // Predivide by 16
60 #define QEI_VELDIV_32           0x00000140  // Predivide by 32
61 #define QEI_VELDIV_64           0x00000180  // Predivide by 64
62 #define QEI_VELDIV_128          0x000001C0  // Predivide by 128
63
64 //*****************************************************************************
65 //
66 // Values that can be passed to QEIEnableInts, QEIDisableInts, and QEIClearInts
67 // as the ulIntFlags parameter, and returned by QEIGetIntStatus.
68 //
69 //*****************************************************************************
70 #define QEI_INTERROR            0x00000008  // Phase error detected
71 #define QEI_INTDIR              0x00000004  // Direction change
72 #define QEI_INTTIMER            0x00000002  // Velocity timer expired
73 #define QEI_INTINDEX            0x00000001  // Index pulse detected
74
75 //*****************************************************************************
76 //
77 // Prototypes for the APIs.
78 //
79 //*****************************************************************************
80 extern void QEIEnable(unsigned long ulBase);
81 extern void QEIDisable(unsigned long ulBase);
82 extern void QEIConfigure(unsigned long ulBase, unsigned long ulConfig,
83                          unsigned long ulMaxPosition);
84 extern unsigned long QEIPositionGet(unsigned long ulBase);
85 extern void QEIPositionSet(unsigned long ulBase, unsigned long ulPosition);
86 extern long QEIDirectionGet(unsigned long ulBase);
87 extern tBoolean QEIErrorGet(unsigned long ulBase);
88 extern void QEIVelocityEnable(unsigned long ulBase);
89 extern void QEIVelocityDisable(unsigned long ulBase);
90 extern void QEIVelocityConfigure(unsigned long ulBase, unsigned long ulPreDiv,
91                                  unsigned long ulPeriod);
92 extern unsigned long QEIVelocityGet(unsigned long ulBase);
93 extern void QEIIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
94 extern void QEIIntUnregister(unsigned long ulBase);
95 extern void QEIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
96 extern void QEIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
97 extern unsigned long QEIIntStatus(unsigned long ulBase, tBoolean bMasked);
98 extern void QEIIntClear(unsigned long ulBase, unsigned long ulIntFlags);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif // __QEI_H__