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

Main vex include file. More...

#include <stdarg.h>
#include "vexcompat.h"
#include "vexanalog.h"
#include "vexdigital.h"
#include "vexencoder.h"
#include "vexsonar.h"
#include "vexmotor.h"
#include "vexime.h"
#include "vexconfig.h"
#include "vexspi.h"
#include "vexlcd.h"
#include "vexctl.h"
#include "vexaudio.h"
#include "vexsensor.h"
#include "vexprintf.h"
#include "vexshell.h"
#include "vexbkup.h"

Go to the source code of this file.

Macros

#define CONVEX_VERSION   "1.0.4"
 ConVEX version string. More...
 
#define CH_KERNEL_VERSION_HEX   ((CH_KERNEL_MAJOR << 8) | (CH_KERNEL_MINOR << 4) | (CH_KERNEL_PATCH))
 
#define SD_CONSOLE   &SD1
 
#define SD_LCD1   &SD2
 
#define SD_LCD2   &SD3
 
ConVEX version
#define CONVEX_MAJOR   1
 ConVEX version major number. More...
 
#define CONVEX_MINOR   0
 ConVEX version minor number. More...
 
#define CONVEX_PATCH   4
 ConVEX version patch number. More...
 
task priorities
#define SYSTEM_THREAD_PRIORITY   NORMALPRIO + 10
 
#define IME_THREAD_PRIORITY   NORMALPRIO + 9
 
#define MONITOR_THREAD_PRIORITY   NORMALPRIO + 8
 
#define SONAR_THREAD_PRIORITY   NORMALPRIO + 8
 
#define LCD_THREAD_PRIORITY   NORMALPRIO
 
#define USER_THREAD_PRIORITY   NORMALPRIO + 1
 
Stack sizes
#define USER_TASK_STACK_SIZE   512
 
#define IME_TASK_STACK_SIZE   0x1D0
 
#define SONAR_TASK_STACK_SIZE   0xD0
 
#define LCD_TASK_STACK_SIZE   0xD0
 
#define TEST_TASK_STACK_SIZE   0xD0
 
#define SYSTEM_TASK_STACK_SIZE   0xD0
 
#define MONITOR_TASK_STACK_SIZE   0x1D0
 
#define AUDIO_TASK_STACK_SIZE   0xD0
 

Functions

void vexUserSetup (void) __attribute__((weak))
 User setup. More...
 
void vexUserInit (void) __attribute__((weak))
 User initialize. More...
 
msg_t vexAutonomous (void *arg)
 Autonomous. More...
 
msg_t vexOperator (void *arg)
 Driver control. More...
 
void vexCortexInit (void)
 Initialize the VEX cortex. More...
 
void vexConsoleInit (void)
 Initialize the console serial port. More...
 
void vexTaskRegister (char *name)
 Register a thread so it can be terminated during vexSleep. More...
 
void vexTaskRegisterPersistant (char *name, bool_t p)
 Register a thread so it can be terminated during vexSleep. More...
 
bool_t vexTaskIsRegistered (Thread *tp)
 Check if this thread was already registered. More...
 
bool_t vexTaskPersistentGet (Thread *tp)
 Check if this thread has persistent flag set. More...
 
void vexTaskPersistentSet (Thread *tp, bool_t p)
 Set persistent flag. More...
 
void vexTaskEmergencyStop (void)
 Stop all tasks. More...
 
void vexSleep (int32_t msec)
 Sleep for given number of ms. More...
 
void vexWatchdogInit (void)
 Init watchdog timer. More...
 
void vexWatchdogReload (void)
 Reload the IWDG - call several times per second. More...
 
int16_t vexWatchdogResetFlagGet (void)
 Check to see if the IWDG was the cause of reset. More...
 
void vexTest (void)
 Used for testing new ideas. More...
 
void vexTestDebug (vexStream *chp, int argc, char *argv[])
 Dump test data for debug. More...
 
void vexServiceEncoder (short source, short pa, short pb, long *encoder)
 

Detailed Description

Main vex include file.

Macro Definition Documentation

#define CONVEX_VERSION   "1.0.4"

ConVEX version string.

#define CONVEX_MAJOR   1

ConVEX version major number.

#define CONVEX_MINOR   0

