ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
ecrobot::Lcd Class Reference

Simple LCD display class. More...

#include <Lcd.h>

List of all members.

Public Member Functions

 Lcd (void)
 Constructor.
void cursor (U32 x, U32 y)
 Set cursor to (x,y) position.
void clear (bool lcdToo=false)
 Clear LCD data buffer and reset cursor position to (0,0).
bool clearRow (U32 row, bool lcdToo=false)
 Clear LCD data buffer at the specified row.
bool putf (const CHAR *format,...)
 Put output to the LCD data buffer, according to format and other arguments passed to putf().
void draw (const U8 *data, U32 width, U32 depth, U32 xPosInWidth, U32 yPosInDepth)
 Draw monochrome bit map data to the LCD data buffer.
void disp (void)
 Display data in the LCD data buffer to the LCD.

Static Public Attributes

static const U32 MAX_CURSOR_X = 15
 Max cursor position in X(horizontal) axis.
static const U32 MAX_CURSOR_Y = 7
 Max cursor position in Y(vertical) axis.
static const U32 MAX_LCD_WIDTH = 100
 Max LCD width (1 width = 1 pixel)
static const U32 MAX_LCD_DEPTH = 64/8
 Max LCD depth (1 depth = 8 pixels)

Detailed Description

Simple LCD display class.

[ Example ]
  Lcd lcd;

  lcd.clear();
  lcd.putf("s", "Hello");
  lcd.putf("s", "World");
  lcd.disp();
  "HelloWorld"

  lcd.clear();
  lcd.putf("s\ns", "Hello", "World");
  lcd.disp();
  "Hello"
  "World"

  lcd.clear();
  lcd.putf("d", -10,0);
  lcd.disp();
  "-10"

  lcd.clear();
  lcd.putf("x", 255,0);
  lcd.disp();
  "FF"

  lcd.clear();
  lcd.putf("sddsx", "Calc: ", 16,0, -1,2, "=0x", (16-1),0);
  lcd.disp();
  "Calc: 16-1=0xF"


Constructor & Destructor Documentation

ecrobot::Lcd::Lcd ( void  )

Constructor.

Parameters:
-
Returns:
-

Member Function Documentation

void ecrobot::Lcd::clear ( bool  lcdToo = false)

Clear LCD data buffer and reset cursor position to (0,0).

Parameters:
lcdTooClear LCD display too.
Returns:
-
bool ecrobot::Lcd::clearRow ( U32  row,
bool  lcdToo = false 
)

Clear LCD data buffer at the specified row.

Parameters:
rowLCD row position to be cleared
lcdTooClear LCD display too.
Returns:
true:succeeded/false:failed
void ecrobot::Lcd::cursor ( U32  x,
U32  y 
)

Set cursor to (x,y) position.

Top left is (0,0).

Parameters:
xCusor position in X(horizontal) axis.
yCusor position in Y(vertical) axis.
void ecrobot::Lcd::disp ( void  )

Display data in the LCD data buffer to the LCD.

Note that LCD display takes minimun 16msec due to hardware, so frequent executions of this member function makes the system busy.

Parameters:
-
Returns:
-
void ecrobot::Lcd::draw ( const U8 *  data,
U32  width,
U32  depth,
U32  xPosInWidth,
U32  yPosInDepth 
)

Draw monochrome bit map data to the LCD data buffer.

Parameters:
dataMonochrome bit map data which is adapted to NXT LCD data alignment
widthWidth of bit map data
depthDepth of bit map data
xPosInWidthX axis position of bit map data in the width unit (= 1 pixel)
yPosInDepthY axis position of bit map data in the depth unit (= 8 pixels)
bool ecrobot::Lcd::putf ( const CHAR *  format,
  ... 
)

Put output to the LCD data buffer, according to format and other arguments passed to putf().

Parameters:
formatOutput format string.
"s": String format.
"d": Decimal integer format. This format requires two arguments (arg1: value, arg2: spaces to be held).
"x": Hex integer format. This format requires two arguments (arg1: value, arg2: spaces to be held).
"n": Line feed format. Cursor position in X(horizontal) axis is set to 0.
"\n": ASCII line feed format. Cursor position in X(horizontal) axis is set to 0.
Returns:
true:succeeded/false:failed(might be due to invalid format)

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines