R2R
|
Encoder header. More...
Go to the source code of this file.
Functions | |
void | encoderSPIInit (void) |
Initializes the SPI channels for the motor drivers, encoders, and RAM. More... | |
void | encoderRead (void) |
Updates value in sensor array. More... | |
void | resetMotor1RawRelative (void) |
Resets the relative counts on encoder 1. More... | |
void | resetMotor2RawRelative (void) |
Resets the relative counts on encoder 2. More... | |
void | zeroMotor1RawRelative (void) |
Reads value of motor 1 encoders and sets the relative angle to zero. More... | |
void | zeroMotor2RawRelative (void) |
Reads value of motor 2 encoders and sets the relative angle to zero. More... | |
float | readMotor1Angle (void) |
Reads value in encoderVal array for motor 1 and converts it to an angle. More... | |
float | readMotor2Angle (void) |
Reads value in encoderVal array for motor 2 and converts it to an angle. More... | |
int | readMotor1Raw (void) |
Reads value in encoderVal array for motor 1. More... | |
int | readMotor2Raw (void) |
Reads value in encoderVal array for motor 2. More... | |
int | readMotor1RawRelative (void) |
Reads value in encoderVal array for motor 1 and keeps track of multiturn counts. More... | |
int | readMotor2RawRelative (void) |
Reads value in encoderVal array for motor 2 and keeps track of multiturn counts. More... | |
float | readMotor1AngleRelative (void) |
Reads value in encoderVal array for motor 1 and keeps track of multiturn angles. More... | |
float | readMotor2AngleRelative (void) |
Reads value in encoderVal array for motor 2 and keeps track of multiturn angles. More... | |
Encoder header.
TThis file contains functions for initializing and reading from encoders.
void encoderRead | ( | void | ) |
Updates value in sensor array.
This function sends a 't' and 40 pulses via SPI to the encoder and reads out the encoder's reply to the encoderVal array
Void |
This function reads both encoder counts and stores them in an array
Comes after: spiInit();
Writes to: encoderVal array
void encoderSPIInit | ( | void | ) |
Initializes the SPI channels for the motor drivers, encoders, and RAM.
Initializes SSI1 ~ 4 and their corresponding GPIO pins
Void |
float readMotor1Angle | ( | void | ) |
Reads value in encoderVal array for motor 1 and converts it to an angle.
Void |
float readMotor1AngleRelative | ( | void | ) |
Reads value in encoderVal array for motor 1 and keeps track of multiturn angles.
This function reads out the angle and keeps track of it for multiple turns.
Void |
int readMotor1Raw | ( | void | ) |
Reads value in encoderVal array for motor 1.
The range for the read angle is 0 to 16383
Void |
int readMotor1RawRelative | ( | void | ) |
Reads value in encoderVal array for motor 1 and keeps track of multiturn counts.
This function reads out the angle and keeps track of it for multiple turns. The value ranges from -2,147,483,648 to 2,147,483,648. Each turn is 16383 counts
Void |
float readMotor2Angle | ( | void | ) |
Reads value in encoderVal array for motor 2 and converts it to an angle.
Void |
float readMotor2AngleRelative | ( | void | ) |
Reads value in encoderVal array for motor 2 and keeps track of multiturn angles.
This function reads out the angle and keeps track of it for multiple turns.
Void |
int readMotor2Raw | ( | void | ) |
Reads value in encoderVal array for motor 2.
The range for the read angle is 0 to 16383
Void |
int readMotor2RawRelative | ( | void | ) |
Reads value in encoderVal array for motor 2 and keeps track of multiturn counts.
This function reads out the angle and keeps track of it for multiple turns. The value ranges from -2,147,483,648 to 2,147,483,648
Void |
void resetMotor1RawRelative | ( | void | ) |
Resets the relative counts on encoder 1.
Void |
void resetMotor2RawRelative | ( | void | ) |
Resets the relative counts on encoder 2.
Void |
void zeroMotor1RawRelative | ( | void | ) |
Reads value of motor 1 encoders and sets the relative angle to zero.
Void |
void zeroMotor2RawRelative | ( | void | ) |
Reads value of motor 2 encoders and sets the relative angle to zero.
Void |