All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vexctl.h File Reference

Extract data from SPI data received from master processor. More...

Go to the source code of this file.

Enumerations

enum  tCtlIndex {
  Ch1 = 0, Ch2, Ch3, Ch4,
  Btn8D, Btn8L, Btn8U, Btn8R,
  Btn7D, Btn7L, Btn7U, Btn7R,
  Btn5D, Btn5U, Btn6D, Btn6U,
  AcclX, AcclY, AcclZ, Btn5,
  Btn6, Btn7, Btn8, BtnAny,
  Ch1Xmtr2 = 128, Ch2Xmtr2, Ch3Xmtr2, Ch4Xmtr2,
  Btn8DXmtr2, Btn8LXmtr2, Btn8UXmtr2, Btn8RXmtr2,
  Btn7DXmtr2, Btn7LXmtr2, Btn7UXmtr2, Btn7RXmtr2,
  Btn5DXmtr2, Btn5UXmtr2, Btn6DXmtr2, Btn6UXmtr2,
  AcclXXmtr2, AcclYXmtr2, AcclZXmtr2, Btn5Xmtr2,
  Btn6Xmtr2, Btn7Xmtr2, Btn8mXtr2, BtnAnyXmtr2
}
 controller button and analog control definitions More...
 
enum  tVexControlState {
  kFlagNoXmiters = 0, kFlagXmit1 = 0x01, kFlagXmit2 = 0x02, kFlagBit2 = 0x04,
  kFlagCompetitionSwitch = 0x08, kFlagResetSlave = 0x10, kFlagGameController = 0x20, kFlagAutonomousMode = 0x40,
  kFlagDisabled = 0x80
}
 Various competition and controller flags. More...
 

Functions

int16_t vexControllerGet (tCtlIndex index)
 Get controller data. More...
 
int16_t vexControllerCompetitionStateSet (uint16_t ctl, int16_t mask)
 Set competition state, a simulation of the competition modes. More...
 
uint16_t vexControllerCompetitonState (void)
 Get competition state word (and controller status) More...
 
void vexControllerReleaseWait (tCtlIndex index)
 Wait for button release. More...
 

Detailed Description

Extract data from SPI data received from master processor.

Enumeration Type Documentation

enum tCtlIndex

controller button and analog control definitions

Note
loosely follows the ROBOTC definition of the same functions

These are the constants that are used in the call to vexControllerGet. They follow the format that ROBOTC uses in its call to vexRT[], however, there are a few additions to allow multiple buttons to be checked.

Enumerator
Ch1 
Ch2 
Ch3 
Ch4 
Btn8D 
Btn8L 
Btn8U 
Btn8R 
Btn7D 
Btn7L 
Btn7U 
Btn7R 
Btn5D 
Btn5U 
Btn6D 
Btn6U 
AcclX 
AcclY 
AcclZ 
Btn5 
Btn6 
Btn7 
Btn8 
BtnAny 
Ch1Xmtr2 
Ch2Xmtr2 
Ch3Xmtr2 
Ch4Xmtr2 
Btn8DXmtr2 
Btn8LXmtr2 
Btn8UXmtr2 
Btn8RXmtr2 
Btn7DXmtr2 
Btn7LXmtr2 
Btn7UXmtr2 
Btn7RXmtr2 
Btn5DXmtr2 
Btn5UXmtr2 
Btn6DXmtr2 
Btn6UXmtr2 
AcclXXmtr2 
AcclYXmtr2 
AcclZXmtr2 
Btn5Xmtr2 
Btn6Xmtr2 
Btn7Xmtr2 
Btn8mXtr2 
BtnAnyXmtr2 

Various competition and controller flags.

Enumerator
kFlagNoXmiters 
kFlagXmit1 
kFlagXmit2 
kFlagBit2 
kFlagCompetitionSwitch 
kFlagResetSlave 
kFlagGameController 
kFlagAutonomousMode 
kFlagDisabled 

Function Documentation

int16_t vexControllerGet ( tCtlIndex  index)

Get controller data.

Parameters
[in]indexThe required controller variable eg. Btn8U
Returns
The requested controller data
int16_t vexControllerCompetitionStateSet ( uint16_t  ctl,
int16_t  mask 
)

Set competition state, a simulation of the competition modes.

Parameters
[in]ctlThe control byte
[in]maskbit to change
Returns
1 if success else 0
uint16_t vexControllerCompetitonState ( void  )

Get competition state word (and controller status)

Returns
status word from SPI data
void vexControllerReleaseWait ( tCtlIndex  index)

Wait for button release.