Loading...
Searching...
No Matches
gc9a01_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Koen Zandberg <koen@bergzand.net>
3 * SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
19
20#include "board.h"
21#include "lcd.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Default parameters for GC9A01 display */
32#ifndef GC9A01_PARAM_SPI
34# define GC9A01_PARAM_SPI SPI_DEV(0)
35#endif
36#ifndef GC9A01_PARAM_SPI_CLK
38# define GC9A01_PARAM_SPI_CLK SPI_CLK_5MHZ
39#endif
40#ifndef GC9A01_PARAM_CS
42# define GC9A01_PARAM_CS GPIO_PIN(2, 2)
43#endif
44#ifndef GC9A01_PARAM_DCX
46# define GC9A01_PARAM_DCX GPIO_PIN(3, 13)
47#endif
48#ifndef GC9A01_PARAM_RST
50# define GC9A01_PARAM_RST GPIO_UNDEF
51#endif
52#ifndef GC9A01_PARAM_SPI_MODE
54# define GC9A01_PARAM_SPI_MODE SPI_MODE_0
55#endif
56#ifndef GC9A01_PARAM_RGB
58# define GC9A01_PARAM_RGB 0
59#endif
60#ifndef GC9A01_PARAM_INVERTED
62# define GC9A01_PARAM_INVERTED 0
63#endif
64#ifndef GC9A01_PARAM_NUM_LINES
66# define GC9A01_PARAM_NUM_LINES 240U
67#endif
68#ifndef GC9A01_PARAM_RGB_CHANNELS
70# define GC9A01_PARAM_RGB_CHANNELS 240U
71#endif
72#ifndef GC9A01_PARAM_ROTATION
74# define GC9A01_PARAM_ROTATION GC9A01_ROTATION_VERT
75#endif
76#ifndef GC9A01_PARAM_OFFSET_X
78# define GC9A01_PARAM_OFFSET_X 0
79#endif
80#ifndef GC9A01_PARAM_OFFSET_Y
82# define GC9A01_PARAM_OFFSET_Y 0
83#endif
84
85#if MODULE_LCD_SPI || DOXYGEN
87# define GC9A01_PARAM_IF_SPI .spi = GC9A01_PARAM_SPI, \
88 .spi_clk = GC9A01_PARAM_SPI_CLK, \
89 .spi_mode = GC9A01_PARAM_SPI_MODE,
90#else
91# define GC9A01_PARAM_IF_SPI
92#endif
93
94#if MODULE_LCD_PARALLEL || DOXYGEN
96# define GC9A01_PARAM_IF_PAR .d0_pin = GC9A01_PARAM_D0, \
97 .d1_pin = GC9A01_PARAM_D1, \
98 .d2_pin = GC9A01_PARAM_D2, \
99 .d3_pin = GC9A01_PARAM_D3, \
100 .d4_pin = GC9A01_PARAM_D4, \
101 .d5_pin = GC9A01_PARAM_D5, \
102 .d6_pin = GC9A01_PARAM_D6, \
103 .d7_pin = GC9A01_PARAM_D7, \
104 .wrx_pin = GC9A01_PARAM_WRX, \
105 .rdx_pin = GC9A01_PARAM_RDX,
106#else
107# define GC9A01_PARAM_IF_PAR
108#endif
109
110#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
112# define GC9A01_PARAM_IF_PAR_16BIT .d8_pin = GC9A01_PARAM_D8, \
113 .d9_pin = GC9A01_PARAM_D9, \
114 .d10_pin = GC9A01_PARAM_D10, \
115 .d11_pin = GC9A01_PARAM_D11, \
116 .d12_pin = GC9A01_PARAM_D12, \
117 .d13_pin = GC9A01_PARAM_D13, \
118 .d14_pin = GC9A01_PARAM_D14, \
119 .d15_pin = GC9A01_PARAM_D15,
120#else
121# define GC9A01_PARAM_IF_PAR_16BIT
122#endif
123
124#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
126# define GC9A01_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_16BIT,
127#elif MODULE_LCD_PARALLEL
129# define GC9A01_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_8BIT,
130#else
132# define GC9A01_PARAM_IF_MODE
133#endif
134
146#ifndef GC9A01_PARAMS
148# define GC9A01_PARAMS { GC9A01_PARAM_IF_MODE \
149 GC9A01_PARAM_IF_SPI \
150 GC9A01_PARAM_IF_PAR \
151 GC9A01_PARAM_IF_PAR_16BIT \
152 .cs_pin = GC9A01_PARAM_CS, \
153 .dcx_pin = GC9A01_PARAM_DCX, \
154 .rst_pin = GC9A01_PARAM_RST, \
155 .rgb = GC9A01_PARAM_RGB, \
156 .inverted = GC9A01_PARAM_INVERTED, \
157 .lines = GC9A01_PARAM_NUM_LINES, \
158 .rgb_channels = GC9A01_PARAM_RGB_CHANNELS, \
159 .rotation = GC9A01_PARAM_ROTATION, \
160 .offset_x = GC9A01_PARAM_OFFSET_X, \
161 .offset_y = GC9A01_PARAM_OFFSET_Y }
162#endif
164
169{
171};
172
176#ifndef GC9A01_PARAM_SCREEN_IDS
177# define GC9A01_PARAM_SCREEN_IDS 0
178#endif
179
183static const uint8_t gc9a01_screen_ids[] =
184{
186};
187
191#define GC9A01_NUMOF ARRAY_SIZE(gc9a01_params)
195#define GC9A01_SCREEN_NUMOF ARRAY_SIZE(gc9a01_screen_ids)
196
197#ifdef __cplusplus
198}
199#endif
200
static const uint8_t gc9a01_screen_ids[]
Configure screen identifiers.
static const lcd_params_t gc9a01_params[]
Configure GC9A01.
#define GC9A01_PARAMS
Default params.
#define GC9A01_PARAM_SCREEN_IDS
Default screen identifiers.
Device initialization parameters.
Definition lcd.h:109