![]() |
SPI communication to the master processor, macros and prototypes. More...
Go to the source code of this file.
Data Structures | |
| struct | _jsdata |
| joystick data structure More... | |
| union | _spiTxPacket |
| SPI transmit data packet. More... | |
| struct | _spiTxPacket::_spiTxPak |
| union | _spiRxPacket |
| SPI receive data packet. More... | |
| struct | _spiRxPacket::_spiRxPak |
| struct | _SpiData |
| SPI data. More... | |
Macros | |
| #define | CONVEX_TEAM_NAME "CONVEX "; |
| default team name More... | |
| #define | vexTeamnameSet(name) vexSpiTeamnameSet( name ) |
Typedefs | |
| typedef struct _jsdata | jsdata |
| joystick data structure More... | |
| typedef union _spiTxPacket | spiTxPacket |
| SPI transmit data packet. More... | |
| typedef union _spiRxPacket | spiRxPacket |
| SPI receive data packet. More... | |
| typedef struct _SpiData | SpiData |
| SPI data. More... | |
Functions | |
| void | vexSpiInit (void) |
| Init the SPI communication to the master processor. More... | |
| void | vexSpiTeamnameSet (char *name) |
| Set the team name. More... | |
| short | vexSpiGetOnlineStatus (void) |
| We use presence of js_1 as indication of good joystick data. More... | |
| void | vexSpiSetMotor (int16_t index, int16_t data, bool_t reversed) |
| Set motor value in the SPI tx data array. More... | |
| void | vexSpiSend (void) |
| Send/receive one message with the master processor. More... | |
| void | vexSpiTickDelay (int16_t tick) |
| Pause for exactly tick uS. More... | |
| jsdata * | vexSpiGetJoystickDataPtr (int16_t index) |
| return a pointer to a raw joystick data structure More... | |
| uint16_t | vexSpiGetControl (void) |
| Get competition and status word. More... | |
| uint16_t | vexSpiGetMainBattery (void) |
| Get main battery level. More... | |
| uint16_t | vexSpiGetBackupBattery (void) |
| Get backup battery level. More... | |
| void | vexSpiDebug (vexStream *chp, int argc, char *argv[]) |
| Debug function to dump SPI buffers. More... | |
SPI communication to the master processor, macros and prototypes.
| #define CONVEX_TEAM_NAME "CONVEX "; |
default team name
| #define vexTeamnameSet | ( | name) | vexSpiTeamnameSet( name ) |
joystick data structure
Format of the joystick component of the SPI receive packet The reserved bytes are really used for other purposes but we keep them here in V1.00
| typedef union _spiTxPacket spiTxPacket |
SPI transmit data packet.
Format of a SPI transmit packet - 16 words
| typedef union _spiRxPacket spiRxPacket |
SPI receive data packet.
Format of a SPI receive packet - 16 words
| 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 |
| 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 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 vexSpiTickDelay | ( | int16_t | tick) |
Pause for exactly tick uS.
| [in] | tick | The delay in uS |
| 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 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 |