SPI communication to the master processor. More...
Macros | |
#define | SPI_BATTERY_SCALE 59 |
Scale factor for getting battery level in mV. More... | |
Functions | |
void | vexSpiInit () |
Init the SPI communication to the master processor. More... | |
void | vexSpiTeamnameSet (char *name) |
Set the team name. More... | |
short | vexSpiGetOnlineStatus () |
We use presence of js_1 as indication of good joystick data. More... | |
jsdata * | vexSpiGetJoystickDataPtr (int16_t index) |
return a pointer to a raw joystick data structure More... | |
uint16_t | vexSpiGetControl () |
Get competition and status word. More... | |
uint16_t | vexSpiGetMainBattery () |
Get main battery level. More... | |
uint16_t | vexSpiGetBackupBattery () |
Get backup battery level. More... | |
void | vexSpiSetMotor (int16_t index, int16_t data, bool_t reversed) |
Set motor value in the SPI tx data array. More... | |
void | vexSpiTickDelay (int16_t tick) |
Pause for exactly tick uS. More... | |
void | vexSpiSend () |
Send/receive one message with the master processor. More... | |
void | vexSpiDebug (vexStream *chp, int argc, char *argv[]) |
Debug function to dump SPI buffers. More... | |
SPI communication to the master processor.
#define SPI_BATTERY_SCALE 59 |
Scale factor for getting battery level in mV.
void vexSpiInit | ( | void | ) |
Init the SPI communication to the master processor.
void vexSpiTeamnameSet | ( | char * | name) |
Set the team name.
[in] | name | pointer to string |
short vexSpiGetOnlineStatus | ( | void | ) |
We use presence of js_1 as indication of good joystick data.
1 | = online |
0 | = offline |
jsdata* vexSpiGetJoystickDataPtr | ( | int16_t | index) |
return a pointer to a raw joystick data structure
[in] | index | Which joystick to use, 1 or 2 |
uint16_t vexSpiGetControl | ( | void | ) |
Get competition and status word.
uint16_t vexSpiGetMainBattery | ( | void | ) |
Get main battery level.
uint16_t vexSpiGetBackupBattery | ( | void | ) |
Get backup battery level.
void vexSpiSetMotor | ( | int16_t | index, |
int16_t | data, | ||
bool_t | reversed | ||
) |
Set motor value in the SPI tx data array.
[in] | index | The index of the motor, range is 0 through 7 |
[in] | data | The motor command data in the range +/- 127 |
[in] | reversed | A flag indicating the motor data is reversed |
This function is used to set the data for one of the 3 wire motor ports on the master processor. These correspond to cortex ports 2 through 9 but are indexed here as ports 0 through 7
void vexSpiTickDelay | ( | int16_t | tick) |
Pause for exactly tick uS.
[in] | tick | The delay in uS |
void vexSpiSend | ( | void | ) |
Send/receive one message with the master processor.
This implementation is based on the EasyC code but with the loop delays/ replaced with the use of a timer so compiler optimization can be used. Timing was then changed so there is really not much resemblance to the original code.
void vexSpiDebug | ( | vexStream * | chp, |
int | argc, | ||
char * | argv[] | ||
) |
Debug function to dump SPI buffers.
[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 |