Class I2cCharacterDisplay
Represents a character display using I2C
Assembly: CharacterDisplay.dll
View Source
public class I2cCharacterDisplay : ICharacterDisplay, ITextDisplay, IDisplay, II2cPeripheral
Derived:
Meadow.Foundation.Displays.Lcd.GroveCharacterDisplay
Implements:
Meadow.Foundation.Displays.Lcd.ICharacterDisplay, Meadow.Peripherals.Displays.ITextDisplay
, Meadow.Peripherals.Displays.IDisplay
, Meadow.Hardware.II2cPeripheral
Properties
DefaultI2cAddress
The default I2C address for the peripheral
View Source
public byte DefaultI2cAddress { get; }
DisplayConfig
The text display configuration
View Source
public TextDisplayConfig DisplayConfig { get; protected set; }
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
View Source
protected readonly II2cCommunications i2cComms
displayControl
Display control value
View Source
protected byte displayControl
displayMode
Display mode value
View Source
protected byte displayMode
backlightValue
Display backlight value
View Source
protected byte backlightValue
cursorLine
The cursor current line
View Source
protected byte cursorLine
cursorColumn
The cursor current column
View Source
protected byte cursorColumn
Methods
Initialize()
Initialize the display
View Source
protected virtual void Initialize()
Command(byte)
Send a command to the display
View Source
protected virtual void Command(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The command as a byte |
Send(byte, byte)
Send data to the display
View Source
protected virtual void Send(byte value, byte mode)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The data to send |
System.Byte | mode | The mode |
ClearLine(byte)
Clear a line of text
View Source
public void ClearLine(byte lineNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | lineNumber | The line to clear (0 indexed) |
ClearLines()
Clear all lines
View Source
public void ClearLines()
SetCursorPosition(byte, byte)
Set the cursor position
View Source
public void SetCursorPosition(byte column, byte line)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | column | The cursor column |
System.Byte | line | The cursor line |
Write(string)
Write a string to the display
View Source
public void Write(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to show as a string |
WriteLine(string, byte, bool)
Write text to a line on the display
View Source
public void WriteLine(string text, byte lineNumber, bool showCursor = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to show |
System.Byte | lineNumber | The line number (0 index) |
System.Boolean | showCursor | Show the cursor if true |
DisplayOff()
Set the display off
View Source
public virtual void DisplayOff()
DisplayOn()
Set the display on
View Source
public virtual void DisplayOn()
CursorOff()
Hide the cursor
View Source
public void CursorOff()
CursorOn()
Show the cursor
View Source
public void CursorOn()
BlinkCursor(bool)
Enable or disable cursor blinking
View Source
public void BlinkCursor(bool blink)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | blink | Blink if true |
ScrollDisplayLeft()
Scroll the display left
View Source
public virtual void ScrollDisplayLeft()
ScrollDisplayRight()
Scroll the display right
View Source
public virtual void ScrollDisplayRight()
SetLeftToRight()
Set the display to show text left to right
View Source
public void SetLeftToRight()
SetRightToLeft()
Set the display to show text right to left
View Source
public void SetRightToLeft()
Autoscroll(bool)
Enable or disable auto scroll if the text length exceeds the display width
View Source
public void Autoscroll(bool scroll)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | scroll | Auto scroll if true |
SaveCustomCharacter(byte[], byte)
Save a custom character to the display
View Source
public void SaveCustomCharacter(byte[] characterMap, byte address)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | characterMap | The character data |
System.Byte | address | The character address |
BacklightOn()
Turn the backlight on
View Source
public void BacklightOn()
BacklightOff()
Turn the backlight off
View Source
public void BacklightOff()
IsBacklightOn()
Get the backlight state
View Source
public bool IsBacklightOn()
Returns
System.Boolean
: True if On, false if off### Show()
Update the display
View Source
public void Show()
Implements
- Meadow.Foundation.Displays.Lcd.ICharacterDisplay
Meadow.Peripherals.Displays.ITextDisplay
Meadow.Peripherals.Displays.IDisplay
Meadow.Hardware.II2cPeripheral