Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otLCD Class Reference
[LCD library, LCD library]

LCD library.

#include <otLCD.h>

Inheritance diagram for otLCD:

otTextUI

Public Types

enum  GraphTypes { VERTICAL_BAR_GRAPH = 1, HORIZONTAL_BAR_GRAPH = 2, HORIZONTAL_LINE_GRAPH = 3 }

Public Member Functions

 otLCD ()
void init (U8 cols, U8 lines, U8 charsize=0, U8 add=0x27)
U32 print (int col, int row, const char *format,...)
void clear ()
void clear (U8 rowStart, U8 colStart=0, U8 colCnt=255)
void setCursor (U8 col, U8 row)
void backLight (bool ena=true)
void display (bool ena=true)
void cursor (bool ena=true)
void blink (bool ena=true)
void autoscroll (bool ena=true)
void scroll (bool left=true)
void textFlow (bool leftToRight=true)
void newChar (U8 location, const U8 charmap[])
bool bargraph (U8 graphtype)
void drawHorizontalGraph (U8 row, U8 column, U8 len, U8 pixel_col_end)
void drawHorizontalGraph (U8 row, U8 column, U8 len, U16 percentage)
void drawHorizontalGraph (U8 row, U8 column, U8 len, F32 ratio)
void drawVerticalGraph (U8 row, U8 column, U8 len, U8 pixel_row_end)
void drawVerticalGraph (U8 row, U8 column, U8 len, U16 percentage)
void drawVerticalGraph (U8 row, U8 column, U8 len, F32 ratio)
void home ()
void command (U8 value)
U32 write (U8 value)

Member Enumeration Documentation

enum otLCD::GraphTypes
 

Enumeration values:
VERTICAL_BAR_GRAPH  Vertical bar, like an histogram.
HORIZONTAL_BAR_GRAPH  Horizontal bar with character height.
HORIZONTAL_LINE_GRAPH  Horizontal bar witth 1 pixel height.


Constructor & Destructor Documentation

otLCD.otLCD (   ) 
 

Create the class


Member Function Documentation

void otLCD.autoscroll (  bool  ena = true  ) 
 

This will 'right justify' text from the cursor

Parameters:
ena True 'right justify'

void otLCD.backLight (  bool  ena = true  ) 
 

Turn on/off LCD backlight

Parameters:
ena True turn on backlight

bool otLCD.bargraph (  U8  graphtype  ) 
 

Create a bargraph according selected type

Parameters:
graphtype See GraphTypes
Returns:
True on success

void otLCD.blink (  bool  ena = true  ) 
 

Turn on/off blink of display cursor.

Parameters:
ena True turn on blink of display cursor

void otLCD.clear (  U8  rowStart,
U8  colStart = 0,
U8  colCnt = 255
) 
 

Clear selected region of display

Parameters:
rowStart Start row
colStart Start column
colCnt Number of columns

void otLCD.clear (   ) 
 

Clear display

void otLCD.command (  U8  value  ) 
 

Mid level commands, for sending data/cmds

Parameters:
value Command to write

void otLCD.cursor (  bool  ena = true  ) 
 

Turn on/off display cursor

Parameters:
ena True turn on display cursor

void otLCD.display (  bool  ena = true  ) 
 

Turn on/off LCD

Parameters:
ena True turn on display

void otLCD.drawHorizontalGraph (  U8  row,
U8  column,
U8  len,
F32  ratio
) 
 

Overloaded methods with type difference of graph value

Parameters:
row Row position of graph segment counting from 0
column Column position of graph segment counting from 0
len Length of graph segment in characters
ratio Fraction of graph segment as graph value. Expected range is 0.0 to 1.0

void otLCD.drawHorizontalGraph (  U8  row,
U8  column,
U8  len,
U16  percentage
) 
 

Overloaded methods with type difference of graph value

Parameters:
row Row position of graph segment counting from 0
column Column position of graph segment counting from 0
len Length of graph segment in characters
percentage Percentage of graph segment as graph value although expected range is 0 to 100

void otLCD.drawHorizontalGraph (  U8  row,
U8  column,
U8  len,
U8  pixel_col_end
) 
 

Display horizontal graph from desired cursor position with input value

