Motor port driver, macros and prototypes. More...
Go to the source code of this file.
Data Structures | |
struct | _vexMotor |
Holds data for a motor. More... | |
Macros | |
#define | kVexMotorNormal FALSE |
Motor command causes normal movement. More... | |
#define | kVexMotorReversed TRUE |
Motor command causes reversed movement. More... | |
Typedefs | |
typedef struct _vexMotor | vexMotor |
Holds data for a motor. More... | |
Enumerations | |
enum | tVexMotorType { kVexMotorUndefined = 0, kVexMotor269, kVexMotor393T, kVexMotor393S } |
Motor types. More... | |
enum | tVexMotor { kVexMotor_None = -1, kVexMotor_1 = 0, kVexMotor_2 = 1, kVexMotor_3 = 2, kVexMotor_4 = 3, kVexMotor_5 = 4, kVexMotor_6 = 5, kVexMotor_7 = 6, kVexMotor_8 = 7, kVexMotor_9 = 8, kVexMotor_10 = 9, kVexMotorNum } |
Motor port numbers. More... | |
Functions | |
void | vexMotorInit (void) |
Initialize the motors. More... | |
void | vexMotorSet (int16_t index, int16_t value) |
Set motor to speed given by value. More... | |
int16_t | vexMotorGet (int16_t index) |
Get the current commanded speed of a motor. More... | |
void | vexMotorStopAll (void) |
Stop all motors. More... | |
void | vexMotorTypeSet (int16_t index, tVexMotorType type) |
Save motor type. More... | |
tVexMotorType | vexMotorTypeGet (int16_t index) |
Get motor type. More... | |
void | vexMotorDirectionSet (int16_t index, bool_t reversed) |
Save motor direction (reversed) flag. More... | |
bool_t | vexMotorDirectionGet (int16_t index) |
Get motor reversed flag. More... | |
void | vexMotorDebug (vexStream *chp, int argc, char *argv[]) |
Command line debug of motors. More... | |
void | vexMotorPositionSet (int16_t index, int32_t value) |
Set the current motor position. More... | |
int32_t | vexMotorPositionGet (int16_t index) |
Get the current motor position. More... | |
void | vexMotorPositionGetCallback (int16_t index, int32_t(*cb)(int16_t), int16_t port) |
Set the callback used to get motor position. More... | |
void | vexMotorPositionSetCallback (int16_t index, void(*cb)(int16_t, int32_t), int16_t port) |
Set the callback used to set motor position. More... | |
void | vexMotorEncoderIdCallback (int16_t index, int16_t(*cb)(int16_t), int16_t port) |
Set the callback used to get motor position. More... | |
int16_t | vexMotorEncoderIdGet (int16_t index) |
Get the motor encoder id. More... | |
Motor port driver, macros and prototypes.
#define kVexMotorNormal FALSE |
Motor command causes normal movement.
#define kVexMotorReversed TRUE |
Motor command causes reversed movement.
enum tVexMotorType |
enum tVexMotor |
void vexMotorInit | ( | void | ) |
Initialize the motors.
void vexMotorSet | ( | int16_t | index, |
int16_t | value | ||
) |
Set motor to speed given by value.
[in] | index | The motor index |
[in] | value | The speed of the motor (-127 to 127) |
int16_t vexMotorGet | ( | int16_t | index) |
Get the current commanded speed of a motor.
[in] | index | The motor index |
void vexMotorStopAll | ( | void | ) |
Stop all motors.
void vexMotorTypeSet | ( | int16_t | index, |
tVexMotorType | type | ||
) |
Save motor type.
[in] | index | The motor index |
[in] | type | The motor type |
tVexMotorType vexMotorTypeGet | ( | int16_t | index) |
Get motor type.
[in] | index | The motor index |
void vexMotorDirectionSet | ( | int16_t | index, |
bool_t | reversed | ||
) |
Save motor direction (reversed) flag.
[in] | index | The motor index |
[in] | reversed | Flag indicating if the motor is reversed |
bool_t vexMotorDirectionGet | ( | int16_t | index) |
Get motor reversed flag.
[in] | index | The motor index |
void vexMotorDebug | ( | vexStream * | chp, |
int | argc, | ||
char * | argv[] | ||
) |
Command line debug of motors.
[in] | chp | A pointer to a vexStream object |
[in] | argc | The number of command line arguments |
[in] | argv | An array of pointers to the command line args |
void vexMotorPositionSet | ( | int16_t | index, |
int32_t | value | ||
) |
Set the current motor position.
[in] | index | The motor index |
[in] | value | The new motor position |
int32_t vexMotorPositionGet | ( | int16_t | index) |
Get the current motor position.
[in] | index | The motor index |
void vexMotorPositionGetCallback | ( | int16_t | index, |
int32_t(*)(int16_t) | cb, | ||
int16_t | port | ||
) |
Set the callback used to get motor position.
[in] | index | The motor index |
[in] | cb | function used to get motor position |
[in] | port | A variable to send to the callback |
void vexMotorPositionSetCallback | ( | int16_t | index, |
void(*)(int16_t, int32_t) | cb, | ||
int16_t | port | ||
) |
Set the callback used to set motor position.
[in] | index | The motor index |
[in] | cb | function used to get motor position |
[in] | port | A variable to send to the callback |
void vexMotorEncoderIdCallback | ( | int16_t | index, |
int16_t(*)(int16_t) | cb, | ||
int16_t | port | ||
) |
Set the callback used to get motor position.
[in] | index | The motor index |
[in] | cb | function used to get motor encoder id |
[in] | port | A variable to send to the callback |
int16_t vexMotorEncoderIdGet | ( | int16_t | index) |
Get the motor encoder id.
[in] | index | The motor index |