Serial Wombat Arduino Library

Loading...
Searching...
No Matches
Public Member Functions | List of all members
SerialWombatLiquidCrystal Class Reference

A Class which connects to HD44780 / 1602 / 4002 / 2004 or similar interface Character LCDs. More...

`#include <SerialWombatLiquidCrystal.h>`

Inheritance diagram for SerialWombatLiquidCrystal:
[legend]
Collaboration diagram for SerialWombatLiquidCrystal:
[legend]

## Public Member Functions
| SerialWombatLiquidCrystal (SerialWombatChip &serialWombat, uint8_t rs, uint8_t enable, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
| Class constructor for SerialWombatLiquidCrystal.
int16_t | begin (uint8_t cols=80, uint8_t rows=1)
| Initialization routine for SerialWombatLiquidCrystal.
int16_t | clear (bool delayAfterClear=true)
| Clear the LCD display.
int16_t | home (bool delayAfterHome=true)
| Set the LCD cursor / entry position to the 0,0 position.
int16_t | setCursor (uint8_t col, uint8_t row)
| Set the cursor / next entry position.
int16_t | noCursor ()
| Makes the cursor invisible.
int16_t | cursor ()
| Makes the cursor visible.
int16_t | blink ()
| Makes the cursor blink.
int16_t | noBlink ()
| Makes the cursor not blink.
int16_t | display ()
| Enables LCD display.
int16_t | noDisplay ()
| Disables LCD display.
int16_t | scrollDisplayLeft ()
| Display moves left when scrolling.
int16_t | scrollDisplayRight ()
| Display moves right when scrolling.
int16_t | autoscroll ()
| Turn on autoscrolling mode on the LCD display (not in the Serial Wombat chip)
int16_t | noAutoscroll ()
| Turn off autoscrolling mode on the LCD display (not in the Serial Wombat chip)
int16_t | leftToRight ()
| LCD Display entry occurs left to right.
int16_t | rightToLeft ()
| LCD Display entry occurs right to left.
size_t | write (uint8_t data)
| Write a byte of data directly to the LCD.
size_t | write (uint8_t *buffer, size_t count)
| Write an array of data directly to the LCD.
int16_t | createChar (uint8_t index, uint8_t bitmap[])
| Write bitmap data to the display for custom characters.
int16_t | setRowOffsets (uint8_t row1, uint8_t row2, uint8_t row3, uint8_t row4)
| Set the offsets in the LCD on-board memory for the beginning of each row.
int16_t | command (uint8_t cmd)
| send a command directly to the LCD
uint8_t | pin ()
| returns the e pin number. Override for use with classes that require this as a virtual function
uint8_t | swPinModeNumber ()
| returns the pin mode number. Override for use with classes that require this as a virtual function
int16_t | initializeBufferCopy (uint16_t bufferIndex, uint8_t width=255)
| kicks off the Serial Wombat chip state machine that copies one character to the LCD each second from a buffer
int16_t | beginE2 (uint8_t e2Pin)
| Add a second e pin for use wtih 40x4 LCD displays.
Public Member Functions inherited from SerialWombatPin
| SerialWombatPin (SerialWombatChip &serialWombatChip)
| Instantiates a Serial Wombat Pin.
| SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin)
| Instantiates a Serial Wombat Pin.
uint16_t | readPublicData ()
| Read the 16 Bit public data associated with this pin.
void | pinMode (uint8_t mode, bool pullDown=false, bool openDrain=false)
| Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings.
void | digitalWrite (uint8_t val)
| Set output pin High or Low.
int | digitalRead ()
| Reads the state of the Pin.
uint16_t | writePublicData (uint16_t value)
| Write a 16 bit value to this pin.
uint8_t | pin ()
| Returns the current SW pin number. Used primarily for virtual calls by derived classes.
uint8_t | swPinModeNumber ()
| Returns the Mode number. Used primarily by derived classes to populate packet data.
int16_t | initPacketNoResponse (uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55)
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55)
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0, uint16_t param1, uint8_t param2=0x55)
int16_t | disable ()
| Disables the pin mode (if applicable)
int16_t | enablePullup (bool enabled)
| Enables the weak pull up on a pin. Implemented on SW18AB only.
int16_t | enablePullDown (bool enabled)
| Enables the weak pull down on a pin. Implemented on SW18AB only.
int16_t | enableOpenDrain (bool enabled)
| Enables open drain mode on a pin. Implemented on SW18AB only.

