Difference between revisions of "Unit AF16x2LCD"

From Ultibo.org
Jump to: navigation, search
Line 69: Line 69:
 
! '''Note'''
 
! '''Note'''
 
| This function will be called during startup if the parameter AF16X2LCD_AUTOSTART is True
 
| This function will be called during startup if the parameter AF16X2LCD_AUTOSTART is True
 +
|-
 
| Can be called multiple times to support more than one 16x2 LCD display
 
| Can be called multiple times to support more than one 16x2 LCD display
 
|-
 
|-

Revision as of 23:45, 13 October 2016

Return to Unit Reference


Description


The Adafruit 16x2 LCD + Keypad is a kit that includes both a 16x2 LCD display using the Hitachi HD44780 LCD controller as well as a custom PCB with an MCP23017 I/O expander to connect it to a Raspberry Pi (any model) using I2C. It is available in Monochrome or RGB Positive and Negative versions.

This unit ties together the various components needed to make one of these boards work with Ultibo by finding the correct I2C device, creating the MCP230XX GPIO device, creating the HD44780 Console device and registering all of it with the correct parameters for the Adafruit kit.

The unit also includes functions to read the 5 buttons on the board and control the LCD backlight.

You will find many LCD display boards based on the Hitachi HD44780 controller and this unit gives an example of how to assembler the available units to create your own driver for a different board.

Constants


To be documented

Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

procedure AF16x2LCDInit;
Description: Initialize the AF16x2LCD unit and parameters
Note Called only during system startup


function AF16x2LCDStart(Model:LongWord;Invert:Boolean; const Device:String; Address:Word):THandle;
Description: Start the AF16x2LCD driver and register the GPIO and Console devices associated with the display
Model The Adafruit 16x2 LCD Plate model (eg AF16X2LCD_MODEL_RGB)
Invert Invert the signal level for the LCD backlight (If True then GPIO_LEVEL_LOW equals On)
Device The I2C device that the MCP23017 I/O Expander on the LCD Plate is connected to
Address The I2C address of the MCP23017 I/O Expander on the LCD Plate
Return The handle of the AF16x2LCD on success or INVALID_HANDLE_VALUE on failure
Note This function will be called during startup if the parameter AF16X2LCD_AUTOSTART is True
Can be called multiple times to support more than one 16x2 LCD display


function AF16x2LCDStop(Handle:THandle):Boolean;
Description: Stop the AF16x2LCD driver and deregister the GPIO and Console devices associated with the display
Handle The handle of the AF16x2LCD or INVALID_HANDLE_VALUE for the default display
Return True if completed or False on failure



Return to Unit Reference