pi-lcd-0.1.0.0: Control an Adafruit character LCD and keypad kit on a Raspberry Pi

Copyright© Patrick Pelletier 2017
LicenseBSD3
Maintainercode@funwithsoftware.org
Safe HaskellNone
LanguageHaskell2010

System.Hardware.PiLcd.UnicodeLcd

Contents

Description

Displays Unicode text on an LCD. Only updates the parts of the LCD which have changed. Automatically manages custom characters, using the 5x8 fixed font for characters which are not built-in to the the LCD controller's ROM. Only eight distinct non-built-in characters can be on the display at any one time.

Only supports characters which are made up of a single code point. (In other words, combining marks are not supported.) If your input contains decomposed characters, consider using the unicode-transforms package to convert to Normalization Form C.

Displays up to 20x4 should be supported, although only 16x2 has been tested.

Synopsis

Creating an LCD

mkLcd :: LcdCallbacks -> LcdOptions -> IO Lcd Source #

Given callbacks and options, creates an Lcd. Assumes the display has already been initialized via a call to lcdInitialize.

data Lcd Source #

An opaque type representing an LCD.

lcdOptions :: Lcd -> LcdOptions Source #

Returns the LcdOptions that were passed to mkLcd

data LcdOptions Source #

Specifies the characteristics of the LCD.

Constructors

LcdOptions 

Fields

defaultLcdOptions :: LcdOptions Source #

Defaults to 2 lines, 16 columns, ROM code A00, and no additional custom characters.

data RomCode Source #

The HD44780U LCD controller comes in two different variants with different character ROMs. (See Table 4 on pages 17-18 of the HD44780U datasheet.) Unfortunately, as best as I can interpret this exchange with Adafruit customer support, Adafruit ships a mixture of A00 ROMs and A02 ROMs, depending on what's available at the moment. ("We take what's available or we don't sell LCDs.") This is a bit annoying, since there doesn't seem to be any way to query the HD44780U to find out which ROM it has. So, the user has to test their LCD and then specify which ROM they have.

Constructors

RomA00 
RomA02 

Displaying text

updateDisplay :: Lcd -> [Text] -> IO () Source #

Updates the contents of the LCD. You must specify the full contents of the screen, but only the parts which have changed since the last update are sent to the hardware. Converts from Unicode to the display's internal encoding, and automatically creates custom characters for characters which are not directly supported by the LCD.

Characters

getCharStatus :: Lcd -> Char -> CharStatus Source #

Given a Unicode code point, determines whether the character is built-in, or is considered a custom character (of which only eight can be on the screen at any one time).

data CharStatus Source #

Indicates whether a character can be found as a built-in or custom character

Constructors

CharBuiltin

character is supported by the LCD's ROM

CharCustom

not supported by ROM, but available in 5x8 fixed font, or in the user-defined characters specified in loCustomChars

CharNotFound

not available in ROM, 5x8 fixed font, or loCustomChars

nativeChar :: Word8 -> Char Source #

If for some reason you want to specify a character in the native 8-bit encoding of the LCD, instead of in Unicode, just call nativeChar on the 8-bit character value. This maps it to a region of the Private Use Area which is treated specially.