Initial commit

Fork of TextLCD by Wim Huiskamp

Embed: (wiki syntax)

« Back to documentation index

TextLCD Class Reference

TextLCD Class Reference

A TextLCD interface for driving 4-bit HD44780-based LCDs. More...

#include <TextLCD.h>

Public Types

enum  LCDType {
  LCD8x1, LCD8x2, LCD8x2B, LCD12x2,
  LCD12x4, LCD16x1, LCD16x2, LCD16x2B,
  LCD16x4, LCD20x2, LCD20x4, LCD24x2,
  LCD24x4, LCD40x2, LCD40x4
}
 

LCD panel format.

More...
enum  LCDCtrl { HD44780, WS0010, ST7036 }
 

LCD Controller Device.

More...
enum  LCDCursor { CurOff_BlkOff = 0x00, CurOn_BlkOff = 0x02, CurOff_BlkOn = 0x01, CurOn_BlkOn = 0x03 }
 

LCD Cursor control.

More...
enum  LCDMode { DispOff = 0x00, DispOn = 0x04 }
 

LCD Display control.

More...
enum  LCDBacklight { LightOff, LightOn }
 

LCD Backlight control.

More...

Public Member Functions

 TextLCD (SPI *spi, PinName cs, PinName rs, LCDType type=LCD16x2, LCDCtrl ctrl=HD44780)
 Create a TextLCD interface using an SPI 74595 portexpander.
int putc (int c)
 Write a character to the LCD.
int printf (const char *format,...)
 Write a formated string to the LCD.
void locate (int column, int row)
 Locate to a screen column and row.
int getAddress (int column, int row)
 Return the memoryaddress of screen column and row location.
void setAddress (int column, int row)
 Set the memoryaddress of screen column and row location.
void cls ()
 Clear the screen and locate to 0,0.
int rows ()
 Return the number of rows.
int columns ()
 Return the number of columns.
void setCursor (LCDCursor cursorMode)
 Set the Cursormode.
void setMode (TextLCD::LCDMode displayMode)
 Set the Displaymode.
void setUDC (unsigned char c, char *udc_data)
 Set User Defined Characters.

Detailed Description

A TextLCD interface for driving 4-bit HD44780-based LCDs.

Currently supports 8x1, 8x2, 12x2, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels

Definition at line 166 of file TextLCD.h.


Member Enumeration Documentation

LCD Backlight control.

Enumerator:
LightOff 

Backlight Off.

LightOn 

Backlight On.

Definition at line 212 of file TextLCD.h.

enum LCDCtrl

LCD Controller Device.

Enumerator:
HD44780 

HD44780 (default)

WS0010 

WS0010 OLED Controller.

ST7036 

ST7036.

Definition at line 189 of file TextLCD.h.

enum LCDCursor

LCD Cursor control.

Enumerator:
CurOff_BlkOff 

Cursor Off, Blinking Char Off.

CurOn_BlkOff 

Cursor On, Blinking Char Off.

CurOff_BlkOn 

Cursor Off, Blinking Char On.

CurOn_BlkOn 

Cursor On, Blinking Char On.

Definition at line 197 of file TextLCD.h.

enum LCDMode

LCD Display control.

Enumerator:
DispOff 

Display Off.

DispOn 

Display On.

Definition at line 206 of file TextLCD.h.

enum LCDType

LCD panel format.

Enumerator:
LCD8x1 

8x1 LCD panel

LCD8x2 

8x2 LCD panel

LCD8x2B 

8x2 LCD panel (actually 16x1)

LCD12x2 

12x2 LCD panel

LCD12x4 

12x4 LCD panel

LCD16x1 

16x1 LCD panel (actually 8x2)

LCD16x2 

16x2 LCD panel (default)

LCD16x2B 

16x2 LCD panel alternate addressing

LCD16x4 

16x4 LCD panel

LCD20x2 

20x2 LCD panel

LCD20x4 

20x4 LCD panel

LCD24x2 

24x2 LCD panel

LCD24x4 

24x4 LCD panel, special mode KS0078

LCD40x2 

40x2 LCD panel

LCD40x4 

40x4 LCD panel, Two controller version

Definition at line 170 of file TextLCD.h.


Constructor & Destructor Documentation

TextLCD ( SPI *  spi,
PinName  cs,
PinName  rs,
LCDType  type = LCD16x2,
LCDCtrl  ctrl = HD44780 
)

Create a TextLCD interface using an SPI 74595 portexpander.

Parameters:
spiSPI Bus
cschip select pin (active low)
typeSets the panel size/addressing mode (default = LCD16x2)
ctrlLCD controller (default = HD44780)

Definition at line 42 of file TextLCD.cpp.


Member Function Documentation

void cls (  )

Clear the screen and locate to 0,0.

Definition at line 213 of file TextLCD.cpp.

int columns (  )

Return the number of columns.

Parameters:
returnThe number of columns

Definition at line 529 of file TextLCD.cpp.

int getAddress ( int  column,
int  row 
)

Return the memoryaddress of screen column and row location.

Parameters:
columnThe horizontal position from the left, indexed from 0
rowThe vertical position from the top, indexed from 0
returnThe memoryaddress of screen column and row location

Definition at line 375 of file TextLCD.cpp.

void locate ( int  column,
int  row 
)

Locate to a screen column and row.

Parameters:
columnThe horizontal position from the left, indexed from 0
rowThe vertical position from the top, indexed from 0

Definition at line 248 of file TextLCD.cpp.

int printf ( const char *  format,
  ... 
)

Write a formated string to the LCD.

Parameters:
formatA printf-style format string, followed by the variables to use in formating the string.
int putc ( int  c )

Write a character to the LCD.

Parameters:
cThe character to write to the display
int rows (  )

Return the number of rows.

Parameters:
returnThe number of rows

Definition at line 564 of file TextLCD.cpp.

void setAddress ( int  column,
int  row 
)

Set the memoryaddress of screen column and row location.

Parameters:
columnThe horizontal position from the left, indexed from 0
rowThe vertical position from the top, indexed from 0

Definition at line 502 of file TextLCD.cpp.

void setCursor ( TextLCD::LCDCursor  cursorMode )

Set the Cursormode.

Parameters:
cursorModeThe Cursor mode (CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn)

Definition at line 595 of file TextLCD.cpp.

void setMode ( TextLCD::LCDMode  displayMode )

Set the Displaymode.

Parameters:
displayModeThe Display mode (DispOff, DispOn)

Definition at line 606 of file TextLCD.cpp.

void setUDC ( unsigned char  c,
char *  udc_data 
)

Set User Defined Characters.

Parameters:
unsignedchar c The Index of the UDC (0..7)
char*udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits)

Definition at line 658 of file TextLCD.cpp.