ConVEX version minor number.

#define CONVEX_PATCH   4

ConVEX version patch number.

#define CH_KERNEL_VERSION_HEX   ((CH_KERNEL_MAJOR << 8) | (CH_KERNEL_MINOR << 4) | (CH_KERNEL_PATCH))
#define SYSTEM_THREAD_PRIORITY   NORMALPRIO + 10
#define IME_THREAD_PRIORITY   NORMALPRIO + 9
#define MONITOR_THREAD_PRIORITY   NORMALPRIO + 8
#define SONAR_THREAD_PRIORITY   NORMALPRIO + 8
#define LCD_THREAD_PRIORITY   NORMALPRIO
#define USER_THREAD_PRIORITY   NORMALPRIO + 1
#define USER_TASK_STACK_SIZE   512
#define IME_TASK_STACK_SIZE   0x1D0
#define SONAR_TASK_STACK_SIZE   0xD0
#define LCD_TASK_STACK_SIZE   0xD0
#define TEST_TASK_STACK_SIZE   0xD0
#define SYSTEM_TASK_STACK_SIZE   0xD0
#define MONITOR_TASK_STACK_SIZE   0x1D0
#define AUDIO_TASK_STACK_SIZE   0xD0
#define SD_CONSOLE   &SD1
#define SD_LCD1   &SD2
#define SD_LCD2   &SD3

Function Documentation

void vexUserSetup ( void  )

User setup.

The digital and motor ports can (should) be configured here.

Examples:
clawbot.c, and vexuser.c.
void vexUserInit ( void  )

User initialize.

This function is called after all setup is complete and communication has been established with the master processor. Start other tasks and initialize user variables here

Examples:
clawbot.c, and vexuser.c.
msg_t vexAutonomous ( void *  arg)

Autonomous.

This thread is started when the autonomous period is started

Examples:
clawbot.c, and vexuser.c.
msg_t vexOperator ( void *  arg)

Driver control.

This thread is started when the driver control period is started

Examples:
clawbot.c, and vexuser.c.
void vexCortexInit ( void  )

Initialize the VEX cortex.

void vexConsoleInit ( void  )

Initialize the console serial port.

void vexTaskRegister ( char *  name)

Register a thread so it can be terminated during vexSleep.

Parameters
[in]namestring describing the thread
Examples:
clawbot.c, and vexuser.c.
void vexTaskRegisterPersistant ( char *  name,
bool_t  p 
)

Register a thread so it can be terminated during vexSleep.

Parameters
[in]namestring describing the thread
[in]ppersistent flag
bool_t vexTaskIsRegistered ( Thread *  tp)

Check if this thread was already registered.

Parameters
[in]tppointer to the Thread structure
Returns
bool with registration status
bool_t vexTaskPersistentGet ( Thread *  tp)

Check if this thread has persistent flag set.

Parameters
[in]tppointer to the Thread structure
Returns
bool with persistent status
void vexTaskPersistentSet ( Thread *  tp,
bool_t  p 
)

Set persistent flag.

Parameters
[in]tppointer to the Thread structure
[in]ppersistent flag
void vexTaskEmergencyStop ( void  )

Stop all tasks.

Call this to stop all tasks that were registered with vexTaskRegister or vexTaskRegisterPersistant. Use as emergency stop, cortex will need rebooting

void vexSleep ( int32_t  msec)

Sleep for given number of ms.

Parameters
[in]msecnumber of ms to sleep

Used as a replacement for chThdSleepMilliseconds so calling thread can be terminated

Examples:
clawbot.c, vexdefault.c, and vexuser.c.
void vexWatchdogInit ( void  )

Init watchdog timer.

void vexWatchdogReload ( void  )
inline

Reload the IWDG - call several times per second.

int16_t vexWatchdogResetFlagGet ( void  )

Check to see if the IWDG was the cause of reset.

void vexTest ( void  )

Used for testing new ideas.

void vexTestDebug ( vexStream chp,
int  argc,
char *  argv[] 
)

Dump test data for debug.

Parameters
[in]chpA pointer to a vexStream object
[in]argcThe number of command line arguments
[in]argvAn array of pointers to the command line args
void vexServiceEncoder ( short  source,
short  pa,
short  pb,
long *  encoder 
)