LCDisplay with IIC (I2C)-bus and IC 8574

Fork of TextLCD by Oscar de Jesus Vasquez

Embed: (wiki syntax)

« Back to documentation index

TextLCD_SPI_N_3_24 Class Reference

Create a TextLCD interface using a controller with native SPI3 24 bits interface Note: lib uses SPI 8 bit mode. More...

#include <TextLCD.h>

Inherits TextLCD_Base.

Public Types

enum  LCDType {
  LCD8x1 = (LCD_T_A | LCD_T_C8 | LCD_T_R1), LCD8x2 = (LCD_T_A | LCD_T_C8 | LCD_T_R2), LCD8x2B = (LCD_T_D | LCD_T_C8 | LCD_T_R2), LCD12x2 = (LCD_T_A | LCD_T_C12 | LCD_T_R2),
  LCD12x3D = (LCD_T_D | LCD_T_C12 | LCD_T_R3), LCD12x3D1 = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3), LCD12x4 = (LCD_T_A | LCD_T_C12 | LCD_T_R4), LCD12x4D = (LCD_T_B | LCD_T_C12 | LCD_T_R4),
  LCD16x1 = (LCD_T_A | LCD_T_C16 | LCD_T_R1), LCD16x1C = (LCD_T_C | LCD_T_C16 | LCD_T_R1), LCD16x2 = (LCD_T_A | LCD_T_C16 | LCD_T_R2), LCD16x3D = (LCD_T_D | LCD_T_C16 | LCD_T_R3),
  LCD16x3F = (LCD_T_F | LCD_T_C16 | LCD_T_R3), LCD16x3G = (LCD_T_G | LCD_T_C16 | LCD_T_R3), LCD16x4 = (LCD_T_A | LCD_T_C16 | LCD_T_R4), LCD20x2 = (LCD_T_A | LCD_T_C20 | LCD_T_R2),
  LCD20x4 = (LCD_T_A | LCD_T_C20 | LCD_T_R4), LCD20x4D = (LCD_T_D | LCD_T_C20 | LCD_T_R4), LCD24x1 = (LCD_T_A | LCD_T_C24 | LCD_T_R1), LCD24x2 = (LCD_T_A | LCD_T_C24 | LCD_T_R2),
  LCD24x4D = (LCD_T_D | LCD_T_C24 | LCD_T_R4), LCD40x2 = (LCD_T_A | LCD_T_C40 | LCD_T_R2), LCD40x4 = (LCD_T_E | LCD_T_C40 | LCD_T_R4)
}
 

LCD panel format.

More...
enum  LCDCtrl {
  HD44780 = 0 | LCD_C_PAR, WS0010 = 1 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_BST), ST7036_3V3 = 2 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), ST7036_5V = 3 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR),
  ST7032_3V3 = 4 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), ST7032_5V = 5 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_CTR), KS0078 = 6 | (LCD_C_PAR | LCD_C_SPI3_24), PCF2113_3V3 = 7 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR),
  PCF2116_3V3 = 8 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST), PCF2116_5V = 9 | (LCD_C_PAR | LCD_C_I2C), PCF2119_3V3 = 10 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), AIP31068 = 12 | (LCD_C_SPI3_9 | LCD_C_I2C | LCD_C_BST),
  SSD1803_3V3 = 13 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN), US2066_3V3 = 15 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_CTR | LCD_C_PDN)
}
 

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...
enum  LCDBlink { BlinkOff, BlinkOn }
 

LCD Blink control (UDC), supported for some Controllers.

More...
enum  LCDOrient { Top, Bottom }
 

LCD Orientation control, supported for some Controllers.

More...

Public Member Functions

 TextLCD_SPI_N_3_24 (SPI *spi, PinName cs, LCDType type=LCD16x2, PinName bl=NC, LCDCtrl ctrl=SSD1803_3V3)
 Create a TextLCD interface using a controller with native SPI3 24 bits interface Note: lib uses SPI 8 bit mode.
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 cursor 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 (LCDMode displayMode)
 Set the Displaymode.
void setBacklight (LCDBacklight backlightMode)
 Set the Backlight mode.
void setUDC (unsigned char c, char *udc_data)
 Set User Defined Characters (UDC)
void setUDCBlink (LCDBlink blinkMode)
 Set UDC Blink setUDCBlink method is supported by some compatible devices (eg SSD1803)
void setContrast (unsigned char c=LCD_DEF_CONTRAST)
 Set Contrast setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation Code imported from fork by JH1PJL.
void setPower (bool powerOn=true)
 Set Power setPower method is supported by some compatible devices (eg SSD1803) that have power down modes.
void setOrient (LCDOrient orient=Top)
 Set Orient setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes.

Protected Types

enum  _LCDCtrl_Idx
 

LCD controller select, mainly used for LCD40x4.

More...

Protected Member Functions

virtual int _putc (int value)
 Write a single character (Stream implementation)
void _init ()
 Low level method for LCD controller.
void _initCtrl ()
 Low level initialisation method for LCD controller.
int _address (int column, int row)
 Low level character address set method.
void _setCursor (LCDCursor show)
 Low level cursor enable or disable method.
