Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
hx8357d.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_HX8357D_H
27#define _ULTIBO_HX8357D_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/gpio.h"
34#include "ultibo/spi.h"
35#include "ultibo/framebuffer.h"
37
39#define HX8357D_FRAMEBUFFER_DESCRIPTION "Himax HX8357D TFT LCD"
40
42#define HX8357D_SPI_RATE 32000000
43
45#define HX8357D_CMD_NOP 0x00
46#define HX8357D_CMD_SWRESET 0x01
47
48#define HX8357D_CMD_RDDIDIF 0x04
49
50#define HX8357D_CMD_SLPIN 0x10
51#define HX8357D_CMD_SLPOUT 0x11
52
53#define HX8357D_CMD_PTLON 0x12
54#define HX8357D_CMD_NORON 0x13
55
56#define HX8357D_CMD_INVOFF 0x20
57#define HX8357D_CMD_INVON 0x21
58
59#define HX8357D_CMD_ALLPOFF 0x22
60#define HX8357D_CMD_ALLPON 0x23
61
62#define HX8357D_CMD_DISPOFF 0x28
63#define HX8357D_CMD_DISPON 0x29
64
65#define HX8357D_CMD_CASET 0x2A
66#define HX8357D_CMD_PASET 0x2B
67#define HX8357D_CMD_RAMWR 0x2C
68#define HX8357D_CMD_RAMRD 0x2E
69
70#define HX8357D_CMD_TEON 0x35
71
72#define HX8357D_CMD_MADCTL 0x36
73#define HX8357D_CMD_COLMOD 0x3A
74
75#define HX8357D_CMD_TESL 0x44
76
77#define HX8357D_CMD_SETOSC 0xB0
78#define HX8357D_CMD_SETPOWER 0xB1
79#define HX8357D_CMD_SETRGB 0xB3
80#define HX8357D_CMD_SETCYC 0xB4
81#define HX8357D_CMD_SETCOM 0xB6
82
83#define HX8357D_CMD_SETEXTC 0xB9
84
85#define HX8357D_CMD_SETSTBA 0xC0
86
87#define HX8357D_CMD_SETPANEL 0xCC
88
89#define HX8357D_CMD_SETGAMMA 0xE0
90
92#define HX8357D_CMD_MADCTL_MY 0x80
93#define HX8357D_CMD_MADCTL_MX 0x40
94#define HX8357D_CMD_MADCTL_MV 0x20
95#define HX8357D_CMD_MADCTL_ML 0x10
96#define HX8357D_CMD_MADCTL_RGB 0x00
97#define HX8357D_CMD_MADCTL_BGR 0x08
98#define HX8357D_CMD_MADCTL_SS 0x04
99#define HX8357D_CMD_MADCTL_MH HX8357D_CMD_MADCTL_SS
100
104{
105 // TFT Properties
107 // HX8357D Properties
108};
109
111
125FRAMEBUFFER_DEVICE * STDCALL hx8357d_framebuffer_create(SPI_DEVICE *spi, uint16_t chipselect, char *name, uint32_t rotation, uint32_t width, uint32_t height, GPIO_INFO *rst, GPIO_INFO *dc, GPIO_INFO *bl);
126
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif // _ULTIBO_HX8357D_H
struct _FRAMEBUFFER_DEVICE FRAMEBUFFER_DEVICE
Definition framebuffer.h:112
#define STDCALL
Definition globaltypes.h:45
struct _GPIO_INFO GPIO_INFO
Definition gpio.h:176
FRAMEBUFFER_DEVICE *STDCALL hx8357d_framebuffer_create(SPI_DEVICE *spi, uint16_t chipselect, char *name, uint32_t rotation, uint32_t width, uint32_t height, GPIO_INFO *rst, GPIO_INFO *dc, GPIO_INFO *bl)
Create, register and allocate a new HX8357D Framebuffer device which can be accessed using the frameb...
struct _HX8357D_FRAMEBUFFER HX8357D_FRAMEBUFFER
Definition hx8357d.h:102
uint32_t STDCALL hx8357d_framebuffer_destroy(FRAMEBUFFER_DEVICE *framebuffer)
Release, deregister and destroy an HX8357D Framebuffer device created by this driver.
struct _SPI_DEVICE SPI_DEVICE
Definition spi.h:108
Definition hx8357d.h:104
TFT_FRAMEBUFFER tft
Definition hx8357d.h:106
struct _TFT_FRAMEBUFFER TFT_FRAMEBUFFER
Definition tftframebuffer.h:43