LittlevGL  3.20.00.19
ls013b7dh03/lv_drv_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
39 #ifndef LV_DRV_CONF_H
40 #define LV_DRV_CONF_H
41 
42 #include "lv_conf.h"
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #define USE_LS013B7DH03 1
49 
50 /*********************
51  * DELAY INTERFACE
52  *********************/
53 #define LV_DRV_DELAY_INCLUDE <unistd.h>
54 #define LV_DRV_DELAY_US(us) usleep(us) /*Delay the given number of microseconds*/
55 #define LV_DRV_DELAY_MS(ms) usleep(1000*ms) /*Delay the given number of milliseconds*/
56 
57 /*********************
58  * DISPLAY INTERFACE
59  *********************/
60 
61 /*------------
62  * Common
63  *------------*/
64 #define LV_DRV_DISP_INCLUDE <ti_lvgl_disp_interface.h>
65 #define LV_DRV_DISP_CMD_DATA(val) /*pin_x_set(val)*/ /*Set the command/data pin to 'val'*/
66 #define LV_DRV_DISP_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
67 #define LV_DRV_DISP_POWER(val) GPIO_write(Board_GPIO_SHARP_LCD_POWER, val) /*Set the power pin to 'val'*/
68 #define LV_DRV_DISP_ENABLE(val) GPIO_write(Board_GPIO_SHARP_LCD_ENABLE, val) /*Set the enable pin to 'val'*/
69 
70 /*---------
71  * SPI
72  *---------*/
73 #define LV_DRV_DISP_SPI_BITRATE 1000000
74 #define LV_DRV_DISP_SPI_CS(val) GPIO_write(Board_GPIO_SHARP_LCD_CS, val); /*Set the SPI's Chip select to 'val'*/
75 #define LV_DRV_DISP_SPI_WR_BYTE(data) spi_wr_byte(data) /*Write a byte the SPI bus*/
76 #define LV_DRV_DISP_SPI_WR_ARRAY(adr, n) spi_wr_array(adr, n) /*Write 'n' bytes to SPI bus from 'adr'*/
77 
78 /*------------------
79  * Parallel port
80  *-----------------*/
81 #define LV_DRV_DISP_PAR_CS(val) /*par_cs_set(val)*/ /*Set the Parallel port's Chip select to 'val'*/
82 #define LV_DRV_DISP_PAR_SLOW /*par_slow()*/ /*Set low speed on the parallel port*/
83 #define LV_DRV_DISP_PAR_FAST /*par_fast()*/ /*Set high speed on the parallel port*/
84 #define LV_DRV_DISP_PAR_WR_WORD(data) /*par_wr(data)*/ /*Write a word to the parallel port*/
85 #define LV_DRV_DISP_PAR_WR_ARRAY(adr, n) /*par_wr_mem(adr,n)*/ /*Write 'n' bytes to Parallel ports from 'adr'*/
86 
87 /***************************
88  * INPUT DEVICE INTERFACE
89  ***************************/
90 
91 /*----------
92  * Common
93  *----------*/
94 #define LV_DRV_INDEV_INCLUDE <stdint.h> /*Dummy include by default*/
95 #define LV_DRV_INDEV_RST(val) /*pin_x_set(val)*/ /*Set the reset pin to 'val'*/
96 #define LV_DRV_INDEV_IRQ_READ 0 /*pn_x_read()*/ /*Read the IRQ pin*/
97 
98 /*---------
99  * SPI
100  *---------*/
101 #define LV_DRV_INDEV_SPI_CS(val) /*spi_cs_set(val)*/ /*Set the SPI's Chip select to 'val'*/
102 #define LV_DRV_INDEV_SPI_XCHG_BYTE(data) 0 /*spi_xchg(val)*/ /*Write 'val' to SPI and give the read value*/
103 
104 /*---------
105  * I2C
106  *---------*/
107 #define LV_DRV_INDEV_I2C_START /*i2c_start()*/ /*Make an I2C start*/
108 #define LV_DRV_INDEV_I2C_STOP /*i2c_stop()*/ /*Make an I2C stop*/
109 #define LV_DRV_INDEV_I2C_RESTART /*i2c_restart()*/ /*Make an I2C restart*/
110 #define LV_DRV_INDEV_I2C_WR(data) /*i2c_wr(data)*/ /*Write a byte to the I1C bus*/
111 #define LV_DRV_INDEV_I2C_READ(last_read) 0 /*i2c_rd()*/ /*Read a byte from the I2C bud*/
112 
113 /*********************
114  * DISPLAY DRIVERS
115  *********************/
116 
117 /*-------------------
118  * Monitor of PC
119  *-------------------*/
120 #ifndef USE_MONITOR
121 # define USE_MONITOR 0
122 #endif
123 
124 #if USE_MONITOR
125 # define MONITOR_HOR_RES LV_HOR_RES
126 # define MONITOR_VER_RES LV_VER_RES
127 
128 /* Scale window by this factor (useful when simulating small screens) */
129 # define MONITOR_ZOOM 1
130 
131 /* Used to test true double buffering with only address changing.
132  * Set LV_VDB_SIZE = (LV_HOR_RES * LV_VER_RES) and LV_VDB_DOUBLE = 1 and LV_COLOR_DEPTH = 32" */
133 # define MONITOR_DOUBLE_BUFFERED 0
134 
135 /*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
136 # define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h>
137 
138 /*Different rendering might be used if running in a Virtual machine*/
139 # define MONITOR_VIRTUAL_MACHINE 0
140 #endif
141 
142 /*-----------------------------------
143  * Native Windows (including mouse)
144  *----------------------------------*/
145 #ifndef USE_WINDOWS
146 # define USE_WINDOWS 0
147 #endif
148 
149 #define USE_WINDOWS 0
150 #if USE_WINDOWS
151 # define WINDOW_HOR_RES LV_HOR_RES
152 # define WINDOW_VER_RES LV_VER_RES
153 #endif
154 
155 /*----------------
156  * LS013B7DH03
157  *--------------*/
158 #ifndef USE_LS013B7DH03
159 # define USE_LS013B7DH03 0
160 #endif
161 
162 #if USE_LS013B7DH03
163 #define SHARP_SEND_TOGGLE_VCOM_COMMAND 0x01
164 #define SHARP_SKIP_TOGGLE_VCOM_COMMAND 0x00
165 
166 #define SHARP_LCD_TRAILER_BYTE 0x00
167 
168 #define SHARP_VCOM_TOGGLE_BIT 0x40
169 
170 #define SHARP_LCD_CMD_CHANGE_VCOM 0x00
171 #define SHARP_LCD_CMD_CLEAR_SCREEN 0x20
172 #define SHARP_LCD_CMD_WRITE_LINE 0x80
173 #endif
174 
175 /*----------------
176  * SSD2119
177  *--------------*/
178 #ifndef USE_SSD2119
179 # define USE_SSD2119 0
180 #endif
181 
182 #if USE_SSD2119
183 // If no screen orientation is selected, "landscape" mode will be used.
184 #if ! defined(PORTRAIT) && ! defined(PORTRAIT_FLIP) && \
185  ! defined(LANDSCAPE) && ! defined(LANDSCAPE_FLIP)
186 #define LANDSCAPE
187 #endif
188 
189 #ifdef PORTRAIT
190 #define HORIZ_DIRECTION 0x28
191 #define VERT_DIRECTION 0x20
192 #define MAPPED_X(x, y) (LV_HOR_RES - 1 - (y))
193 #define MAPPED_Y(x, y) (x)
194 #endif
195 #ifdef LANDSCAPE
196 #define HORIZ_DIRECTION 0x00
197 #define VERT_DIRECTION 0x08
198 #define MAPPED_X(x, y) (LV_HOR_RES - 1 - (x))
199 #define MAPPED_Y(x, y) (LV_VER_RES - 1 - (y))
200 #endif
201 #ifdef PORTRAIT_FLIP
202 #define HORIZ_DIRECTION 0x18
203 #define VERT_DIRECTION 0x10
204 #define MAPPED_X(x, y) (y)
205 #define MAPPED_Y(x, y) (LV_VER_RES - 1 - (x))
206 #endif
207 #ifdef LANDSCAPE_FLIP
208 #define HORIZ_DIRECTION 0x30
209 #define VERT_DIRECTION 0x38
210 #define MAPPED_X(x, y) (x)
211 #define MAPPED_Y(x, y) (y)
212 #endif
213 
214 // Various internal SD2119 registers name labels
215 #define SSD2119_DEVICE_CODE_READ_REG 0x00
216 #define SSD2119_OSC_START_REG 0x00
217 #define SSD2119_OUTPUT_CTRL_REG 0x01
218 #define SSD2119_LCD_DRIVE_AC_CTRL_REG 0x02
219 #define SSD2119_PWR_CTRL_1_REG 0x03
220 #define SSD2119_DISPLAY_CTRL_REG 0x07
221 #define SSD2119_FRAME_CYCLE_CTRL_REG 0x0B
222 #define SSD2119_PWR_CTRL_2_REG 0x0C
223 #define SSD2119_PWR_CTRL_3_REG 0x0D
224 #define SSD2119_PWR_CTRL_4_REG 0x0E
225 #define SSD2119_GATE_SCAN_START_REG 0x0F
226 #define SSD2119_SLEEP_MODE_1_REG 0x10
227 #define SSD2119_ENTRY_MODE_REG 0x11
228 #define SSD2119_SLEEP_MODE_2_REG 0x12
229 #define SSD2119_GEN_IF_CTRL_REG 0x15
230 #define SSD2119_PWR_CTRL_5_REG 0x1E
231 #define SSD2119_RAM_DATA_REG 0x22
232 #define SSD2119_FRAME_FREQ_REG 0x25
233 #define SSD2119_ANALOG_SET_REG 0x26
234 #define SSD2119_VCOM_OTP_1_REG 0x28
235 #define SSD2119_VCOM_OTP_2_REG 0x29
236 #define SSD2119_GAMMA_CTRL_1_REG 0x30
237 #define SSD2119_GAMMA_CTRL_2_REG 0x31
238 #define SSD2119_GAMMA_CTRL_3_REG 0x32
239 #define SSD2119_GAMMA_CTRL_4_REG 0x33
240 #define SSD2119_GAMMA_CTRL_5_REG 0x34
241 #define SSD2119_GAMMA_CTRL_6_REG 0x35
242 #define SSD2119_GAMMA_CTRL_7_REG 0x36
243 #define SSD2119_GAMMA_CTRL_8_REG 0x37
244 #define SSD2119_GAMMA_CTRL_9_REG 0x3A
245 #define SSD2119_GAMMA_CTRL_10_REG 0x3B
246 #define SSD2119_V_RAM_POS_REG 0x44
247 #define SSD2119_H_RAM_START_REG 0x45
248 #define SSD2119_H_RAM_END_REG 0x46
249 #define SSD2119_X_RAM_ADDR_REG 0x4E
250 #define SSD2119_Y_RAM_ADDR_REG 0x4F
251 
252 #define ENTRY_MODE_DEFAULT 0x6830
253 #define MAKE_ENTRY_MODE(x) ((ENTRY_MODE_DEFAULT & 0xFF00) | (x))
254 
255 #define SSD2119_CMD_MODE 0
256 #define SSD2119_DATA_MODE 1
257 #endif
258 
259 /*----------------
260  * SSD1963
261  *--------------*/
262 #ifndef USE_SSD1963
263 # define USE_SSD1963 0
264 #endif
265 
266 #if USE_SSD1963
267 # define SSD1963_HOR_RES LV_HOR_RES
268 # define SSD1963_VER_RES LV_VER_RES
269 # define SSD1963_HT 531
270 # define SSD1963_HPS 43
271 # define SSD1963_LPS 8
272 # define SSD1963_HPW 10
273 # define SSD1963_VT 288
274 # define SSD1963_VPS 12
275 # define SSD1963_FPS 4
276 # define SSD1963_VPW 10
277 # define SSD1963_HS_NEG 0 /*Negative hsync*/
278 # define SSD1963_VS_NEG 0 /*Negative vsync*/
279 # define SSD1963_ORI 0 /*0, 90, 180, 270*/
280 # define SSD1963_COLOR_DEPTH 16
281 #endif
282 
283 /*----------------
284  * R61581
285  *--------------*/
286 #ifndef USE_R61581
287 # define USE_R61581 0
288 #endif
289 
290 #if USE_R61581
291 # define R61581_HOR_RES LV_HOR_RES
292 # define R61581_VER_RES LV_VER_RES
293 # define R61581_HSPL 0 /*HSYNC signal polarity*/
294 # define R61581_HSL 10 /*HSYNC length (Not Implemented)*/
295 # define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/
296 # define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */
297 # define R61581_VSPL 0 /*VSYNC signal polarity*/
298 # define R61581_VSL 10 /*VSYNC length (Not Implemented)*/
299 # define R61581_VFP 8 /*Vertical Front poarch*/
300 # define R61581_VBP 8 /*Vertical Back poarch */
301 # define R61581_DPL 0 /*DCLK signal polarity*/
302 # define R61581_EPL 1 /*ENABLE signal polarity*/
303 # define R61581_ORI 0 /*0, 180*/
304 # define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/
305 #endif
306 
307 /*------------------------------
308  * ST7565 (Monochrome, low res.)
309  *-----------------------------*/
310 #ifndef USE_ST7565
311 # define USE_ST7565 0
312 #endif
313 
314 #if USE_ST7565
315 /*No settings*/
316 #endif /*USE_ST7565*/
317 
318 /*------------------------------------------
319  * UC1610 (4 gray 160*[104|128])
320  * (EA DOGXL160 160x104 tested)
321  *-----------------------------------------*/
322 #ifndef USE_UC1610
323 # define USE_UC1610 0
324 #endif
325 
326 #if USE_UC1610
327 # define UC1610_HOR_RES LV_HOR_RES
328 # define UC1610_VER_RES LV_VER_RES
329 # define UC1610_INIT_CONTRAST 33 /* init contrast, values in [%] */
330 # define UC1610_INIT_HARD_RST 0 /* 1 : hardware reset at init, 0 : software reset */
331 # define UC1610_TOP_VIEW 0 /* 0 : Bottom View, 1 : Top View */
332 #endif /*USE_UC1610*/
333 
334 /*-----------------------------------------
335  * Linux frame buffer device (/dev/fbx)
336  *-----------------------------------------*/
337 #ifndef USE_FBDEV
338 # define USE_FBDEV 0
339 #endif
340 
341 #if USE_FBDEV
342 # define FBDEV_PATH "/dev/fb0"
343 #endif
344 
345 /*********************
346  * INPUT DEVICES
347  *********************/
348 
349 /*--------------
350  * XPT2046
351  *--------------*/
352 #ifndef USE_XPT2046
353 # define USE_XPT2046 0
354 #endif
355 
356 #if USE_XPT2046
357 # define XPT2046_HOR_RES 480
358 # define XPT2046_VER_RES 320
359 # define XPT2046_X_MIN 200
360 # define XPT2046_Y_MIN 200
361 # define XPT2046_X_MAX 3800
362 # define XPT2046_Y_MAX 3800
363 # define XPT2046_AVG 4
364 # define XPT2046_INV 0
365 #endif
366 
367 /*-----------------
368  * FT5406EE8
369  *-----------------*/
370 #ifndef USE_FT5406EE8
371 # define USE_FT5406EE8 0
372 #endif
373 
374 #if USE_FT5406EE8
375 # define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/
376 #endif
377 
378 /*---------------
379  * AD TOUCH
380  *--------------*/
381 #ifndef USE_AD_TOUCH
382 # define USE_AD_TOUCH 0
383 #endif
384 
385 #if USE_AD_TOUCH
386 /*No settings*/
387 #endif
388 
389 
390 /*---------------------------------------
391  * Mouse or touchpad on PC (using SDL)
392  *-------------------------------------*/
393 #ifndef USE_MOUSE
394 # define USE_MOUSE 0
395 #endif
396 
397 #if USE_MOUSE
398 /*No settings*/
399 #endif
400 
401 /*-------------------------------------------
402  * Mousewheel as encoder on PC (using SDL)
403  *------------------------------------------*/
404 #ifndef USE_MOUSEWHEEL
405 # define USE_MOUSEWHEEL 0
406 #endif
407 
408 #if USE_MOUSEWHEEL
409 /*No settings*/
410 #endif
411 
412 /*-------------------------------------------------
413  * Touchscreen as libinput interface (for Linux based systems)
414  *------------------------------------------------*/
415 #ifndef USE_LIBINPUT
416 # define USE_LIBINPUT 0
417 #endif
418 
419 #if USE_LIBINPUT
420 # define LIBINPUT_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
421 #endif /*USE_LIBINPUT*/
422 
423 /*-------------------------------------------------
424  * Mouse or touchpad as evdev interface (for Linux based systems)
425  *------------------------------------------------*/
426 #ifndef USE_EVDEV
427 # define USE_EVDEV 0
428 #endif
429 
430 #if USE_EVDEV
431 # define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
432 # define EVDEV_SWAP_AXES 0 /*Swap the x and y axes of the touchscreen*/
433 
434 # define EVDEV_SCALE 0 /* Scale input, e.g. if touchscreen resolution does not match display resolution */
435 # if EVDEV_SCALE
436 # define EVDEV_SCALE_HOR_RES (4096) /* Horizontal resolution of touchscreen */
437 # define EVDEV_SCALE_VER_RES (4096) /* Vertical resolution of touchscreen */
438 # endif /*EVDEV_SCALE*/
439 
440 # define EVDEV_CALIBRATE 0 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
441 # if EVDEV_CALIBRATE
442 # define EVDEV_HOR_MIN 3800 /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
443 # define EVDEV_HOR_MAX 200
444 # define EVDEV_VER_MIN 200
445 # define EVDEV_VER_MAX 3800
446 # endif /*EVDEV_SCALE*/
447 #endif /*USE_EVDEV*/
448 
449 /*-------------------------------
450  * Keyboard of a PC (using SDL)
451  *------------------------------*/
452 #ifndef USE_KEYBOARD
453 # define USE_KEYBOARD 0
454 #endif
455 
456 #if USE_KEYBOARD
457 /*No settings*/
458 #endif
459 
460 #ifdef __cplusplus
461 } /* extern "C" */
462 #endif
463 
464 #endif /*LV_DRV_CONF_H*/
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale