LiquidCrystalIO
Loading...
Searching...
No Matches
LiquidCrystal Class Reference

#include <LiquidCrystalIO.h>

Inheritance diagram for LiquidCrystal:

Public Types

enum  BackLightPinMode { BACKLIGHT_NORMAL , BACKLIGHT_INVERTED , BACKLIGHT_PWM }

Public Member Functions

 LiquidCrystal ()
 LiquidCrystal (uint8_t rs, uint8_t rw, uint8_t en, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, LiquidCrystal::BackLightPinMode mode, IoAbstractionRef ioMethod)
 LiquidCrystal (uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, BasicIoAbstraction *ioMethod=NULL)
 LiquidCrystal (uint8_t rs, uint8_t rw, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, BasicIoAbstraction *ioMethod=NULL)
 LiquidCrystal (uint8_t rs, uint8_t rw, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, BasicIoAbstraction *ioMethod=NULL)
 LiquidCrystal (uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, BasicIoAbstraction *ioMethod=NULL)
void init (uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7, BasicIoAbstraction *ioMethod)
void setIoAbstraction (IoAbstractionRef ioRef)
void configureBacklightPin (uint8_t backlightPin, BackLightPinMode mode=LiquidCrystal::BACKLIGHT_NORMAL)
void configureAnalogBacklight (AnalogDevice *analogDevice, uint8_t backlightPin)
void setDelayTime (uint8_t command, uint8_t settleTime)
void begin (uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)
void clear ()
void home ()
void backlight ()
void noBacklight ()
void setBacklight (uint8_t state)
void noDisplay ()
void display ()
void noBlink ()
void blink ()
void noCursor ()
void cursor ()
void scrollDisplayLeft ()
void scrollDisplayRight ()
void leftToRight ()
void rightToLeft ()
void autoscroll ()
void noAutoscroll ()
void setRowOffsets (int row1, int row2, int row3, int row4)
void createChar (uint8_t charNo, const uint8_t data[])
void createCharPgm (uint8_t, const uint8_t[])
void setCursor (uint8_t x, uint8_t y)
size_t write (uint8_t ch) override
void command (uint8_t)

Detailed Description

LiquidCrystalIO library works with displays that are compatible with the HD44780 driver. It is derived from the Arduino version, but it supports I2C backpacks and many other configurations. In addition it also uses taskmanager to manage any delays needed for the display hardware, thus reducing the overhead.

Member Enumeration Documentation

◆ BackLightPinMode

We support several backlight options, when setting the backlight configuration choose one of the below

Enumerator
BACKLIGHT_NORMAL 

the backlight is active HIGH

BACKLIGHT_INVERTED 

the backlight is active LOW

BACKLIGHT_PWM 

the backlight is connected directly to a PWM pin

Constructor & Destructor Documentation

◆ LiquidCrystal() [1/6]

LiquidCrystal::LiquidCrystal ( )

Sets up the library to work with a DfRobot shield connected on regular pins. For this no configuration is needed.

◆ LiquidCrystal() [2/6]

LiquidCrystal::LiquidCrystal ( uint8_t rs,
uint8_t rw,
uint8_t en,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
LiquidCrystal::BackLightPinMode mode,
IoAbstractionRef ioMethod )

Used by the two helpers that can quickly create an instance of LiquidCrystal for most I2C backpacks. Normally you would use LiquidCrystalI2C_RS_EN or LiquidCrystalI2C_EN_RS instead. An example of using of those helpers is shown below.

At global level (outside of any functions):

LiquidCrystalI2C_RS_EN(variableName, i2cAddr, invertBacklight)

where variableName is the variable name to assign to. For example lcd i2cAddr is the i2c address of the backpack, for example 0x20 invertBacklight true if the backlight function is inverted, otherwise false

Example: variable name lcd, I2C backpack on addr 0x20, with EN-RW-RS arrangement, inverted backlight function:

LiquidCrystalI2C_EN_RS(lcd, 0x20, true)

