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

Cortex configuration macros and prototypes. More...

Go to the source code of this file.

Data Structures

struct  _vexDigiCfg
 Structure holding information to configure a single digital pin. More...
 
struct  _vexMotorCfg
 Structure holding information to configure a single motor. More...
 

Macros

#define DIG_CONFIG_SIZE(x)   sizeof( x ) / sizeof( vexDigiCfg )
 Macro to calculate the number of entries in digital config. More...
 
#define MOT_CONFIG_SIZE(x)   sizeof( x ) / sizeof( vexMotorCfg )
 Macro to calculate the number of entries in motor config. More...
 

Typedefs

typedef struct _vexDigiCfg vexDigiCfg
 Structure holding information to configure a single digital pin. More...
 
typedef struct _vexMotorCfg vexMotorCfg
 Structure holding information to configure a single motor. More...
 

Enumerations

enum  tVexSensorType {
  kVexSensorNone = 0, kVexSensorDigitalInput, kVexSensorDigitalOutput, kVexSensorQuadEncoder,
  kVexSensorSonarCm, kVexSensorSonarInch, kVexSensorIME, kVexSensorPotentiometer,
  kVexSensorInterrupt
}
 Sensor types for cortex configuration. More...
 
enum  tVexDigitalConfig {
  kVexConfigInput = kVexDigitalInput, kVexConfigOutput = kVexDigitalOutput, kVexConfigQuadEnc1 = 10, kVexConfigQuadEnc2,
  kVexConfigSonarOut, kVexConfigSonarIn, kVexConfigInterrupt
}
 A digital pin can be of the following type. More...
 

Functions

void vexDigitalConfigure (vexDigiCfg *cfg, int16_t cfg_num)
 Configure digital ports. More...
 
void vexMotorConfigure (vexMotorCfg *cfg, int16_t cfg_num)
 Configure motors based on a configuration structure. More...
 
tVexSensorType vexDigitalTypeGet (tVexDigitalPin pin)
 Get the sensor type given pin number. More...
 
char * vexDigitalTypeGetName (tVexDigitalPin pin)
 Get the sensor name given pin number. More...
 
uint16_t vexDigitalChannelGet (tVexDigitalPin pin)
 Get the sensor channel given pin number. More...
 
uint16_t vexDigitalCfgGet (tVexDigitalPin pin)
 Get the sensor config given pin number. More...
 

Detailed Description

Cortex configuration macros and prototypes.

Macro Definition Documentation

#define DIG_CONFIG_SIZE (   x)    sizeof( x ) / sizeof( vexDigiCfg )

Macro to calculate the number of entries in digital config.

Examples:
clawbot.c, vexdefault.c, and vexuser.c.
#define MOT_CONFIG_SIZE (   x)    sizeof( x ) / sizeof( vexMotorCfg )

Macro to calculate the number of entries in motor config.

Examples:
clawbot.c, vexdefault.c, and vexuser.c.

Typedef Documentation

typedef struct _vexDigiCfg vexDigiCfg

Structure holding information to configure a single digital pin.

typedef struct _vexMotorCfg vexMotorCfg

Structure holding information to configure a single motor.

Enumeration Type Documentation

Sensor types for cortex configuration.

Enumerator
kVexSensorNone 
kVexSensorDigitalInput 
kVexSensorDigitalOutput 
kVexSensorQuadEncoder 
kVexSensorSonarCm 
kVexSensorSonarInch 
kVexSensorIME 
kVexSensorPotentiometer 
kVexSensorInterrupt 

A digital pin can be of the following type.

Although a digital IO pin can in reality only be configured as either an input or output, they can also have additional functionality depending on the intended function, for example, a quad encoder uses two digital pins, both are inputs but we also define them as QuadEnc1 or QuadEnc2

Enumerator
kVexConfigInput 
kVexConfigOutput 
kVexConfigQuadEnc1 
kVexConfigQuadEnc2 
kVexConfigSonarOut 
kVexConfigSonarIn 
kVexConfigInterrupt 

Function Documentation

void vexDigitalConfigure ( vexDigiCfg cfg,
int16_t  cfg_num 
)

Configure digital ports.

Parameters
[in]cfgpointer to vexDigiCfg structure
[in]cfg_numnumber of entries in the cfg structure

Configure digital ports based on a configuration structure

void vexMotorConfigure ( vexMotorCfg cfg,
int16_t  cfg_num 
)

Configure motors based on a configuration structure.

Configure motors based on a configuration structure. This is primarily to link a motor with a position sensor such as an IME

tVexSensorType vexDigitalTypeGet ( tVexDigitalPin  pin)

Get the sensor type given pin number.

Parameters
[in]pinThe pin number
Returns
The sensor type
char* vexDigitalTypeGetName ( tVexDigitalPin  pin)

Get the sensor name given pin number.

Parameters
[in]pinThe pin number
Returns
A char pointer to the text name of the sensor
uint16_t vexDigitalChannelGet ( tVexDigitalPin  pin)

Get the sensor channel given pin number.

Parameters
[in]pinThe pin number
Returns
The channel number
uint16_t vexDigitalCfgGet ( tVexDigitalPin  pin)

Get the sensor config given pin number.

Parameters
[in]pinThe pin number
Returns
The pin configuration

The configuration is sensor dependent, eg. sonar output or input