forked from lvgl/lv_drivers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lv_drv_conf_templ.h
533 lines (477 loc) · 14.2 KB
/
lv_drv_conf_templ.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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
/**
* @file lv_drv_conf.h
*
*/
/*
* COPY THIS FILE AS lv_drv_conf.h
*/
#if 0 /*Set it to "1" to enable the content*/
#ifndef LV_DRV_CONF_H
#define LV_DRV_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lv_conf.h"
/*********************
* INCLUDES
*********************/
/* Add specific sdk include here */
/*********************
* DEFINES
*********************/
/* Disable with 0 if driver don't use an specific api */
#define LV_DRIVER_ENABLE_COMMON 1
#define LV_DRIVER_ENABLE_DELAY 1
#define LV_DRIVER_ENABLE_I2C 1
#define LV_DRIVER_ENABLE_SPI 1
#define LV_DRIVER_ENABLE_PAR 1
/* use this macro if you want ignore a gpio write/read. e.g: spi.cs = LV_DRIVER_NOPIN */
#define LV_DRIVER_NOPIN (0xFFFF)
/* use this macro to add specific attribute to function call into an interupt routines */
#define INTERUPT_ATTRIBUTE
/**********************
* TYPEDEFS
**********************/
/* You can use a pointer handler or just a id number to reder to a device
* e.g: typedef const uint8_t lv_gpio_handle_t if you need just a bus id
* You can use device descriptor from your sdk too.
*/
typedef const void* lv_gpio_handle_t;
typedef const void* lv_i2c_handle_t;
typedef const void* lv_spi_handle_t;
typedef const void* lv_par_handle_t;
typedef const void* lv_uart_handle_t;
/*********************
* HAL INTERFACE
*********************/
/*
* All used peripherals must be initialized in user application, library only
* manipulate them.
* You can use a device descriptor from your SDK or do your own in this file too.
* example:
* typedef struct lv_spi_dev_t { .... };
*/
/*------------
* Delay
*------------*/
#if LV_DRIVER_ENABLE_DELAY
/**
* Delay the given number of microseconds
* @param us Time to wait in us
*/
static inline void lv_delay_us(const uint32_t us)
{
//Do the dependant port here
}
/**
* Delay the given number of milliseconds
* @param ms Time to wait in ms
*/
static inline void lv_delay_ms(const uint32_t ms)
{
//Do the dependant port here
}
/**
* Return system time
* @return system time (ms)
*/
static inline uint32_t lv_get_ms()
{
//Do the dependant port here
}
#endif
/*------------
* Common
*------------*/
#if LV_DRIVER_ENABLE_COMMON
/**
* Change a pin level
* @param pin gpio Number
* @param val Level to set
*/
static inline void lv_gpio_write(lv_gpio_handle_t gpio, const uint8_t val)
{
//Do the dependant port here
}
/**
* Read current level gpio
* @param pin gpio to read
* @return gpio value
*/
static inline uint8_t lv_gpio_read(lv_gpio_handle_t gpio)
{
//Do the dependant port here
}
#endif
/*---------
* I2C
*---------*/
#if LV_DRIVER_ENABLE_I2C
/**
* Do a I2C write transmission on 8 bits register device.
* @param i2c_dev Pointer to i2c device
* @param reg Pointer to register address to send if non-null
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to send
* @return Non-Zero if error occured
*/
static inline int lv_i2c_write(lv_i2c_handle_t i2c_dev, const uint8_t* reg, const void* data_out, uint16_t datalen)
{
//Do the dependant port here
}
/**
* Do a I2C read transmission on 8 bits register device.
* @param i2c_dev Pointer to i2c device
* @param reg Pointer to register address to send if non-null
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to send
* @return Non-Zero if error occured
*/
static inline int lv_i2c_read(lv_i2c_handle_t i2c_dev, const uint8_t* reg, void* data_in, uint16_t datalen)
{
//Do the dependant port here
}
/**
* Do a I2C write transmissionon 16 bits register device
* @param i2c_dev Pointer to i2c device
* @param reg Pointer to register address to send if non-null
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to send
* @return Non-Zero if error occured
*/
static inline int lv_i2c_write16(lv_i2c_handle_t i2c_dev, const uint16_t* reg, const void* data_out, uint16_t datalen)
{
//Do the dependant port here
}
/**
* Do a I2C write transmissionon 16 bits register device.
* @param i2c_dev Pointer to i2c device
* @param reg Pointer to register address to send if non-null
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to send
* @return Non-Zero if error occured
*/
static inline int lv_i2c_read16(lv_i2c_handle_t i2c_dev, const uint16_t* reg, void* data_in, uint16_t datalen)
{
//Do the dependant port here
}
#endif
/*---------
* SPI
*---------*/
#if LV_DRIVER_ENABLE_SPI
typedef enum {
LV_SPI_COMMAND,
LV_SPI_ADDRESS,
LV_SPI_DUMMY,
} lv_spi_reg_t;
/**
* Control SPI cs pin.
* @param spi_dev Pointer to spi device
* @param lvl Gpio Level
*/
static inline void lv_spi_wr_cs(lv_spi_handle_t spi_dev, uint8_t lvl)
{
//Do the dependant port here
}
/**
* Control SPI dc pin.
* @param spi_dev Pointer to spi device
* @param lvl Gpio Level
*/
static inline void lv_spi_wr_dc(lv_spi_handle_t spi_dev, uint8_t lvl)
{
//Do the dependant port here
}
/**
* Do a SPI transaction .
* @param spi_dev Pointer to spi device
* @param data_in Receive buffer. If NULL, received data will be lost.
* @param data_out Data to send buffer. If NULL, it will only receive data.
* @param len Buffer size in words
* @param word_size Size of the word in byte
* @return Non-Zero if error occured
*/
static inline int lv_spi_transaction(lv_spi_handle_t spi_dev, void* data_in, const void* data_out, uint16_t len, uint8_t word_size)
{
//Do the dependant port here
}
/**
* Do a SPI repeat send.
* @param spi_dev Pointer to spi device
* @param template Pointer toTemplate to send throw spi.
* @param repeats Copy number
* @param template_size Size of the template in byte
* @return Non-Zero if error occured
*/
static inline int lv_spi_repeat(lv_spi_handle_t spi_dev, const void* template, uint32_t repeats, uint8_t template_size)
{
//Do the dependant port here
}
/**
* Set command to send for spi transaction
* @param spi_dev Pointer to spi device
* @param reg SPI register to set (dummy/command/address)
* @param value Value
* @param bits Bits number
* @return Non-Zero if error occured
*/
static inline int lv_drv_spi_set_preemble(lv_spi_handle_t spi_dev, lv_spi_reg_t reg, uint32_t value, uint8_t bits)
{
//Do the dependant port here
}
/**
* Clear spi bus command
* @param spi_dev Pointer to spi device
* @param reg SPI register to clear (dummy/command/address)
* @return Non-Zero if error occured
*/
static inline int lv_spi_clr_preemble(lv_spi_handle_t spi_dev, lv_spi_reg_t reg)
{
//Do the dependant port here
}
#endif
/*------------------
* Parallel port
*-----------------*/
#if LV_DRIVER_ENABLE_PAR
/**
* Control Parallel cs pin.
* @param par_dev Pointer to parallel device
* @param lvl Gpio Level
*/
static inline void lv_par_wr_cs(lv_par_handle_t par_dev, uint8_t lvl)
{
//Do the dependant port here
}
/**
* Control Parallel dc pin.
* @param par_dev Pointer to parallel device
* @param lvl Gpio Level
*/
static inline void lv_par_wr_dc(lv_par_handle_t par_dev, uint8_t lvl)
{
//Do the dependant port here
}
/**
* Do a Parallel port write.
* @param par_dev Pointer to parallel port device
* @param data_out Pointer to data buffer to send
* @param len Buffer size in words
* @param word_size Size of the word in byte
* @return Non-Zero if error occured
*/
static inline int lv_par_write(lv_par_handle_t par_dev, const void* data_out, uint16_t len, uint8_t word_size)
{
//Do the dependant port here
}
/**
* Do a Parallel port read.
* @param par_dev Pointer to parallel port device
* @param data_in Pointer to data buffer to read
* @param len Buffer size in words
* @param word_size Size of the word in byte
* @return Non-Zero if error occured
*/
static inline int lv_par_read(lv_par_handle_t par_dev, void* data_in, uint16_t len, uint8_t word_size)
{
//Do the dependant port here
}
/*---------
* UART
*---------*/
/**
* Do a uart write transmission.
* @param uart_dev Pointer to uart device
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to send
* @return Non-Zero if error occured
*/
static inline int lv_uart_write(lv_uart_handle_t uart_dev, const void* data_out, uint16_t datalen)
{
//Do the dependant port here
}
/**
* Do a uart read transmission
* @param uart_dev Pointer to uart device
* @param data_out Pointer to data buffer to send if non-null
* @param datalen Number of data byte to read
* @return Non-Zero if error occured
*/
static inline int lv_uart_read(lv_uart_handle_t uart_dev, void* data_in, uint16_t datalen)
{
//Do the dependant port here
}
#endif
/*********************
* DISPLAY DRIVERS
*********************/
/*-------------------
* Monitor of PC
*-------------------*/
#define USE_MONITOR 0
#if USE_MONITOR
#define MONITOR_HOR_RES LV_HOR_RES
#define MONITOR_VER_RES LV_VER_RES
#define MONITOR_ZOOM 2 /* Scale window by this factor (useful when simulating small screens) */
#define MONITOR_SDL_INCLUDE_PATH <SDL2/SDL.h> /*Eclipse: <SDL2/SDL.h> Visual Studio: <SDL.h>*/
#define MONITOR_VIRTUAL_MACHINE 0 /*Different rendering should be used if running in a Virtual machine*/
#endif
/*----------------
* ILI9341
*--------------*/
#define USE_ILI9341 1
#if USE_ILI9341
#define ILI9341_DEBUG (0)
#define ILI9341_ERR_CHECK (0) //retrieve err from transaction if true
#define ILI9341_PAR_SUPPORT (1)
#define ILI9341_SPI4WIRE_SUPPORT (1)
#define ILI9341_SPI3WIRE_SUPPORT (1)
#define ILI9341_EXTC_SUPPORT (0) //EXTC pin high ? Set at 1 if yes for extended command usage.
#define ILI9341_MAX_SAMPLE (64) //Pixel sample size to send (N byte x Pixel Size)
#define ILI9341_SERIAL_BYTESWAP (0) //Set Endiannes Swap { 0: None, 1: CPU Swap, 2: ILI9341 swap(need EXTC) }
#endif
/*----------------
* SSD1963
*--------------*/
#define USE_SSD1963 0
#if USE_SSD1963
#define SSD1963_HOR_RES LV_HOR_RES
#define SSD1963_VER_RES LV_VER_RES
#define SSD1963_HT 531
#define SSD1963_HPS 43
#define SSD1963_LPS 8
#define SSD1963_HPW 10
#define SSD1963_VT 288
#define SSD1963_VPS 12
#define SSD1963_FPS 4
#define SSD1963_VPW 10
#define SSD1963_HS_NEG 0 /*Negative hsync*/
#define SSD1963_VS_NEG 0 /*Negative vsync*/
#define SSD1963_ORI 0 /*0, 90, 180, 270*/
#define SSD1963_COLOR_DEPTH 16
#endif
/*----------------
* SSD1306
*--------------*/
#define USE_SSD1306 1
#if USE_SSD1306
#define SSD1306_DEBUG (0)
#define SSD1306_HOR_RES (LV_HOR_RES)
#define SSD1306_VER_RES (LV_VER_RES)
#define SSD1306_ERR_CHECK (0)
#define SSD1306_I2C_SUPPORT (1)
#define SSD1306_SPI_4_WIRE_SUPPORT (1)
#define SSD1306_SPI_3_WIRE_SUPPORT (1)
#endif
/*----------------
* R61581
*--------------*/
#define USE_R61581 0
#if USE_R61581 != 0
#define R61581_HOR_RES LV_HOR_RES
#define R61581_VER_RES LV_VER_RES
#define R61581_HSPL 0 /*HSYNC signal polarity*/
#define R61581_HSL 10 /*HSYNC length (Not Implemented)*/
#define R61581_HFP 10 /*Horitontal Front poarch (Not Implemented)*/
#define R61581_HBP 10 /*Horitontal Back poarch (Not Implemented */
#define R61581_VSPL 0 /*VSYNC signal polarity*/
#define R61581_VSL 10 /*VSYNC length (Not Implemented)*/
#define R61581_VFP 8 /*Vertical Front poarch*/
#define R61581_VBP 8 /*Vertical Back poarch */
#define R61581_DPL 0 /*DCLK signal polarity*/
#define R61581_EPL 1 /*ENABLE signal polarity*/
#define R61581_ORI 0 /*0, 180*/
#define R61581_LV_COLOR_DEPTH 16 /*Fix 16 bit*/
#endif
/*------------------------------
* ST7565 (Monochrome, low res.)
*-----------------------------*/
#define USE_ST7565 0
#if USE_ST7565 != 0
/*No settings*/
#endif /*USE_ST7565*/
/*-----------------------------------------
* Linux frame buffer device (/dev/fbx)
*-----------------------------------------*/
#define USE_FBDEV 0
#if USE_FBDEV != 0
#define FBDEV_PATH "/dev/fb0"
#endif
/*********************
* INPUT DEVICES
*********************/
/*--------------
* AR1000
*--------------*/
#define USE_AR10XX (1)
#if (USE_AR10XX != 0)
#define AR10XX_SPI_SUPPORT (1)
#define AR10XX_I2C_SUPPORT (1)
#define AR10XX_UART_SUPPORT (1)
#define AR10XX_DEBUG (0)
#define AR10XX_ERR_CHECK (0)
#define AR10XX_VERIFY_ANSWER (1)
#define AR10XX_COMPONENT (21) // Version of XX (10, 11, 20 , 21)
#endif
/*--------------
* XPT2046
*--------------*/
#define USE_XPT2046 0
#if USE_XPT2046 != 0
#define XPT2046_HOR_RES 480
#define XPT2046_VER_RES 320
#define XPT2046_X_MIN 200
#define XPT2046_Y_MIN 200
#define XPT2046_X_MAX 3800
#define XPT2046_Y_MAX 3800
#define XPT2046_AVG 4
#define XPT2046_INV 0
#endif
/*-----------------
* FT5406EE8
*-----------------*/
#define USE_FT5406EE8 0
#if USE_FT5406EE8
#define FT5406EE8_I2C_ADR 0x38 /*7 bit address*/
#endif
/*---------------
* AD TOUCH
*--------------*/
#define USE_AD_TOUCH 0
#if USE_AD_TOUCH != 0
/*No settings*/
#endif
/*---------------------------------------
* Mouse or touchpad on PC (using SDL)
*-------------------------------------*/
#define USE_MOUSE 0
#if USE_MOUSE
/*No settings*/
#endif
/*-------------------------------------------
* Mousewheel as encoder on PC (using SDL)
*------------------------------------------*/
#define USE_ENCODER 1
#if USE_ENCODER
/*No settings*/
#endif
/*-------------------------------------------------
* Mouse or touchpad as evdev interface (for Linux based systems)
*------------------------------------------------*/
#define USE_EVDEV 0
#if USE_EVDEV
#define EVDEV_NAME "/dev/input/event0" /*You can use the "evtest" Linux tool to get the list of devices and test them*/
#endif
/*-------------------------------
* Keyboard of a PC (using SDL)
*------------------------------*/
#define USE_KEYBOARD 0
#if USE_KEYBOARD
/*No settings*/
#endif
#ifdef __cplusplus
}
#endif
#endif /*LV_DRV_CONF_H*/
#endif /*Remove this to enable the content*/