void _setUDC (unsigned char c, char *udc_data)
 Low level method to store user defined characters for current controller.
void _setCursorAndDisplayMode (LCDMode displayMode, LCDCursor cursorType)
 Low level method to restore the cursortype and display mode for current controller.
void _writeNibble (int value)
 Low level nibble write operation to LCD controller (serial or parallel)
void _writeCommand (int command)
 Low level command byte write operation to LCD controller.
void _writeData (int data)
 Low level data byte write operation to LCD controller (serial or parallel).

Detailed Description

Create a TextLCD interface using a controller with native SPI3 24 bits interface Note: lib uses SPI 8 bit mode.

Definition at line 1169 of file TextLCD.h.


Member Enumeration Documentation

enum _LCDCtrl_Idx [protected, inherited]

LCD controller select, mainly used for LCD40x4.

Definition at line 624 of file TextLCD.h.

enum LCDBacklight [inherited]

LCD Backlight control.

Enumerator:
LightOff 

Backlight Off.

LightOn 

Backlight On.

Definition at line 488 of file TextLCD.h.

enum LCDBlink [inherited]

LCD Blink control (UDC), supported for some Controllers.

Enumerator:
BlinkOff 

Blink Off.

BlinkOn 

Blink On.

Definition at line 494 of file TextLCD.h.

enum LCDCtrl [inherited]

LCD Controller Device.

Enumerator:
HD44780 

HD44780 or full equivalent (default)

WS0010 

WS0010 OLED Controller, 4/8 bit, SPI3.

ST7036_3V3 

ST7036 3V3 with Booster, 4/8 bit, SPI4, I2C.

ST7036_5V 

ST7036 5V no Booster, 4/8 bit, SPI4, I2C.

ST7032_3V3 

ST7032 3V3 with Booster, 4/8 bit, SPI4, I2C.

ST7032_5V 

ST7032 5V no Booster, 4/8 bit, SPI4, I2C.

KS0078 

KS0078 24x4 support, 4/8 bit, SPI3.

PCF2113_3V3 

PCF2113 3V3 with Booster, 4/8 bit, I2C.

PCF2116_3V3 

PCF2116 3V3 with Booster, 4/8 bit, I2C.

PCF2116_5V 

PCF2116 5V no Booster, 4/8 bit, I2C.

PCF2119_3V3 

PCF2119 3V3 with Booster, 4/8 bit, I2C.

AIP31068 

AIP31068 I2C, SPI3.

SSD1803_3V3 

SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3.

US2066_3V3 

US2066/SSD1311 3V3, 4/8 bit, I2C, SPI3.

Definition at line 450 of file TextLCD.h.

enum LCDCursor [inherited]

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 474 of file TextLCD.h.

enum LCDMode [inherited]

LCD Display control.

Enumerator:
DispOff 

Display Off.

DispOn 

Display On.

Definition at line 482 of file TextLCD.h.

enum LCDOrient [inherited]

LCD Orientation control, supported for some Controllers.

Enumerator:
Top 

Top view.

Bottom 

Upside down view.

Definition at line 500 of file TextLCD.h.

enum LCDType [inherited]

LCD panel format.

Enumerator:
LCD8x1 

8x1 LCD panel

LCD8x2 

8x2 LCD panel

LCD8x2B 

8x2 LCD panel (actually 16x1)

LCD12x2 

12x2 LCD panel

LCD12x3D 

12x3 LCD panel, special mode PCF21XX

LCD12x3D1 

12x3 LCD panel, special mode PCF21XX

LCD12x4 

12x4 LCD panel

LCD12x4D 

12x4 LCD panel, special mode PCF21XX

LCD16x1 

16x1 LCD panel

LCD16x1C 

16x1 LCD panel (actually 8x2)

LCD16x2 

16x2 LCD panel (default)

LCD16x3D 

16x3 LCD panel, special mode SSD1803

LCD16x3F 

16x3 LCD panel (actually 24x2)

LCD16x3G 

16x3 LCD panel, special mode ST7036

LCD16x4 

16x4 LCD panel

LCD20x2 

20x2 LCD panel

LCD20x4 

20x4 LCD panel

LCD20x4D 

20x4 LCD panel, special mode SSD1803

LCD24x1 

24x1 LCD panel

LCD24x2 

24x2 LCD panel

LCD24x4D 

24x4 LCD panel, special mode KS0078

LCD40x2 

40x2 LCD panel

LCD40x4 

40x4 LCD panel, Two controller version

Definition at line 403 of file TextLCD.h.


Constructor & Destructor Documentation

TextLCD_SPI_N_3_24 ( SPI *  spi,
PinName  cs,
LCDType  type = LCD16x2,
PinName  bl = NC,
LCDCtrl  ctrl = SSD1803_3V3 
)

Create a TextLCD interface using a controller with native SPI3 24 bits interface Note: lib uses SPI 8 bit mode.

Create a TextLCD interface using a controller with a native SPI3 24 bits interface.

Parameters:
spiSPI Bus
cschip select pin (active low)
typeSets the panel size/addressing mode (default = LCD16x2)
blBacklight control line (optional, default = NC)
ctrlLCD controller (default = SSD1803)

