Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
i2clcd.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_I2CLCD_H
27#define _ULTIBO_I2CLCD_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 I2CLCD_CONSOLE_DESCRIPTION "Generic I2C LCD"
39
40#define I2CLCD_SIGNATURE 0x00CF8574
41
43#define I2CLCD_PIN_RS GPIO_PIN_0
44#define I2CLCD_PIN_RW GPIO_PIN_1
45#define I2CLCD_PIN_EN GPIO_PIN_2
46#define I2CLCD_PIN_BACKLIGHT GPIO_PIN_3
47#define I2CLCD_PIN_D4 GPIO_PIN_4
48#define I2CLCD_PIN_D5 GPIO_PIN_5
49#define I2CLCD_PIN_D6 GPIO_PIN_6
50#define I2CLCD_PIN_D7 GPIO_PIN_7
51
63
65
76HANDLE STDCALL i2clcd_start(char *device, uint16_t address, uint32_t width, uint32_t height);
77
84
91
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif // _ULTIBO_I2CLCD_H
struct _CONSOLE_DEVICE CONSOLE_DEVICE
Definition console.h:186
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
HANDLE STDCALL i2clcd_start(char *device, uint16_t address, uint32_t width, uint32_t height)
Start the I2CLCD driver and register the GPIO and Console devices associated with the display.
BOOL STDCALL i2clcd_stop(HANDLE handle)
Stop the I2CLCD driver and deregister the GPIO and Console devices associated with the display.
BOOL STDCALL i2clcd_backlight_on(HANDLE handle)
Turn on the backlight on the I2CLCD display.
struct _I2CLCD_DISPLAY I2CLCD_DISPLAY
Definition i2clcd.h:53
BOOL STDCALL i2clcd_backlight_off(HANDLE handle)
Turn off the backlight on the I2CLCD display.
Definition i2clcd.h:55
GPIO_DEVICE * gpio
GPIO (PCF8574) device for this display.
Definition i2clcd.h:60
I2C_DEVICE * i2c
I2C device for this display.
Definition i2clcd.h:59
uint32_t width
Width in columns of this display.
Definition i2clcd.h:57
CONSOLE_DEVICE * console
Console (HD44780) device for this display.
Definition i2clcd.h:61
uint32_t height
Height in rows of this display.
Definition i2clcd.h:58
uint32_t signature
Signature for entry validation.
Definition i2clcd.h:56