Loading...
Searching...
No Matches
st77xx_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Koen Zandberg <koen@bergzand.net>
3 * 2021 Francisco Molina
4 * 2023 Gunar Schorcht
5 *
6 * This file is subject to the terms and conditions of the GNU Lesser
7 * General Public License v2.1. See the file LICENSE in the top level
8 * directory for more details.
9 */
10
23#ifndef ST77XX_PARAMS_H
24#define ST77XX_PARAMS_H
25
26#include "board.h"
27#include "lcd.h"
28#include "st7735_params.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#if !DOXYGEN /* hide from documentation */
45#ifdef ST7735_PARAM_SPI
46#define ST77XX_PARAM_SPI ST7735_PARAM_SPI
47#endif
48#ifdef ST7735_PARAM_SPI_CLK
49#define ST77XX_PARAM_SPI_CLK ST7735_PARAM_SPI_CLK
50#endif
51#ifdef ST7735_PARAM_CS
52#define ST77XX_PARAM_CS ST7735_PARAM_CS
53#endif
54#ifdef ST7735_PARAM_DCX
55#define ST77XX_PARAM_DCX ST7735_PARAM_DCX
56#endif
57#ifdef ST7735_PARAM_RST
58#define ST77XX_PARAM_RST ST7735_PARAM_RST
59#endif
60#ifdef ST7735_PARAM_SPI_MODE
61#define ST77XX_PARAM_SPI_MODE ST7735_PARAM_SPI_MODE
62#endif
63#ifdef ST7735_PARAM_RGB
64#define ST77XX_PARAM_RGB ST7735_PARAM_RGB
65#endif
66#ifdef ST7735_PARAM_INVERTED
67#define ST77XX_PARAM_INVERTED ST7735_PARAM_INVERTED
68#endif
69#ifdef ST7735_PARAM_NUM_LINES
70#define ST77XX_PARAM_NUM_LINES ST7735_PARAM_NUM_LINES
71#endif
72#ifdef ST7735_PARAM_RGB_CHANNELS
73#define ST77XX_PARAM_RGB_CHANNELS ST7735_PARAM_RGB_CHANNELS
74#endif
75#ifdef ST7735_PARAM_ROTATION
76#define ST77XX_PARAM_ROTATION ST7735_PARAM_ROTATION
77#endif
78#ifdef ST7735_PARAM_OFFSET_X
79#define ST77XX_PARAM_OFFSET_X ST7735_PARAM_OFFSET_X
80#endif
81#ifdef ST7735_PARAM_OFFSET_Y
82#define ST77XX_PARAM_OFFSET_Y ST7735_PARAM_OFFSET_Y
83#endif
84#ifdef ST7735_PARAMS
85#define ST77XX_PARAMS ST7735_PARAMS
86#endif
87#ifdef ST7735_PARAM_SCREEN_IDS
88#define ST77XX_PARAM_SCREEN_IDS ST7735_PARAM_SCREEN_IDS
89#endif
90
91#endif /* !DOXYGEN */
92
97#ifndef ST77XX_PARAM_CNTRL
98#define ST77XX_PARAM_CNTRL ST77XX_CNTRL_ST7735
99#endif
100#ifndef ST77XX_PARAM_SPI
101#define ST77XX_PARAM_SPI SPI_DEV(0)
102#endif
103#ifndef ST77XX_PARAM_SPI_CLK
104#define ST77XX_PARAM_SPI_CLK SPI_CLK_5MHZ
105#endif
106#ifndef ST77XX_PARAM_CS
107#define ST77XX_PARAM_CS GPIO_PIN(2, 2)
108#endif
109#ifndef ST77XX_PARAM_DCX
110#define ST77XX_PARAM_DCX GPIO_PIN(3, 13)
111#endif
112#ifndef ST77XX_PARAM_RST
113#define ST77XX_PARAM_RST GPIO_UNDEF
114#endif
115#ifndef ST77XX_PARAM_SPI_MODE
116#define ST77XX_PARAM_SPI_MODE SPI_MODE_0
117#endif
118#ifndef ST77XX_PARAM_RGB
119#define ST77XX_PARAM_RGB 0
120#endif
121#ifndef ST77XX_PARAM_INVERTED
122#define ST77XX_PARAM_INVERTED 0
123#endif
124#ifndef ST77XX_PARAM_NUM_LINES
125#define ST77XX_PARAM_NUM_LINES 160U
126#endif
127#ifndef ST77XX_PARAM_RGB_CHANNELS
128#define ST77XX_PARAM_RGB_CHANNELS 128U
129#endif
130#ifndef ST77XX_PARAM_ROTATION
131#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_HORZ
132#endif
133#ifndef ST77XX_PARAM_OFFSET_X
134#define ST77XX_PARAM_OFFSET_X 0
135#endif
136#ifndef ST77XX_PARAM_OFFSET_Y
137#define ST77XX_PARAM_OFFSET_Y 0
138#endif
139
140#if MODULE_LCD_SPI || DOXYGEN
142#define ST77XX_PARAM_IF_SPI .spi = ST77XX_PARAM_SPI, \
143 .spi_clk = ST77XX_PARAM_SPI_CLK, \
144 .spi_mode = ST77XX_PARAM_SPI_MODE,
145#else
146#define ST77XX_PARAM_IF_SPI
147#endif
148
149#if MODULE_LCD_PARALLEL || DOXYGEN
151#define ST77XX_PARAM_IF_PAR .d0_pin = ST77XX_PARAM_D0, \
152 .d1_pin = ST77XX_PARAM_D1, \
153 .d2_pin = ST77XX_PARAM_D2, \
154 .d3_pin = ST77XX_PARAM_D3, \
155 .d4_pin = ST77XX_PARAM_D4, \
156 .d5_pin = ST77XX_PARAM_D5, \
157 .d6_pin = ST77XX_PARAM_D6, \
158 .d7_pin = ST77XX_PARAM_D7, \
159 .wrx_pin = ST77XX_PARAM_WRX, \
160 .rdx_pin = ST77XX_PARAM_RDX,
161#else
162#define ST77XX_PARAM_IF_PAR
163#endif
164
165#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
167#define ST77XX_PARAM_IF_PAR_16BIT .d8_pin = ST77XX_PARAM_D8, \
168 .d9_pin = ST77XX_PARAM_D9, \
169 .d10_pin = ST77XX_PARAM_D10, \
170 .d11_pin = ST77XX_PARAM_D11, \
171 .d12_pin = ST77XX_PARAM_D12, \
172 .d13_pin = ST77XX_PARAM_D13, \
173 .d14_pin = ST77XX_PARAM_D14, \
174 .d15_pin = ST77XX_PARAM_D15,
175#else
176#define ST77XX_PARAM_IF_PAR_16BIT
177#endif
178
179#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
181#define ST77XX_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_16BIT,
182#elif MODULE_LCD_PARALLEL
184#define ST77XX_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_8BIT,
185#else
187#define ST77XX_PARAM_IF_MODE
188#endif
189
201#ifndef ST77XX_PARAMS
202#define ST77XX_PARAMS { ST77XX_PARAM_IF_MODE \
203 ST77XX_PARAM_IF_SPI \
204 ST77XX_PARAM_IF_PAR \
205 ST77XX_PARAM_IF_PAR_16BIT \
206 .cntrl = ST77XX_PARAM_CNTRL, \
207 .cs_pin = ST77XX_PARAM_CS, \
208 .dcx_pin = ST77XX_PARAM_DCX, \
209 .rst_pin = ST77XX_PARAM_RST, \
210 .rgb = ST77XX_PARAM_RGB, \
211 .inverted = ST77XX_PARAM_INVERTED, \
212 .lines = ST77XX_PARAM_NUM_LINES, \
213 .rgb_channels = ST77XX_PARAM_RGB_CHANNELS, \
214 .rotation = ST77XX_PARAM_ROTATION, \
215 .offset_x = ST77XX_PARAM_OFFSET_X, \
216 .offset_y = ST77XX_PARAM_OFFSET_Y, \
217 }
218#endif /* ST77XX_PARAMS */
224#ifndef ST77XX_PARAM_SCREEN_IDS
225#define ST77XX_PARAM_SCREEN_IDS 0
226#endif
227
232{
234};
235
239static const uint8_t st77xx_screen_ids[] =
240{
242};
243
247#define ST77XX_NUMOF ARRAY_SIZE(st77xx_params)
251#define ST77XX_SCREEN_NUMOF ARRAY_SIZE(st77xx_screen_ids)
252
253#ifdef __cplusplus
254}
255#endif
256
257#endif /* ST77XX_PARAMS_H */
static const lcd_params_t st77xx_params[]
Configure LCD.
static const uint8_t st77xx_screen_ids[]
Configure screen identifiers.
#define ST77XX_PARAM_SCREEN_IDS
Default screen identifiers.
#define ST77XX_PARAMS
Default params.
Device initialization parameters.
Definition lcd.h:113