## Additional Inherited Members
Protected Attributes inherited from SerialWombatPin
uint8_t | _pin = 255
SerialWombatChip & | _sw
uint8_t | _pinMode = 0

## Detailed Description

A Class which connects to HD44780 / 1602 / 4002 / 2004 or similar interface Character LCDs.

This pin mode has nearly identical interfaces to the classic Arduino LiquidCrystal library and can be used with similar parallel character LCDs. This pin mode is only intended for use with character LCDs that are connected in 4 bit parallel (E, RS, D4, D5, D6, D7) with the Serial Wombat chip. RW pin on the LCD must be grounded.

In addition to the classic LiquidCrystal interfaces, this pin mode has a more advanced mode avaialble through the initializeBufferCopy() interface which allows displays to be updated from data stored in the Serial Wombat Chip's User Buffer. The Serial Wombat chip will handle getting the right data to the right location on the display. This is convenient for displays such as 20x4 displays which alternate lines when addressing. When combined with a shifting queue initialized with SerialWombatQueueType::QUEUE_TYPE_RAM_BYTE_SHIFT, the display can be treated like any other Stream Class under Arduino. See the Arduino examples directory for an example of this.

This class also supports buffer copying to large 40x4 character LCDs that have two E lines. These displays are essentially two 44780 controllers connected to a single piece of glass. See the example in the Arduino examples directory.

E and E2 lines must be exclusive to a single LCD display. If multiple LCDs are attached to a single Serial Wombat Chip then RS, D4, D5, D6, and D7 can be shared by both displays.

When in buffer mode the class updates one character per mS.

A video Tutorial on this pin mode is available:

//TODO

TODO https://youtu.be/

Definition at line 68 of file SerialWombatLiquidCrystal.h.

## Constructor & Destructor Documentation

## ◆ SerialWombatLiquidCrystal()

SerialWombatLiquidCrystal::SerialWombatLiquidCrystal | ( | SerialWombatChip & | serialWombat,
|  | uint8_t | rs,
|  | uint8_t | enable,
|  | uint8_t | d4,
|  | uint8_t | d5,
|  | uint8_t | d6,
|  | uint8_t | d7 )
| inline

Class constructor for SerialWombatLiquidCrystal.

Parameters

  serialWombat | The Serial Wombat chip on which the SerialWombatLiquidCrystal pin mode will run
  rs | The Serial Wombat Pin connected to the LCD rs pin.
  enable | The Serial Wombat pin connected to the LCD e pin.
  d4 | The Serial Wombat pin connected to the LCD d4 pin.
  d5 | The Serial Wombat pin connected to the LCD d5 pin.
  d6 | The Serial Wombat pin connected to the LCD d6 pin.
  d7 | The Serial Wombat pin connected to the LCD d7 pin.

Definition at line 82 of file SerialWombatLiquidCrystal.h.

## Member Function Documentation

## ◆ autoscroll()

int16_t SerialWombatLiquidCrystal::autoscroll | ( |  | ) |
| inline

Turn on autoscrolling mode on the LCD display (not in the Serial Wombat chip)

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 330 of file SerialWombatLiquidCrystal.h.

## ◆ begin()

int16_t SerialWombatLiquidCrystal::begin | ( | uint8_t | cols = 80,
|  | uint8_t | rows = 1 )
| inline

Initialization routine for SerialWombatLiquidCrystal.

Parameters

  cols | The width of the LCD in characters
  rows | The height of the LCD in character rows

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 101 of file SerialWombatLiquidCrystal.h.

## ◆ beginE2()

int16_t SerialWombatLiquidCrystal::beginE2 | ( | uint8_t | e2Pin | ) |
| inline

Add a second e pin for use wtih 40x4 LCD displays.

This commands causes the Serial Wombat chip to do a second initialization of a display. This is commonly required for 40x4 LCDs which are essenctially two LCD drivers attached to the same glass, one driver per two 40 character lines.

