Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
af16x2lcd.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_AF16X2LCD_H
27#define _ULTIBO_AF16X2LCD_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/gpio.h"
34#include "ultibo/i2c.h"
35#include "ultibo/console.h"
36
38#define AF16X2LCD_CONSOLE_DESCRIPTION "Adafruit 16x2 LCD"
39
40#define AF16X2LCD_SIGNATURE 0x000AF162
41
42#define AF16X2LCD_MODEL_MONO 0
43#define AF16X2LCD_MODEL_RGB 1
44
46#define AF16X2LCD_PLATE_RS GPIO_PIN_15
47#define AF16X2LCD_PLATE_RW GPIO_PIN_14
48#define AF16X2LCD_PLATE_EN GPIO_PIN_13
49#define AF16X2LCD_PLATE_D4 GPIO_PIN_12
50#define AF16X2LCD_PLATE_D5 GPIO_PIN_11
51#define AF16X2LCD_PLATE_D6 GPIO_PIN_10
52#define AF16X2LCD_PLATE_D7 GPIO_PIN_9
53#define AF16X2LCD_PLATE_RED GPIO_PIN_6
54#define AF16X2LCD_PLATE_GREEN GPIO_PIN_7
55#define AF16X2LCD_PLATE_BLUE GPIO_PIN_8
56
57#define AF16X2LCD_BUTTON_SELECT GPIO_PIN_0
58#define AF16X2LCD_BUTTON_RIGHT GPIO_PIN_1
59#define AF16X2LCD_BUTTON_DOWN GPIO_PIN_2
60#define AF16X2LCD_BUTTON_UP GPIO_PIN_3
61#define AF16X2LCD_BUTTON_LEFT GPIO_PIN_4
62
74
75
77
88HANDLE STDCALL af16x2lcd_start(uint32_t model, BOOL invert, char *device, uint16_t address);
89
96
103uint32_t STDCALL af16x2lcd_get_button(HANDLE handle, uint32_t button);
104
111
118
127BOOL STDCALL af16x2lcd_backlight_color(HANDLE handle, uint8_t red, uint8_t green, uint8_t blue);
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif // _ULTIBO_AF16X2LCD_H
uint32_t STDCALL af16x2lcd_get_button(HANDLE handle, uint32_t button)
Get the GPIO level of a button on the AF16x2LCD display.
struct _AF16X2LCD_PLATE AF16X2LCD_PLATE
Definition af16x2lcd.h:64
BOOL STDCALL af16x2lcd_backlight_off(HANDLE handle)
Turn off the backlight on the AF16x2LCD display.
HANDLE STDCALL af16x2lcd_start(uint32_t model, BOOL invert, char *device, uint16_t address)
Start the AF16x2LCD driver and register the GPIO and Console devices associated with the display.
BOOL STDCALL af16x2lcd_backlight_color(HANDLE handle, uint8_t red, uint8_t green, uint8_t blue)
Set the backlight color on the AF16x2LCD display.
BOOL STDCALL af16x2lcd_stop(HANDLE handle)
Stop the AF16x2LCD driver and deregister the GPIO and Console devices associated with the display.
BOOL STDCALL af16x2lcd_backlight_on(HANDLE handle)
Turn on the backlight on the AF16x2LCD display.
struct _CONSOLE_DEVICE CONSOLE_DEVICE
Definition console.h:186
int32_t LONGBOOL
Compatibility with FPC LongBool type (4 bytes).
Definition globaltypes.h:56
size_t HANDLE
Definition globaltypes.h:51
#define STDCALL
Definition globaltypes.h:45
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
struct _GPIO_DEVICE GPIO_DEVICE
Forward declared for GPIOPin.
Definition gpio.h:85
struct _I2C_DEVICE I2C_DEVICE
Definition i2c.h:81
Definition af16x2lcd.h:66
GPIO_DEVICE * gpio
GPIO (MCP23017) device for this plate.
Definition af16x2lcd.h:71
I2C_DEVICE * i2c
I2C device for this plate.
Definition af16x2lcd.h:70
CONSOLE_DEVICE * console
Console (HD44780) device for this plate.
Definition af16x2lcd.h:72
LONGBOOL invert
Invert polarity of Backlight (Active low if True).
Definition af16x2lcd.h:69
uint32_t signature
Signature for entry validation.
Definition af16x2lcd.h:67
uint32_t model
Plate model (eg AF16X2LCD_MODEL_MONO).
Definition af16x2lcd.h:68