Copyright | © Patrick Pelletier 2017 |
---|---|
License | BSD3 |
Maintainer | code@funwithsoftware.org |
Safe Haskell | Safe |
Language | Haskell2010 |
This module lets you control an HD44780U Dot Matrix Liquid Crystal Display Controller/Driver (datasheet), such as the one used in the Adafruit LCD+Keypad Kit.
Only supports 4-bit mode, write only. The user specifies a callback for performing the actual I/O to the chip.
Access to the LCD is not threadsafe (you'll need to do your own locking), but it is safe in the presence of async exceptions.
- data LcdBus = LcdBus {}
- newtype LcdCallbacks = LcdCallbacks {}
- lcdInitialize :: LcdCallbacks -> IO ()
- lcdClear :: LcdCallbacks -> IO ()
- lcdControl :: LcdCallbacks -> Bool -> Bool -> Bool -> IO ()
- lcdWrite :: LcdCallbacks -> Word8 -> Word8 -> ByteString -> IO ()
- lcdDefineChar :: LcdCallbacks -> Word8 -> [Word8] -> IO ()
Documentation
Argument to lcSend
. Specifies the state of the bus going to
the HD44780. The RW line is always 0, because we only do writes.
newtype LcdCallbacks Source #
Callback for communicating with the HD44780.
LcdCallbacks | |
|
lcdInitialize :: LcdCallbacks -> IO () Source #
Initializes the LCD and clears the screen. You must call this function first, before any of the other LCD functions.
lcdClear :: LcdCallbacks -> IO () Source #
Clears the screen.
:: LcdCallbacks | |
-> Bool | Enable display |
-> Bool | Enable underline cursor |
-> Bool | Enable blinking block cursor |
-> IO () |
Controls what is shown on the LCD.
:: LcdCallbacks | |
-> Word8 | Line number. Must be 0 or 1. (Even displays with four physical lines are modeled internally as 2 lines.) |
-> Word8 | Column number, starting at 0. |
-> ByteString | Characters to write to the display. Must be encoded in the controller's native character encoding. See Table 4 on pages 17-18 of the HD44780U datasheet. |
-> IO () |
Writes text onto the screen. To position the cursor without writing anything, you can write a zero-length string.
:: LcdCallbacks | |
-> Word8 | The character code to define. Must be 0-7. |
-> [Word8] | The bitmap data. Must be 8 bytes, with data in the least significant 5 bits of each byte. |
-> IO () |
Defines a custom character.