-
Notifications
You must be signed in to change notification settings - Fork 1
/
TFT_config.h
306 lines (255 loc) · 9.1 KB
/
TFT_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
///////////////////////////////////////////////////////////
/* Support file for ESP32 IDF use */
/* See library docs folder */
/* */
/* DO NOT EDIT THIS FILE */
/* */
///////////////////////////////////////////////////////////
/**
* @file TFT_config.h
* @author Ricard Bitriá Ribes (https://github.com/dracir9)
* Created Date: 22-01-2022
* -----
* Last Modified: 14-04-2022
* Modified By: Ricard Bitriá Ribes
* -----
* @copyright (c) 2022 Ricard Bitriá Ribes
*/
#ifndef TFT_CONFIG_H
#define TFT_CONFIG_H
#include "sdkconfig.h"
/***************************************************************************************
** TFT_eSPI Configuration defines
***************************************************************************************/
// Override defaults
#define USER_SETUP_LOADED
/***************************************************************************************
** Section 1: Load TFT driver
***************************************************************************************/
#if defined (CONFIG_TFT_ILI9341_DRIVER)
#define ILI9341_DRIVER
#elif defined (CONFIG_TFT_ILI9341_2_DRIVER)
#define ILI9341_2_DRIVER
#elif defined (CONFIG_TFT_ST7735_DRIVER)
#define ST7735_DRIVER
#elif defined (CONFIG_TFT_ILI9163_DRIVER)
#define ILI9163_DRIVER
#elif defined (CONFIG_TFT_S6D02A1_DRIVER)
#define S6D02A1_DRIVER
#elif defined (CONFIG_TFT_HX8357D_DRIVER)
#define HX8357D_DRIVER
#elif defined (CONFIG_TFT_ILI9481_DRIVER)
#define ILI9481_DRIVER
#elif defined (CONFIG_TFT_ILI9486_DRIVER)
#define ILI9486_DRIVER
#elif defined (CONFIG_TFT_ILI9488_DRIVER)
#define ILI9488_DRIVER
#elif defined (CONFIG_TFT_ST7789_DRIVER)
#define ST7789_DRIVER
#elif defined (CONFIG_TFT_ST7789_2_DRIVER)
#define ST7789_2_DRIVER
#elif defined (CONFIG_TFT_R61581_DRIVER)
#define R61581_DRIVER
#elif defined (CONFIG_TFT_RM68140_DRIVER)
#define RM68140_DRIVER
#elif defined (CONFIG_TFT_ST7796_DRIVER)
#define ST7796_DRIVER
#elif defined (CONFIG_TFT_SSD1351_DRIVER)
#define SSD1351_DRIVER
#elif defined (CONFIG_TFT_SSD1963_480_DRIVER)
#define SSD1963_480_DRIVER
#elif defined (CONFIG_TFT_SSD1963_800_DRIVER)
#define SSD1963_800_DRIVER
#elif defined (CONFIG_TFT_SSD1963_800ALT_DRIVER)
#define SSD1963_800ALT_DRIVER
#elif defined (CONFIG_TFT_ILI9225_DRIVER)
#define ILI9225_DRIVER
#elif defined (CONFIG_TFT_GC9A01_DRIVER)
#define GC9A01_DRIVER
#endif
#ifdef CONFIG_TFT_RGB_ORDER
#define TFT_RGB_ORDER TFT_RGB
#endif
#ifdef CONFIG_TFT_RGB_ORDER
#define TFT_RGB_ORDER TFT_BGR
#endif
#ifdef CONFIG_TFT_M5STACK
#define M5STACK
#endif
#ifdef CONFIG_TFT_WIDTH
#define TFT_WIDTH CONFIG_TFT_WIDTH
#endif
#ifdef CONFIG_TFT_HEIGHT
#define TFT_HEIGHT CONFIG_TFT_HEIGHT
#endif
#if defined (CONFIG_TFT_ST7735_INITB)
#define ST7735_INITB
#elif defined (CONFIG_TFT_ST7735_GREENTAB)
#define ST7735_GREENTAB
#elif defined (CONFIG_TFT_ST7735_GREENTAB2)
#define ST7735_GREENTAB2
#elif defined (CONFIG_TFT_ST7735_GREENTAB3)
#define ST7735_GREENTAB3
#elif defined (CONFIG_TFT_ST7735_GREENTAB128)
#define ST7735_GREENTAB128
#elif defined (CONFIG_TFT_ST7735_GREENTAB160x80)
#define ST7735_GREENTAB160x80
#elif defined (CONFIG_TFT_ST7735_REDTAB)
#define ST7735_REDTAB
#elif defined (CONFIG_TFT_ST7735_BLACKTAB)
#define ST7735_BLACKTAB
#elif defined (CONFIG_TFT_ST7735_REDTAB160x80)
#define ST7735_REDTAB160x80
#endif
#if defined (CONFIG_TFT_INVERSION_ON)
#define TFT_INVERSION_ON
#elif defined (CONFIG_TFT_INVERSION_OFF)
#define TFT_INVERSION_OFF
#endif
/***************************************************************************************
** Section 2: General Pin configuration
***************************************************************************************/
// General pins
#if CONFIG_TFT_CS == -1
#error "Invalid Chip Select pin. Check TFT_eSPI configuration"
#else
#define TFT_CS CONFIG_TFT_CS
#endif
#if CONFIG_TFT_DC == -1
#error "Invalid Data/Command pin. Check TFT_eSPI configuration"
#else
#define TFT_DC CONFIG_TFT_DC
#endif
#if CONFIG_TFT_RST == -1
#error "Invalid Reset pin. Check TFT_eSPI configuration"
#else
#define TFT_RST CONFIG_TFT_RST
#endif
// Backlight config
#ifdef CONFIG_ENABLE_BL
#if CONFIG_TFT_BL == -1
#error "Invalid backlight control pin. Check TFT_eSPI configuration"
#else
#define TFT_BL CONFIG_TFT_BL
#endif
#define TFT_BACKLIGHT_ON CONFIG_TFT_BACKLIGHT_ON
#endif
/***************************************************************************************
** Section 3: Data bus Pin configuration
***************************************************************************************/
// 8 BIT PARALLEL BUS
#ifdef CONFIG_TFT_PARALLEL_8_BIT
#if CONFIG_TFT_D0 == -1
#error "Invalid Data 0 pin. Check TFT_eSPI configuration"
#else
#define TFT_D0 CONFIG_TFT_D0
#endif
#if CONFIG_TFT_D1 == -1
#error "Invalid Data 1 pin. Check TFT_eSPI configuration"
#else
#define TFT_D1 CONFIG_TFT_D1
#endif
#if CONFIG_TFT_D2 == -1
#error "Invalid Data 2 pin. Check TFT_eSPI configuration"
#else
#define TFT_D2 CONFIG_TFT_D2
#endif
#if CONFIG_TFT_D3 == -1
#error "Invalid Data 3 pin. Check TFT_eSPI configuration"
#else
#define TFT_D3 CONFIG_TFT_D3
#endif
#if CONFIG_TFT_D4 == -1
#error "Invalid Data 4 pin. Check TFT_eSPI configuration"
#else
#define TFT_D4 CONFIG_TFT_D4
#endif
#if CONFIG_TFT_D5 == -1
#error "Invalid Data 5 pin. Check TFT_eSPI configuration"
#else
#define TFT_D5 CONFIG_TFT_D5
#endif
#if CONFIG_TFT_D6 == -1
#error "Invalid Data 6 pin. Check TFT_eSPI configuration"
#else
#define TFT_D6 CONFIG_TFT_D6
#endif
#if CONFIG_TFT_D7 == -1
#error "Invalid Data 7 pin. Check TFT_eSPI configuration"
#else
#define TFT_D7 CONFIG_TFT_D7
#endif
#if CONFIG_TFT_WR == -1
#error "Invalid Write strobe pin. Check TFT_eSPI configuration"
#else
#define TFT_WR CONFIG_TFT_WR
#endif
#if CONFIG_TFT_RD == -1
#error "Invalid Read strobe pin. Check TFT_eSPI configuration"
#else
#define TFT_RD CONFIG_TFT_RD
#endif
// SPI BUS
#else
#if CONFIG_TFT_MISO == -1
#error "Invalid MISO pin. Check TFT_eSPI configuration"
#else
#define TFT_MISO CONFIG_TFT_MISO
#endif
#if CONFIG_TFT_MOSI == -1
#error "Invalid MOSI pin. Check TFT_eSPI configuration"
#else
#define TFT_MOSI CONFIG_TFT_MOSI
#endif
#if CONFIG_TFT_SCLK == -1
#error "Invalid Clock pin. Check TFT_eSPI configuration"
#else
#define TFT_SCLK CONFIG_TFT_SCLK
#endif
#define SPI_FREQUENCY CONFIG_TFT_SPI_FREQUENCY
#if CONFIG_TFT_SPI_READ_FREQ != -1
#define SPI_READ_FREQUENCY CONFIG_TFT_SPI_READ_FREQ
#endif
#ifdef CONFIG_TFT_SDA_READ
#define TFT_SDA_READ
#endif
#endif
/***************************************************************************************
** Section 4: Setup Fonts
***************************************************************************************/
#ifdef CONFIG_TFT_LOAD_GLCD
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#endif
#ifdef CONFIG_TFT_LOAD_FONT2
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#endif
#ifdef CONFIG_TFT_LOAD_FONT4
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#endif
#ifdef CONFIG_TFT_LOAD_FONT6
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#endif
#ifdef CONFIG_TFT_LOAD_FONT7
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#endif
#ifdef CONFIG_TFT_LOAD_FONT8
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#endif
#ifdef CONFIG_TFT_LOAD_GFXFF
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#endif
#if CONFIG_TFT_SMOOTH_FONT
#define SMOOTH_FONT
#endif
/***************************************************************************************
** Section 5: Touchscreen configuration
***************************************************************************************/
#ifdef CONFIG_ENABLE_TOUCH
#if CONFIG_TOUCH_CS == -1
#error "Invalid Touch Chip Select pin. Check TFT_eSPI configuration"
#else
#define TOUCH_CS CONFIG_TOUCH_CS
#endif
#define SPI_TOUCH_FREQUENCY CONFIG_SPI_TOUCH_FREQUENCY
#endif
#endif // TFT_CONFIG_H