Parameters
rsthe pin on which RS is connected
rwthe pin on which RW is connected
enablethe pin on which EN is connected
d0data pin
d1data pin
d2data pin
d3data pin
modethe backlight mode from the BackLightPinMode enum
ioMethodthe IO device to use

◆ LiquidCrystal() [3/6]

LiquidCrystal::LiquidCrystal ( uint8_t rs,
uint8_t enable,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
uint8_t d4,
uint8_t d5,
uint8_t d6,
uint8_t d7,
BasicIoAbstraction * ioMethod = NULL )

Sets up liquid crystal in 8 bit mode, optionally providing an IoDevice abstraction

Parameters
rsthe pin on which RS is connected
enablethe pin on which EN is connected
d0data pin
d1data pin
d2data pin
d3data pin
d4data pin
d5data pin
d6data pin
d7data pin
ioMethodoptionally an IoAbstractionRef to a different IO device.

◆ LiquidCrystal() [4/6]

LiquidCrystal::LiquidCrystal ( uint8_t rs,
uint8_t rw,
uint8_t enable,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
uint8_t d4,
uint8_t d5,
uint8_t d6,
uint8_t d7,
BasicIoAbstraction * ioMethod = NULL )

Sets up liquid crystal in 8 bit mode, optionally providing an IoDevice abstraction

Parameters
rsthe pin on which RS is connected
rwthe pin on which RW is connected
enablethe pin on which EN is connected
d0data pin
d1data pin
d2data pin
d3data pin
d4data pin
d5data pin
d6data pin
d7data pin
ioMethodoptionally an IoAbstractionRef to a different IO device.

◆ LiquidCrystal() [5/6]

LiquidCrystal::LiquidCrystal ( uint8_t rs,
uint8_t rw,
uint8_t enable,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
BasicIoAbstraction * ioMethod = NULL )

Sets up liquid crystal in 4 bit mode, optionally providing an IoDevice abstraction

Parameters
rsthe pin on which RS is connected
rwthe pin on which RW is connected
enablethe pin on which EN is connected
d0data pin
d4data pin
d5data pin
d6data pin
d7data pin
ioMethodoptionally an IoAbstractionRef to a different IO device.

◆ LiquidCrystal() [6/6]

LiquidCrystal::LiquidCrystal ( uint8_t rs,
uint8_t enable,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
BasicIoAbstraction * ioMethod = NULL )

Sets up liquid crystal in 4 bit mode, optionally providing an IoDevice abstraction

Parameters
rsthe pin on which RS is connected
enablethe pin on which EN is connected
d4data pin
d5data pin
d6data pin
d7data pin
ioMethodoptionally an IoAbstractionRef to a different IO device.

Member Function Documentation

◆ init()

void LiquidCrystal::init ( uint8_t fourbitmode,
uint8_t rs,
uint8_t rw,
uint8_t enable,
uint8_t d0,
uint8_t d1,
uint8_t d2,
uint8_t d3,
uint8_t d4,
uint8_t d5,
uint8_t d6,
uint8_t d7,
BasicIoAbstraction * ioMethod )

Internal method not normally called by users of the library directly. Called by all the other constructors to actually do the main initialisation of the LCD

Parameters
fourbitmodeif the device is operating in 4 or 8 bit method
rsthe pin on which RS is connected
rwthe pin on which RW is connected
enablethe pin on which EN is connected
d0data pin
d1data pin
d2data pin
d3data pin
d4data pin
d5data pin
d6data pin
d7data pin
ioMethodthe IoAbstractionRef or nullptr if not set.

◆ setIoAbstraction()

void LiquidCrystal::setIoAbstraction ( IoAbstractionRef ioRef)
inline

Sets the device that will be used, IE where the LCD pins are connected to.

Parameters
ioRefthe reference to an IO device previously created.

◆ configureBacklightPin()

