All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
apollo.c File Reference

Status display for VT100 console. More...

#include <string.h>
#include <stdarg.h>
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
#include "vex.h"
#include "smartmotor.h"
#include "apollo.h"

Macros

#define vt100_putchar(c)   apolloPut((uint8_t)c);
 Macro so we can use alternatives to apolloPut for testing. More...
 
vt100 shortcut macros
#define vt100_tl_corner()   vt100_putchar('l')
 
#define vt100_tr_corner()   vt100_putchar('k')
 
#define vt100_bl_corner()   vt100_putchar('m')
 
#define vt100_br_corner()   vt100_putchar('j')
 
#define vt100_hline()   vt100_putchar('q')
 
#define vt100_vline()   vt100_putchar('x')
 
#define vt100_tt()   vt100_putchar('w')
 
#define vt100_bt()   vt100_putchar('v')
 
#define vt100_lt()   vt100_putchar('t')
 
#define vt100_rt()   vt100_putchar('u')
 

Functions

void vt100_drawbox (int col, int row, int width, int height)
 Draw a box on the vt100 console. More...
 
void apolloScreenSetup ()
 Draw static lines for the display. More...
 
void apolloMotorSetup ()
 Setup motor section of the display. More...
 
void apolloDigitalSetup ()
 Setup digital port status section of the display. More...
 
void apolloAnalogSetup ()
 Setup analog port status section of the display. More...
 
void apolloJoystickSetup (int joystick)
 Setup joystick status section of the display. More...
 
void apolloUpdateMotor (int m)
 Update motor status. More...
 
void apolloUpdateCortex (int p)
 Update cortex current and temperature status. More...
 
void apolloUpdateDigital (int pin)
 Update digital port status. More...
 
void apolloUpdateAnalog (int pin)
 Update analog port status. More...
 
void apolloUpdateSystem ()
 Update system status. More...
 
void apolloUpdateJoystickButton (int joystick, int row, int up, int down, int left, int right)
 Update joystick button status. More...
 
void apolloUpdateJoystickAnalog (int joystick, int row, int h, int v)
 Update joystick analog status. More...
 
void apolloInit ()
 Apollo initialization. More...
 
void apolloDeinit ()
 Apollo de-init. Cleans up screen when done. More...
 
void apolloUpdate ()
 Apollo update - update all status. More...
 

Detailed Description

Status display for VT100 console.

Precondition
This code need the smartMotor library

call apolloInit to start display call apolloUpdate in a loop until done call apolloDeinit to clear display before returning to normal cmd line

Macro Definition Documentation

#define vt100_putchar (   c)    apolloPut((uint8_t)c);

Macro so we can use alternatives to apolloPut for testing.

#define vt100_tl_corner ( )    vt100_putchar('l')
#define vt100_tr_corner ( )    vt100_putchar('k')
#define vt100_bl_corner ( )    vt100_putchar('m')
#define vt100_br_corner ( )    vt100_putchar('j')
#define vt100_hline ( )    vt100_putchar('q')
#define vt100_vline ( )    vt100_putchar('x')
#define vt100_tt ( )    vt100_putchar('w')
#define vt100_bt ( )    vt100_putchar('v')
#define vt100_lt ( )    vt100_putchar('t')
#define vt100_rt ( )    vt100_putchar('u')

Function Documentation

void vt100_drawbox ( int  col,
int  row,
int  width,
int  height 
)

Draw a box on the vt100 console.

Parameters
[in]colStarting column
[in]rowStarting row
[in]widthThe box width
[in]heightThe box height
void apolloScreenSetup ( void  )

Draw static lines for the display.

void apolloMotorSetup ( void  )

Setup motor section of the display.

void apolloDigitalSetup ( void  )

Setup digital port status section of the display.

void apolloAnalogSetup ( void  )

Setup analog port status section of the display.

void apolloJoystickSetup ( int  joystick)

Setup joystick status section of the display.

void apolloUpdateMotor ( int  m)

Update motor status.

Parameters
[in]mThe smart motor port number (0 - 9)
void apolloUpdateCortex ( int  p)

Update cortex current and temperature status.

Parameters
[in]pThe smart motor port number (0 or 1)
void apolloUpdateDigital ( int  pin)

Update digital port status.

Parameters
[in]pinThe digital port number
void apolloUpdateAnalog ( int  pin)

Update analog port status.

Parameters
[in]pinThe analog port number
void apolloUpdateSystem ( void  )

Update system status.

void apolloUpdateJoystickButton ( int  joystick,
int  row,
int  up,
int  down,
int  left,
int  right 
)

Update joystick button status.

Parameters
[in]joystickWhich joystick, 0 for main, 1 for partner
[in]rowThe row for the data (0 - 4)
[in]upUp button status
[in]downUp down status
[in]leftUp left status
[in]rightUp right status
void apolloUpdateJoystickAnalog ( int  joystick,
int  row,
int  h,
int  v 
)

Update joystick analog status.

Parameters
[in]joystickWhich joystick, 0 for main, 1 for partner
[in]rowThe row for the data (0, 1 or 2)
[in]hthe horizontal joystick data
[in]vthe vertical joystick data
void apolloInit ( void  )

Apollo initialization.

void apolloDeinit ( void  )

Apollo de-init. Cleans up screen when done.

void apolloUpdate ( void  )

Apollo update - update all status.