Difference between revisions of "Unit AF16x2LCD"

From Ultibo.org
Jump to: navigation, search
Line 16: Line 16:
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''AF16x2LCD specific constants''' <code> AF16X2LCD_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AF16X2LCD_CONSOLE_DESCRIPTION = 'Adafruit 16x2 LCD';</code>
 +
| Description of AF16x2LCD device
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>AF16X2LCD_SIGNATURE = $000AF162;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>AF16X2LCD_MODEL_MONO = 0;</code>
 +
| LCD with Monochrome backlight
 +
|-
 +
| <code>AF16X2LCD_MODEL_RGB = 1;</code>
 +
| LCD with RGB backlight;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''AF16x2LCD GPIO constants''' <code> GPIO_PIN_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AF16X2LCD_PLATE_RS = GPIO_PIN_15;</code>
 +
| GPIO pin for the LCD RS line
 +
|-
 +
| <code>AF16X2LCD_PLATE_RW = GPIO_PIN_14;</code>
 +
| GPIO pin for the LCD RW line
 +
|-
 +
| <code>AF16X2LCD_PLATE_EN = GPIO_PIN_13;</code>
 +
| GPIO pin for the LCD EN line
 +
|-
 +
| <code>AF16X2LCD_PLATE_D4 = GPIO_PIN_12;</code>
 +
| GPIO pin for the LCD D4 line
 +
|-
 +
| <code>AF16X2LCD_PLATE_D5 = GPIO_PIN_11;</code>
 +
| GPIO pin for the LCD D5 line
 +
|-
 +
| <code>AF16X2LCD_PLATE_D6 = GPIO_PIN_10;</code>
 +
| GPIO pin for the LCD D6 line
 +
|-
 +
| <code>AF16X2LCD_PLATE_D7 = GPIO_PIN_9;</code>
 +
| GPIO pin for the LCD D7 line
 +
|-
 +
| <code>AF16X2LCD_PLATE_RED = GPIO_PIN_6;</code>
 +
| GPIO pin for the Backlight Red LED
 +
|-
 +
| <code>AF16X2LCD_PLATE_GREEN = GPIO_PIN_7;</code>
 +
| GPIO pin for the Backlight Green LED
 +
|-
 +
| <code>AF16X2LCD_PLATE_BLUE = GPIO_PIN_8;</code>
 +
| GPIO pin for the Backlight Blue LED
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>AF16X2LCD_BUTTON_SELECT = GPIO_PIN_0;</code>
 +
| GPIO pin for the Select button
 +
|-
 +
| <code>AF16X2LCD_BUTTON_RIGHT = GPIO_PIN_1;</code>
 +
| GPIO pin for the Right button
 +
|-
 +
| <code>AF16X2LCD_BUTTON_DOWN = GPIO_PIN_2;</code>
 +
| GPIO pin for the Down button
 +
|-
 +
| <code>AF16X2LCD_BUTTON_UP = GPIO_PIN_3;</code>
 +
| GPIO pin for the Up button
 +
|-
 +
| <code>AF16X2LCD_BUTTON_LEFT = GPIO_PIN_4;</code>
 +
| GPIO pin for the Left button
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===

Revision as of 23:11, 1 December 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



[Expand]
AF16x2LCD specific constants AF16X2LCD_*


[Expand]
AF16x2LCD GPIO constants GPIO_PIN_*


Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

[Expand]
procedure AF16x2LCDInit;
Description: Initialize the AF16x2LCD unit and parameters


[Expand]
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


[Expand]
function AF16x2LCDStop(Handle:THandle):Boolean;
Description: Stop the AF16x2LCD driver and deregister the GPIO and Console devices associated with the display


AF16x2LCD functions

[Expand]
function AF16x2LCDGetButton(Handle:THandle; Button:LongWord):LongWord;
Description: Get the GPIO level of a button on the AF16x2LCD display


[Expand]
function AF16x2LCDBacklightOn(Handle:THandle):Boolean;
Description: Turn on the backlight on the AF16x2LCD display


[Expand]
function AF16x2LCDBacklightOff(Handle:THandle):Boolean;
Description: Turn off the backlight on the AF16x2LCD display


[Expand]
function AF16x2LCDBacklightColor(Handle:THandle; Red,Green,Blue:Byte):Boolean;
Description: Set the backlight color on the AF16x2LCD display


Return to Unit Reference