Encoder Routines. More...
#include "TIMotorLIB.h"
#include "FilterAndRotations.h"
#include "Utils.h"
Go to the source code of this file.
Data Structures | |
struct | QEP |
struct used for storing QEP configuration More... | |
Enumerations | |
enum | PCRM { PCRM_IE, PCRM_MAX_POS, PCRM_FIE, PCRM_UTE } |
select position counter reset mode More... | |
Functions | |
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 | 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 | SwapDirection (volatile struct QEP *qep) |
static void | QEP1VelocityAndPosition (void) |
static void | QEP2VelocityAndPosition (void) |
static void | QEPVelocityAndPosition (Uint16 newPos, Uint16 oldPos, Uint16 direction, volatile struct QEP *qep) |
static void | EnableQEP (volatile struct QEP *qep) |
static void | EnableQEP1 (void) |
Enable QEP1 interface. | |
static void | EnableQEP2 (void) |
Enable QEP2 interface. | |
static void | EqepPIEAck (volatile struct EQEP_REGS *eQEPRegs) |
static void | Eqep1PIEAck (void) |
static void | Eqep2PIEAck (void) |
Variables | |
struct QEP | qep1 |
struct QEP | qep2 |
Encoder Routines.
File Name : qep.h Project : TIMotorLIB
TI Doc: SPRU790
This unit allows to program the encoder interface and calculates the actual position and velocity optimized for high speed (count units each unit timer interrupt).
Definition in file qep.h.
enum PCRM |
void ConfigureQEP1 | ( | void(*)(void) | interruptFCN, | |
Uint16 | qep_us, | |||
PCRM | pcrm, | |||
Uint16 | lines, | |||
Uint16 | polePairs | |||
) |
void ConfigureQEP2 | ( | void(*)(void) | interruptFCN, | |
Uint16 | qep_us, | |||
PCRM | pcrm, | |||
Uint16 | lines, | |||
Uint16 | polePairs | |||
) |
static void EnableQEP | ( | volatile struct QEP * | qep | ) | [inline, static] |
static void EnableQEP1 | ( | void | ) | [inline, static] |
Enable QEP1 interface.
static void EnableQEP2 | ( | void | ) | [inline, static] |
static void Eqep1PIEAck | ( | void | ) | [inline, static] |
ACK unit timer interrupt for EQEP1. This function MUST be called if more interrupts from PIEACK_GROUP5 are wanted
static void Eqep2PIEAck | ( | void | ) | [inline, static] |
static void EqepPIEAck | ( | volatile struct EQEP_REGS * | eQEPRegs | ) | [inline, static] |
void InitEQep1Gpio | ( | void | ) |
Init GPIO ports as needed for encoder connection QEP1 (GPIO20, GPIO21, GPIO23).
Definition at line 151 of file Copia de qep.c.
void InitEQep2Gpio | ( | void | ) |
Init GPIO ports as needed for encoder connection QEP2 (GPIO24, GPIO25, GPIO26).
Definition at line 189 of file Copia de qep.c.
static void QEP1VelocityAndPosition | ( | void | ) | [inline, static] |
Calculate position and velocity from encoder readings QEP1:
static void QEP2VelocityAndPosition | ( | void | ) | [inline, static] |
Calculate position and velocity from encoder readings QEP2:
static void QEPVelocityAndPosition | ( | Uint16 | newPos, | |
Uint16 | oldPos, | |||
Uint16 | direction, | |||
volatile struct QEP * | qep | |||
) | [inline, static] |
Internal function for calculation of velocity and position. It is called in QEPxVelocityAndPosition.
newPos | position in current sample time from QPOSLAT | |
oldPos | position stored in lastPos: |
direction | direction of counting (0:down, 1:up) | |
qep | pointer to configuration struct for encoder device |
void SwapDirection | ( | volatile struct QEP * | qep | ) |
Definition at line 32 of file Copia de qep.c.
Definition at line 33 of file Copia de qep.c.