Parameters:
row Row position of graph segment counting from 0
column Column position of graph segment counting from 0
len Length of graph segment in characters
pixel_col_end value of graph in pipes counting from 0. Limited to physical horizontal dots of graph segment.

void otLCD.drawVerticalGraph (  U8  row,
U8  column,
U8  len,
F32  ratio
) 
 

Overloaded methods with type difference of graph value

Parameters:
row Row position of graph segment counting from 0
column Column position of graph segment counting from 0
len Length of graph segment in characters
ratio Fraction of graph segment as graph value. Expected range is 0.0 to 1.0

void otLCD.drawVerticalGraph (  U8  row,
U8  column,
U8  len,
U16  percentage
) 
 

Overloaded methods with type difference of graph value

Parameters:
row Row position of graph segment counting from 0
column Column position of graph segment counting from 0
len Length of graph segment in characters
percentage Percentage of graph segment as graph value although expected range is 0 to 100

void otLCD.drawVerticalGraph (  U8  row,
U8  column,
U8  len,
U8  pixel_row_end
) 
 

Display vertical graph from desired cursor position with input value.

Parameters:
row Row positon of the bottom of a graph segment counting from 0
column Column position of graph segment counting from 0 limited to physical columns.
len Length of graph segment in rows. Limited to remaining physical rows from row position.
pixel_row_end Value of graph in dashes counting from 0. Limited to physical vertical dots of graph segment.

void otLCD.home (   ) 
 

Set cursor position to zero. This command takes a long time!

void otLCD.init (  U8  cols,
U8  lines,
U8  charsize = 0,
U8  add = 0x27
) 
 

Init the class

Parameters:
cols Number of LCD columns, 16, 20, ...
lines Numer of display lines 1, 2, 4, ...
charsize 0 for default 5x8 dots else 5x10 dots
add Possible address: 0x20 to 0x27

void otLCD.newChar (  U8  location,
const U8  charmap[]
) 
 

Allows us to fill the first 8 CGRAM locations with custom characters

Parameters:
location 0 to 7
charmap Character definition
 U8 bell[8]     = { 0x04, 0x0e, 0x0e, 0x0e, 0x1f, 0x00, 0x04 };
 U8 note[8]     = { 0x02, 0x03, 0x02, 0x0e, 0x1e, 0x0c, 0x00 };
 U8 clock[8]    = { 0x00, 0x0e, 0x15, 0x17, 0x11, 0x0e, 0x00 };
 U8 heart[8]    = { 0x00, 0x0a, 0x1f, 0x1f, 0x0e, 0x04, 0x00 };
 U8 duck[8]     = { 0x00, 0x0c, 0x1d, 0x0f, 0x0f, 0x06, 0x00 };
 U8 check[8]    = { 0x00, 0x01, 0x03, 0x16, 0x1c, 0x08, 0x00 };
 U8 cross[8]    = { 0x00, 0x1b, 0x0e, 0x04, 0x0e, 0x1b, 0x00 };
 U8 retarrow[8] = { 0x01, 0x01, 0x05, 0x09, 0x1f, 0x08, 0x04 };

 lcd.newChar(0, bell);
 lcd.newChar(1, note);
 lcd.newChar(2, clock);
 lcd.newChar(3, heart);
 lcd.newChar(4, duck);
 lcd.newChar(5, check);
 lcd.newChar(6, cross);
 lcd.newChar(7, retarrow);

U32 otLCD.print (  int  col,
int  row,
const char *  format,
  ...
) 
 

Like printf but with cursor positioning

Parameters:
col Start column for print
row Start row for print
format See printf function ...
... Arguments list
Returns:
Printed characters

void otLCD.scroll (  bool  left = true  ) 
 

Select how to do text scroll. These commands scroll the display without changing the RAM

Parameters:
left True text scroll in left direction

void otLCD.setCursor (  U8  col,
U8  row
) 
 

Set cursor position

Parameters:
col Column
row Row

void otLCD.textFlow (  bool  leftToRight = true  ) 
 

This is for text that flows Left to Right or viceversa

Parameters:
leftToRight True for Left to Right

U32 otLCD.write (  U8  value  ) 
 

Write a character on display

Parameters:
value Character to print


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0