ECRobot C++ API for LEGO MINDSTORMS NXT
1.0.10
|
Simple LCD display class. More...
#include <Lcd.h>
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) |
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"
ecrobot::Lcd::Lcd | ( | void | ) |
Constructor.
- |
void ecrobot::Lcd::clear | ( | bool | lcdToo = false | ) |
Clear LCD data buffer and reset cursor position to (0,0).
lcdToo | Clear LCD display too. |
bool ecrobot::Lcd::clearRow | ( | U32 | row, |
bool | lcdToo = false |
||
) |
Clear LCD data buffer at the specified row.
row | LCD row position to be cleared |
lcdToo | Clear LCD display too. |
void ecrobot::Lcd::cursor | ( | U32 | x, |
U32 | y | ||
) |
Set cursor to (x,y) position.
Top left is (0,0).
x | Cusor position in X(horizontal) axis. |
y | Cusor 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.
- |
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.
data | Monochrome bit map data which is adapted to NXT LCD data alignment |
width | Width of bit map data |
depth | Depth of bit map data |
xPosInWidth | X axis position of bit map data in the width unit (= 1 pixel) |
yPosInDepth | Y 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().
format | Output 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. |