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

LCD driver. More...

#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "ch.h"
#include "hal.h"
#include "vex.h"

Macros

#define LCD_DISPLAYS   2
 Number of LCD displays supported. More...
 
#define LCD_BUF_MAX   32
 Size of the LCD output buffer. More...
 

Functions

void vexLcdInit (int16_t display, SerialDriver *sdp)
 Initialize a LCD and bind to serial port. More...
 
void vexLcdSet (int16_t display, int16_t line, char *buf)
 Show text from beginning of an LCD line. More...
 
void vexLcdSetAt (int16_t display, int16_t line, int16_t col, char *buf)
 Show text on LCD line and column. More...
 
void vexLcdPrintf (int16_t display, int16_t line, char *fmt,...)
 Formated output to LCD - similar to printf. More...
 
void vexLcdPrintfAt (int16_t display, int16_t line, int16_t col, char *fmt,...)
 Formated output to LCD - similar to printf. More...
 
void vexLcdClearLine (int16_t display, int16_t line)
 Clear a given lcd display line. More...
 
void vexLcdBacklight (int16_t display, int16_t value)
 Turn on or off the backlight. More...
 
vexLcdButton vexLcdButtonGet (int16_t display)
 Get the current button status. More...
 
void vexLcdSendMessage (LcdData *lcd, int16_t line)
 Form and send message to LCD. More...
 
void vexLcdCheckReceiveMessage (LcdData *lcd)
 Check for receive data and store. More...
 
void vexLcdDebug (vexStream *chp, int argc, char *argv[])
 Debug function to dump LCD buffers. More...
 

Detailed Description

LCD driver.

Macro Definition Documentation

#define LCD_DISPLAYS   2

Number of LCD displays supported.

#define LCD_BUF_MAX   32

Size of the LCD output buffer.

Function Documentation

void vexLcdInit ( int16_t  display,
SerialDriver *  sdp 
)

Initialize a LCD and bind to serial port.

Parameters
[in]displayThe LCD display id, should be 0 or 1
[in]sdpA pointer to the serial driver (chibios hal serial driver)
void vexLcdSet ( int16_t  display,
int16_t  line,
char *  buf 
)

Show text from beginning of an LCD line.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]lineThe line to display the text on, 0 or 1
[in]bufPointer to char buffer with test to display
void vexLcdSetAt ( int16_t  display,
int16_t  line,
int16_t  col,
char *  buf 
)

Show text on LCD line and column.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]lineThe line to display the text on, 0 or 1
[in]colThe position at which to start displaying text
[in]bufPointer to char buffer with test to display
void vexLcdPrintf ( int16_t  display,
int16_t  line,
char *  fmt,
  ... 
)

Formated output to LCD - similar to printf.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]lineThe line to display the text on, 0 or 1
[in]fmtA sprintf style format string with optional variables
void vexLcdPrintfAt ( int16_t  display,
int16_t  line,
int16_t  col,
char *  fmt,
  ... 
)

Formated output to LCD - similar to printf.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]lineThe line to display the text on, 0 or 1
[in]colThe position at which to start displaying text
[in]fmtA sprintf style format string with optional variables
void vexLcdClearLine ( int16_t  display,
int16_t  line 
)

Clear a given lcd display line.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]lineThe line to display the text on, 0 or 1
void vexLcdBacklight ( int16_t  display,
int16_t  value 
)

Turn on or off the backlight.

Parameters
[in]displayThe LCD display id, 0 or 1
[in]value1 for backlight on, 0 for off
vexLcdButton vexLcdButtonGet ( int16_t  display)

Get the current button status.

Parameters
[in]displayThe LCD display id, 0 or 1
Returns
The button (or buttons) pressed
void vexLcdSendMessage ( LcdData lcd,
int16_t  line 
)

Form and send message to LCD.

Parameters
[in]lcdPointer to LcdData structure
[in]lineThe line to display the text on, 0 or 1
Note
Internal driver use only
void vexLcdCheckReceiveMessage ( LcdData lcd)

Check for receive data and store.

Parameters
[in]lcdPointer to LcdData structure
Note
Internal driver use only
void vexLcdDebug ( vexStream chp,
int  argc,
char *  argv[] 
)

Debug function to dump LCD buffers.

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