void LiquidCrystal::configureBacklightPin ( uint8_t backlightPin,
BackLightPinMode mode = LiquidCrystal::BACKLIGHT_NORMAL )

Configure a backlight pin that is used to control the backlight using the setBacklight(level) function. Depending on the type of display you have this may be either:

◆ configureAnalogBacklight()

void LiquidCrystal::configureAnalogBacklight ( AnalogDevice * analogDevice,
uint8_t backlightPin )

This function gives more control over how the PWM/DAC/AnalogOut based backlight is configured, you can provide an analog device, you can specifically tell the analog device if it is PWM or DAC mode. For many cases the regular configureBacklightPin would work.

Parameters
analogDevicethe analog device to use to set the backlight
backlightPinthe pin on which the backlight is set.
isPinPwmif the pin on the provided device is a PWM or DAC pin

◆ setDelayTime()

void LiquidCrystal::setDelayTime ( uint8_t command,
uint8_t settleTime )
inline

Sets the delay for a given command, at this moment, this can only set the settle time of a standard command.

Parameters
commandthe command to set the delay for, presently only the settle time.
settleTimethe new value of the delay in microseconds.

◆ begin()

void LiquidCrystal::begin ( uint8_t cols,
uint8_t rows,
uint8_t charsize = LCD_5x8DOTS )

Unlike the regular display where this is option, in this variant you absolutely must call this function before use.

Parameters
colsthe number of colums
rowsthe number of rows
charsizethe character size, defaulted to 5x8

◆ clear()

void LiquidCrystal::clear ( )

Clears the display completely using the clear command on the device, warning that this is a very slow call taking at least 2000 micros.

◆ home()

void LiquidCrystal::home ( )

Moves the display back to the home position, calling setCursor(0,0) is much faster.

◆ backlight()

void LiquidCrystal::backlight ( )
inline

Turn on the backlight

◆ noBacklight()

void LiquidCrystal::noBacklight ( )
inline

Turn off the backlight

◆ setBacklight()

void LiquidCrystal::setBacklight ( uint8_t state)

set the backlight state depending on how it is configured. If it is set to PWM mode, then this can be a value between 0 and the maximum PWM value.

Parameters
state

◆ noDisplay()

void LiquidCrystal::noDisplay ( )

Turn the display off

◆ display()

void LiquidCrystal::display ( )

Turn the display on

◆ noBlink()

void LiquidCrystal::noBlink ( )

Turn off blinking text

◆ blink()

void LiquidCrystal::blink ( )

Turn on blinking text

◆ noCursor()

void LiquidCrystal::noCursor ( )

Turn off the screen cursor

◆ cursor()

void LiquidCrystal::cursor ( )

Turn on the screen cursor

◆ setRowOffsets()

void LiquidCrystal::setRowOffsets ( int row1,
int row2,
int row3,
int row4 )

Internal method that is not really for direct calling by users that initialises the instance with the right memory locations to write rows into.

Parameters
row1the first display row memory
row2the second display row memory
row3the third display row memory
row4the fourth display row memory

◆ createChar()

void LiquidCrystal::createChar ( uint8_t charNo,
const uint8_t data[] )

Create a 5x8 character from RAM. You can set any character between 0 and 7

Parameters
charNothe character number to use
datathe data for the custom character

◆ createCharPgm()

void LiquidCrystal::createCharPgm ( uint8_t location,
const uint8_t charmap[] )

Create a 5x8 character from PROGMEM. You can set any character between 0 and 7

Parameters
charNothe character number to use
datathe data for the custom character - from PROGMEM

◆ setCursor()

void LiquidCrystal::setCursor ( uint8_t x,
uint8_t y )

Sets the cursor position at which the next write will take place

Parameters
xthe x location to move to
ythe y location to move to

◆ write()

size_t LiquidCrystal::write ( uint8_t ch)
inlineoverride

Write a single character to the display and moves the cursor position

Returns
always 1
Parameters
chthe character to write

The documentation for this class was generated from the following files: