Treehopper C# API
Hd44780 Class Reference

HD44780-compatible character display More...

Inheritance diagram for Hd44780:
CharacterDisplay ICharacterDisplay GroveI2cLcd

Public Types

enum  BitMode { FourBit = 0x00, EightBit = 0x10 }
 Whether to use 4 or 8 bits for transactions More...
 
enum  BlinkState { BlinkOff = 0x00, BlinkOn = 0x01 }
 Whether the cursor should blink More...
 
enum  Command {
  ClearDisplay = 0x01, ReturnHome = 0x02, EntryModeSet = 0x04, DisplayControl = 0x08,
  CursorShift = 0x10, FunctionSet = 0x20, SetCgramAddr = 0x40, SetDdramAddr = 0x80
}
 An enumeration of commands the display supports More...
 
enum  CursorState { CursorOff = 0x00, CursorOn = 0x02 }
 The cursor display state More...
 
enum  DisplayState { DisplayOff = 0x00, DisplayOn = 0x04 }
 The display state More...
 
enum  FontMode { Font_5x8 = 0x00, Font_5x10 = 0x04 }
 The font mode to use More...
 
enum  LinesMode { OneLine = 0x00, TwoOrMoreLines = 0x08 }
 Whether the display is single or multi-line More...
 

Public Member Functions

 Hd44780 (WriteOnlyParallelInterface iface, int Columns, int Rows, DigitalOut Backlight=null, FontMode font=FontMode.Font_5x8)
 Construct a new HD44780-compatible display More...
 
Task SetCursorPosition (int left, int top)
 Set left/right cursor position More...
 
Task WriteLine (dynamic value)
 Write a line of text, advancing the cursor to the next line More...
 
async Task Write (dynamic value)
 Write text More...
 
Task Clear ()
 Clear the display and reset the cursor to (0,0) More...
 

Protected Member Functions

override async Task clear ()
 Clear the display More...
 
override Task updateCursorPosition ()
 Update the cursor position More...
 
override Task write (dynamic value)
 Write data to the display at the current cursor position More...
 

Properties

bool Backlight [get, set]
 Enable or disable the backlight More...
 
bool Display [get, set]
 Enable or disable the display More...
 
bool Cursor [get, set]
 Enable or disable the cursor More...
 
bool Blink [get, set]
 Enable or disable cursor blinking More...
 
Collection< string > History = new Collection<string>() [get]
 History of previously-written lines from the display More...
 
Collection< string > Lines = new Collection<string>() [get]
 Current lines of the display More...
 
int Columns [get]
 Number of columns of the display More...
 
int Rows [get]
 Number of rows of the display More...
 
int CursorLeft [get, set]
 Cursor left position More...
 
int CursorTop [get, set]
 Cursor top position More...
 

Detailed Description

HD44780-compatible character display

Member Enumeration Documentation

◆ BitMode

enum BitMode
strong

Whether to use 4 or 8 bits for transactions

Enumerator
FourBit 

4-bit mode

EightBit 

8-bit mode

◆ BlinkState

enum BlinkState
strong

Whether the cursor should blink

Enumerator
BlinkOff 

The cursor doesn't blink

BlinkOn 

The cursor blinks

◆ Command

enum Command
strong

An enumeration of commands the display supports

Enumerator
ClearDisplay 

Clear the display

ReturnHome 

Return the cursor to top-left

EntryModeSet 

Entry mode set

DisplayControl 

Set the display mode

CursorShift 

Move the cursor

FunctionSet 

Control display functions

SetCgramAddr 

Set the CGRAM address to write to

SetDdramAddr 

Set DDRAM address to write to

◆ CursorState

enum CursorState
strong

The cursor display state

Enumerator
CursorOff 

Cursor is not displayed

CursorOn 

Cursor is displayed

◆ DisplayState

enum DisplayState
strong

The display state

Enumerator
DisplayOff 

Display off

DisplayOn 

Display on

◆ FontMode

enum FontMode
strong

The font mode to use

Enumerator
Font_5x8 

Use 5x8 pixel fonts

Font_5x10 

Use 5x10 pixel fonts

◆ LinesMode

enum LinesMode
strong

Whether the display is single or multi-line

Enumerator
OneLine 

One-line mode

TwoOrMoreLines 

Two or more lines

Constructor & Destructor Documentation

◆ Hd44780()

Hd44780 ( WriteOnlyParallelInterface  iface,
int  Columns,
int  Rows,
DigitalOut  Backlight = null,
FontMode  font = FontMode.Font_5x8 
)

Construct a new HD44780-compatible display

Parameters
ifaceThe writable parallel interface to use
ColumnsThe number of columns in the display
RowsThe number of rows of the display
BacklightThe active-high pin to use for the backlight
fontThe font mode to use

Member Function Documentation

◆ clear()

override async Task clear ( )
protectedvirtual

Clear the display

Returns
An awaitable task that completes when finished

Implements CharacterDisplay.

◆ updateCursorPosition()

override Task updateCursorPosition ( )
protectedvirtual

Update the cursor position

Returns
An awaitable task that completes when finished

Implements CharacterDisplay.

◆ write()

override Task write ( dynamic  value)
protectedvirtual

Write data to the display at the current cursor position

Parameters
valueThe data to write
Returns
An awaitable task that completes when finished

Implements CharacterDisplay.

◆ SetCursorPosition()

Task SetCursorPosition ( int  left,
int  top 
)
inherited

Set left/right cursor position

Parameters
leftThe left position
topThe top position
Returns
An awaitable task that completes once the cursor is updated

Implements ICharacterDisplay.

◆ WriteLine()

Task WriteLine ( dynamic  value)
inherited

Write a line of text, advancing the cursor to the next line

Parameters
valuethe text to write
Returns
An awaitable task that completes when finished

Implements ICharacterDisplay.

◆ Write()

async Task Write ( dynamic  value)
inherited

Write text

Parameters
valuethe text to write
Returns
An awaitable task that completes when finished

Implements ICharacterDisplay.

◆ Clear()

Task Clear ( )
inherited

Clear the display and reset the cursor to (0,0)

Returns
An awaitable task that completes when finished

Implements ICharacterDisplay.

Property Documentation

◆ Backlight

bool Backlight
getset

Enable or disable the backlight

◆ Display

bool Display
getset

Enable or disable the display

◆ Cursor

bool Cursor
getset

Enable or disable the cursor

◆ Blink

bool Blink
getset

Enable or disable cursor blinking

◆ History

Collection<string> History = new Collection<string>()
getinherited

History of previously-written lines from the display

◆ Lines

Collection<string> Lines = new Collection<string>()
getinherited

Current lines of the display

◆ Columns

int Columns
getinherited

Number of columns of the display

◆ Rows

int Rows
getinherited

Number of rows of the display

◆ CursorLeft

int CursorLeft
getsetinherited

Cursor left position

◆ CursorTop

int CursorTop
getsetinherited

Cursor top position


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