This is only used when using the initializeBufferCopy() mode of this pin mode. When this value is not set 80 bytes are copied to the display attached to the e pin. When this value is set, 80 bytes are copied to the display attached to the e pin, followed by an additional 80 bytes attached to the e2 pin.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 644 of file SerialWombatLiquidCrystal.h.

## ◆ blink()

int16_t SerialWombatLiquidCrystal::blink | ( |  | ) |
| inline

Makes the cursor blink.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 228 of file SerialWombatLiquidCrystal.h.

## ◆ clear()

int16_t SerialWombatLiquidCrystal::clear | ( | bool | delayAfterClear = true | ) |
| inline

Clear the LCD display.

By default this function delays 2 to 3 mS after issuing the command to be compatible with LiquidCrystal::clear This library adds an optional parameter that eliminates this delay.

Parameters

  delay | Whether or not to block for 2mS after issuing the command

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 136 of file SerialWombatLiquidCrystal.h.

## ◆ command()

int16_t SerialWombatLiquidCrystal::command | ( | uint8_t | cmd | ) |
| inline

send a command directly to the LCD

Parameters

  cmd | Byte to be sent to the LCD while the RS line is set to command

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 571 of file SerialWombatLiquidCrystal.h.

## ◆ createChar()

int16_t SerialWombatLiquidCrystal::createChar | ( | uint8_t | index,
|  | uint8_t | bitmap[] )
| inline

Write bitmap data to the display for custom characters.

Parameters

  index | The character to be written. Valid values are typically 0-7
  bitmap | An array of 7 bytes which represent the character. bitmap[0] is the top, Least significant bit is the rightmost pixel. 1 is black pixel

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 506 of file SerialWombatLiquidCrystal.h.

## ◆ cursor()

int16_t SerialWombatLiquidCrystal::cursor | ( |  | ) |
| inline

Makes the cursor visible.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 210 of file SerialWombatLiquidCrystal.h.

## ◆ display()

int16_t SerialWombatLiquidCrystal::display | ( |  | ) |
| inline

Enables LCD display.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 267 of file SerialWombatLiquidCrystal.h.

## ◆ home()

int16_t SerialWombatLiquidCrystal::home | ( | bool | delayAfterHome = true | ) |
| inline

Set the LCD cursor / entry position to the 0,0 position.

By default this function delays 2 to 3 mS after issuing the command to be compatible with LiquidCrystal::home This library adds an optional parameter that eliminates this delay.

Parameters

  delay | Whether or not to block for 2mS after issuing the command

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 156 of file SerialWombatLiquidCrystal.h.

## ◆ initializeBufferCopy()

int16_t SerialWombatLiquidCrystal::initializeBufferCopy | ( | uint16_t | bufferIndex,
|  | uint8_t | width = 255 )
| inline

kicks off the Serial Wombat chip state machine that copies one character to the LCD each second from a buffer

This function extends the LiquidCrystal functionality by adding a state machine that runs on the Serial Wombat chip This state machine copies a byte every ms from an index into the User Buffer area to the LCD. It uses the offsets set using setRowOffsets() and the width parameter to automatically format the data from the User Buffer into lines in the proper order. When used with the SerialWombatQueueType::QUEUE_TYPE_RAM_BYTE_SHIFT type queue to create a FIFO style display.

Parameters

  bufferIndex | Index into the User Buffer where data copy starts. When using a shifted Queue, this is the queue address + 8.
  width | The width data to copy on each line. Defaults to the number of columns specified in begin() if not provided.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 612 of file SerialWombatLiquidCrystal.h.

## ◆ leftToRight()

int16_t SerialWombatLiquidCrystal::leftToRight | ( |  | ) |
| inline

LCD Display entry occurs left to right.

Note that this command has no effect in initializeBufferCopy() mode.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 370 of file SerialWombatLiquidCrystal.h.

## ◆ noAutoscroll()

int16_t SerialWombatLiquidCrystal::noAutoscroll | ( |  | ) |
| inline

Turn off autoscrolling mode on the LCD display (not in the Serial Wombat chip)

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 349 of file SerialWombatLiquidCrystal.h.

