Motor port driver.
More...
#include <stdlib.h>
#include "ch.h"
#include "hal.h"
#include "vex.h"
|
| void | vexMotorInit () |
| | 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 () |
| | 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 | 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...
|
| |
| void | vexMotorDebug (vexStream *chp, int argc, char *argv[]) |
| | Command line debug of motors. More...
|
| |
| void vexMotorInit |
( |
void |
) | |
|
| void vexMotorSet |
( |
int16_t |
index, |
|
|
int16_t |
value |
|
) |
| |
Set motor to speed given by value.
- Parameters
-
| [in] | index | The motor index |
| [in] | value | The speed of the motor (-127 to 127) |
- Examples:
- vexdefault.c.
| int16_t vexMotorGet |
( |
int16_t |
index) | |
|
Get the current commanded speed of a motor.
- Parameters
-
- Returns
- The speed of the indexed motor (-127 to 127)
| void vexMotorStopAll |
( |
void |
) | |
|
Save motor type.
- Parameters
-
| [in] | index | The motor index |
| [in] | type | The motor type |
Get motor type.
- Parameters
-
- Returns
- The motor type
| void vexMotorDirectionSet |
( |
int16_t |
index, |
|
|
bool_t |
reversed |
|
) |
| |
Save motor direction (reversed) flag.
- Parameters
-
| [in] | index | The motor index |
| [in] | reversed | Flag indicating if the motor is reversed |
- Examples:
- vexdefault.c.
| bool_t vexMotorDirectionGet |
( |
int16_t |
index) | |
|
Get motor reversed flag.
- Parameters
-
- Returns
- bool indicating if the motor is reversed
| void vexMotorPositionSet |
( |
int16_t |
index, |
|
|
int32_t |
value |
|
) |
| |
Set the current motor position.
- Parameters
-
| [in] | index | The motor index |
| [in] | value | The new motor position |
- Examples:
- clawbot.c.
| int32_t vexMotorPositionGet |
( |
int16_t |
index) | |
|
Get the current motor position.
- Parameters
-
- Returns
- The motor position
- Examples:
- clawbot.c.
| void vexMotorPositionGetCallback |
( |
int16_t |
index, |
|
|
int32_t(*)(int16_t) |
cb, |
|
|
int16_t |
port |
|
) |
| |
Set the callback used to get motor position.
- Parameters
-
| [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.
- Parameters
-
| [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.
- Parameters
-
| [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.
- Parameters
-
- Returns
- The motor encoder id
- Note
- The encoder id is used to differentiate between encoder types
| void vexMotorDebug |
( |
vexStream * |
chp, |
|
|
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Command line debug of motors.
- Parameters
-
| [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 |