qep.c File Reference
#include "qep.h"
#include "cpu.h"
Go to the source code of this file.
Functions |
void | InitQEP1 (void(*interruptFCN)(void), Uint16 qep_us, PCRM pcrm, Uint16 lines, Uint16 polePairs) |
void | InitQEP2 (void(*interruptFCN)(void), Uint16 qep_us, PCRM pcrm, Uint16 lines, Uint16 polePairs) |
static void | StoreQEPConf (volatile struct QEP *qep, volatile struct EQEP_REGS *eQEPRegs, Uint16 lines, Uint16 polePairs) |
static void | ConfigureEQEP (volatile struct EQEP_REGS *eQEPRegs, void(*interruptFCN)(void), Uint32 qUPRD, PCRM pcrm, Uint32 qPOSMAX) |
void | InitEQep1Gpio (void) |
| Init GPIO ports as needed for encoder connection QEP1 (GPIO20, GPIO21, GPIO23).
|
void | InitEQep2Gpio (void) |
| Init GPIO ports as needed for encoder connection QEP2 (GPIO24, GPIO25, GPIO26).
|
void | ConfigureQEP1 (void(*interruptFCN)(void), Uint16 qep_us, PCRM pcrm, Uint16 lines, Uint16 polePairs) |
void | ConfigureQEP2 (void(*interruptFCN)(void), Uint16 qep_us, PCRM pcrm, Uint16 lines, Uint16 polePairs) |
void | SwapDirection (volatile struct QEP *qep) |
Variables |
struct QEP | qep1 |
struct QEP | qep2 |
Function Documentation
static void ConfigureEQEP |
( |
volatile struct EQEP_REGS * |
eQEPRegs, |
|
|
void(*)(void) |
interruptFCN, |
|
|
Uint32 |
qUPRD, |
|
|
PCRM |
pcrm, |
|
|
Uint32 |
qPOSMAX | |
|
) |
| | [inline, static] |
void ConfigureQEP1 |
( |
void(*)(void) |
interruptFCN, |
|
|
Uint16 |
qep_us, |
|
|
PCRM |
pcrm, |
|
|
Uint16 |
lines, |
|
|
Uint16 |
polePairs | |
|
) |
| | |
Initialize encoder reading (QEP1)
- Parameters:
-
| interruptFCN | function to be called each qep_us |
| qep_us | unit timer |
| pcrm | position counter reset mode (PCRM_IE/PCRM_MAX_POS/PCRM_FIE/PCRM_UTE) |
| lines | encoder lines |
| polePairs | machine pole pairs |
- Examples:
- TIMotorLIBExampleHrdw/main.c, and TIMotorLIBExampleSw/main.c.
Definition at line 53 of file qep.c.
void ConfigureQEP2 |
( |
void(*)(void) |
interruptFCN, |
|
|
Uint16 |
qep_us, |
|
|
PCRM |
pcrm, |
|
|
Uint16 |
lines, |
|
|
Uint16 |
polePairs | |
|
) |
| | |
Initialize encoder reading (QEP2)
- Parameters:
-
| interruptFCN | function to be called each qep_us |
| qep_us | unit timer |
| pcrm | position counter reset mode |
| lines | encoder lines |
| polePairs | machine pole pairs |
Definition at line 73 of file qep.c.
void InitEQep1Gpio |
( |
void |
|
) |
|
Init GPIO ports as needed for encoder connection QEP1 (GPIO20, GPIO21, GPIO23).
Definition at line 154 of file qep.c.
void InitEQep2Gpio |
( |
void |
|
) |
|
Init GPIO ports as needed for encoder connection QEP2 (GPIO24, GPIO25, GPIO26).
Definition at line 163 of file qep.c.
void InitQEP1 |
( |
void(*)(void) |
interruptFCN, |
|
|
Uint16 |
qep_us, |
|
|
PCRM |
pcrm, |
|
|
Uint16 |
lines, |
|
|
Uint16 |
polePairs | |
|
) |
| | |
void InitQEP2 |
( |
void(*)(void) |
interruptFCN, |
|
|
Uint16 |
qep_us, |
|
|
PCRM |
pcrm, |
|
|
Uint16 |
lines, |
|
|
Uint16 |
polePairs | |
|
) |
| | |
static void StoreQEPConf |
( |
volatile struct QEP * |
qep, |
|
|
volatile struct EQEP_REGS * |
eQEPRegs, |
|
|
Uint16 |
lines, |
|
|
Uint16 |
polePairs | |
|
) |
| | [inline, static] |
Definition at line 94 of file qep.c.
void SwapDirection |
( |
volatile struct QEP * |
qep |
) |
|
Swaps direction of positive counting
- Parameters:
-
| pointer | to qep unit (qep1/qep2) |
Definition at line 172 of file qep.c.
Variable Documentation
Definition at line 32 of file qep.c.
Definition at line 33 of file qep.c.