## ◆ noBlink()

int16_t SerialWombatLiquidCrystal::noBlink | ( |  | ) |
| inline

Makes the cursor not blink.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 247 of file SerialWombatLiquidCrystal.h.

## ◆ noCursor()

int16_t SerialWombatLiquidCrystal::noCursor | ( |  | ) |
| inline

Makes the cursor invisible.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 192 of file SerialWombatLiquidCrystal.h.

## ◆ noDisplay()

int16_t SerialWombatLiquidCrystal::noDisplay | ( |  | ) |
| inline

Disables LCD display.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 286 of file SerialWombatLiquidCrystal.h.

## ◆ pin()

uint8_t SerialWombatLiquidCrystal::pin | ( |  | ) |
| inline

returns the e pin number. Override for use with classes that require this as a virtual function

Returns
  Pin number of the e pin

Definition at line 590 of file SerialWombatLiquidCrystal.h.

## ◆ rightToLeft()

int16_t SerialWombatLiquidCrystal::rightToLeft | ( |  | ) |
| inline

LCD Display entry occurs right to left.

Note that this command has no effect in initializeBufferCopy() mode.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 390 of file SerialWombatLiquidCrystal.h.

## ◆ scrollDisplayLeft()

int16_t SerialWombatLiquidCrystal::scrollDisplayLeft | ( |  | ) |
| inline

Display moves left when scrolling.

Note that this command has no effect in initializeBufferCopy() mode.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 307 of file SerialWombatLiquidCrystal.h.

## ◆ scrollDisplayRight()

int16_t SerialWombatLiquidCrystal::scrollDisplayRight | ( |  | ) |
| inline

Display moves right when scrolling.

Note that this command has no effect in initializeBufferCopy() mode.

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 320 of file SerialWombatLiquidCrystal.h.

## ◆ setCursor()

int16_t SerialWombatLiquidCrystal::setCursor | ( | uint8_t | col,
|  | uint8_t | row )
| inline

Set the cursor / next entry position.

Parameters

  col | Column to set
  row | Row to set

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 173 of file SerialWombatLiquidCrystal.h.

## ◆ setRowOffsets()

int16_t SerialWombatLiquidCrystal::setRowOffsets | ( | uint8_t | row1,
|  | uint8_t | row2,
|  | uint8_t | row3,
|  | uint8_t | row4 )
| inline

Set the offsets in the LCD on-board memory for the beginning of each row.

These values are used for the setCursor() and initializeBufferCopy() functions and should be set before these functions are called.
An Arduino example is avaiable which displays addresses on the LCD which correspond to the parameters to this function to help the user determine proper values.

Parameters

  row1 | The offset of the top first row
  row2 | The offset of the second row
  row3 | The offset of the third row
  row4 | The offset of the fourth row

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 543 of file SerialWombatLiquidCrystal.h.

## ◆ swPinModeNumber()

uint8_t SerialWombatLiquidCrystal::swPinModeNumber | ( |  | ) |
| inline

returns the pin mode number. Override for use with classes that require this as a virtual function

Returns
  Pin mode of the current pin

Definition at line 597 of file SerialWombatLiquidCrystal.h.

## ◆ write() [1/2]

size_t SerialWombatLiquidCrystal::write | ( | uint8_t * | buffer,
|  | size_t | count )
| inline

Write an array of data directly to the LCD.

Use this command if using the LCD like a classic LiquidCrystal display. Do not use this command if in initializeBufferCopy() mode.

Parameters

  buffer | address of a buffer to be written to the display
  count | number of bytes to write to the display

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 442 of file SerialWombatLiquidCrystal.h.

## ◆ write() [2/2]

size_t SerialWombatLiquidCrystal::write | ( | uint8_t | data | ) |
| inline

Write a byte of data directly to the LCD.

Use this command if using the LCD like a classic LiquidCrystal display. Do not use this command if in initializeBufferCopy() mode.

Parameters

  data | A byte of data to write to the display

Returns
  returns a number 0 or greater for success, negative numbers indicate an error occured.

Definition at line 413 of file SerialWombatLiquidCrystal.h.