Definition at line 2864 of file TextLCD.cpp.


Member Function Documentation

int _address ( int  column,
int  row 
) [protected, inherited]

Low level character address set method.

Definition at line 1250 of file TextLCD.cpp.

void _init (  ) [protected, inherited]

Low level method for LCD controller.

Init the LCD Controller(s) Clear display.

Definition at line 156 of file TextLCD.cpp.

void _initCtrl (  ) [protected, inherited]

Low level initialisation method for LCD controller.

Init the LCD controller 4-bit mode, number of lines, fonttype, no cursor etc.

Note: some configurations are commented out because they have not yet been tested due to lack of hardware

Definition at line 179 of file TextLCD.cpp.

int _putc ( int  value ) [protected, virtual, inherited]

Write a single character (Stream implementation)

Definition at line 1152 of file TextLCD.cpp.

void _setCursor ( LCDCursor  show ) [protected, inherited]

Low level cursor enable or disable method.

void _setCursorAndDisplayMode ( LCDMode  displayMode,
LCDCursor  cursorType 
) [protected, inherited]

Low level method to restore the cursortype and display mode for current controller.

Definition at line 1544 of file TextLCD.cpp.

void _setUDC ( unsigned char  c,
char *  udc_data 
) [protected, inherited]

Low level method to store user defined characters for current controller.

Definition at line 1599 of file TextLCD.cpp.

void _writeCommand ( int  command ) [protected, inherited]

Low level command byte write operation to LCD controller.

Methods resets the RS bit and provides the required timing for the command.

Definition at line 1227 of file TextLCD.cpp.

void _writeData ( int  data ) [protected, inherited]

Low level data byte write operation to LCD controller (serial or parallel).

Methods sets the RS bit and provides the required timing for the data.

Definition at line 1237 of file TextLCD.cpp.

void _writeNibble ( int  value ) [protected, inherited]

Low level nibble write operation to LCD controller (serial or parallel)

Definition at line 1195 of file TextLCD.cpp.

void cls (  ) [inherited]

Clear the screen and locate to 0,0.

Clear the screen, Cursor home.

Definition at line 1103 of file TextLCD.cpp.

int columns (  ) [inherited]

Return the number of columns.

Parameters:
returnThe number of columns
returnThe number of columns

Note: some configurations are commented out because they have not yet been tested due to lack of hardware

Definition at line 1464 of file TextLCD.cpp.

int getAddress ( int  column,
int  row 
) [inherited]

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 1264 of file TextLCD.cpp.

void locate ( int  column,
int  row 
) [inherited]

Locate cursor 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 1139 of file TextLCD.cpp.

int printf ( const char *  format,
  ... 
) [inherited]

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 ) [inherited]

Write a character to the LCD.

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

Return the number of rows.

Parameters:
returnThe number of rows
returnThe number of rows

Note: some configurations are commented out because they have not yet been tested due to lack of hardware

Definition at line 1477 of file TextLCD.cpp.

void setAddress ( int  column,
int  row 
) [inherited]

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 1430 of file TextLCD.cpp.

void setBacklight ( LCDBacklight  backlightMode ) [inherited]

Set the Backlight mode.

Parameters:
backlightModeThe Backlight mode (LightOff, LightOn)

Definition at line 1554 of file TextLCD.cpp.

void setContrast ( unsigned char  c = LCD_DEF_CONTRAST ) [inherited]

Set Contrast setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation Code imported from fork by JH1PJL.

Set Contrast setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation Initial code for ST70XX imported from fork by JH1PJL.

Parameters:
unsignedchar c contrast data (6 significant bits, valid range 0..63, Value 0 will disable the Vgen)
Returns:
none

Definition at line 1706 of file TextLCD.cpp.

void setCursor ( LCDCursor  cursorMode ) [inherited]

Set the Cursormode.

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

Definition at line 1488 of file TextLCD.cpp.

void setMode ( LCDMode  displayMode ) [inherited]

Set the Displaymode.

Parameters:
displayModeThe Display mode (DispOff, DispOn)

Definition at line 1501 of file TextLCD.cpp.

void setOrient ( LCDOrient  orient = Top ) [inherited]

Set Orient setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes.

Parameters:
LCDOrientorient Orientation
Returns:
none

Definition at line 1849 of file TextLCD.cpp.

void setPower ( bool  powerOn = true ) [inherited]

Set Power setPower method is supported by some compatible devices (eg SSD1803) that have power down modes.

Parameters:
boolpowerOn Power on/off
Returns:
none

Definition at line 1777 of file TextLCD.cpp.

void setUDC ( unsigned char  c,
char *  udc_data 
) [inherited]

Set User Defined Characters (UDC)

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 1569 of file TextLCD.cpp.

void setUDCBlink ( LCDBlink  blinkMode ) [inherited]

Set UDC Blink setUDCBlink method is supported by some compatible devices (eg SSD1803)

Parameters:
blinkModeThe Blink mode (BlinkOff, BlinkOn)

Definition at line 1620 of file TextLCD.cpp.