You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is version 5 of this code library and there are a couple of changes from V4.
70
67
71
-
First of all, support for FT80x is gone. The main reason is that this allowed a nice speed improvement modification that only works with FT81x and beyond.
68
+
First of all, support for FT80x is gone.
69
+
The main reason is that this allowed a nice speed improvement modification that only works with FT81x and beyond.
72
70
Then there is a hard break from FT80x to FT81x with ony 256k of memory in FT80x but 1MB in FT81x. The memory map is different and all the registers are located elsewhere.
73
-
FT810, FT811, FT812, FT813, BT815, BT816, BT817 and BT818 can use the exact same code as long none of the new features of BT81x are used - and there are plenty of modules with these available to choose from
74
-
75
-
As a side effect all commands are automatically started now.
76
-
77
-
Second is that there are two sets of display-list building command functions now: EVE_cmd_xxx() and EVE_cmd_xxx_burst().
71
+
FT810, FT811, FT812, FT813, BT815, BT816, BT817 and BT818 can use the exact same code as long none of the new features of BT81x are used - and there are plenty of modules with these available to choose from.
72
+
As a side effect all commands are automatically started now.
73
+
Second is that there are two sets of display-list building command functions now: EVE_cmd_xxx() and EVE_cmd_xxx_burst().
78
74
The EVE_cmd_xxx_burst() functions are optimized for speed, these are pure data transfer functions and do not even check anymore if burst mode is active.
79
75
80
76
## Structure
81
77
82
-
This library currently has nine files that I hope are named to make clear what these do:
83
-
84
-
- EVE.h - this has all defines for FT81x / BT81x itself, so here are options, registers, commands and macros defined
85
-
- EVE_commands.c - this has all the API functions that are to be called from an application
86
-
- EVE_commands.h - this contains the prototypes for the functions in EVE_commands.c
87
-
- EVE_config.h - this has all the parameters for the numerous supported display modules, here is definded which set of parameters is to be used
88
-
- EVE_target.c - this has non-portable specific code for a number of supported controllers, mostly to support DMA
89
-
- EVE_target.h - this has non-portable pin defines and code as "static inline" functions for all supported controllers
90
-
- EVE_target.cpp - this is for Arduino C++ targets
91
-
- EVE_cpp_wrapper.cpp - this is for Arduino C++ targets
92
-
- EVE_cpp_wrapper.h - this is for Arduino C++ targets
78
+
This library currently has nine files that I hope are named to make clear what these do:
79
+
- EVE.h - this has all defines for FT81x / BT81x itself, so here are options, registers, commands and macros defined
80
+
- EVE_commands.c - this has all the API functions that are to be called from an application
81
+
- EVE_commands.h - this contains the prototypes for the functions in EVE_commands.c
82
+
- EVE_config.h - this has all the parameters for the numerous supported display modules, here is definded which set of parameters is to be used
83
+
- EVE_target.c - this has non-portable specific code for a number of supported controllers, mostly to support DMA
84
+
- EVE_target.h - this has non-portable pin defines and code as "static inline" functions for all supported controllers
85
+
- EVE_target.cpp - this is for Arduino C++ targets
86
+
- EVE_cpp_wrapper.cpp - this is for Arduino C++ targets
87
+
- EVE_cpp_wrapper.h - this is for Arduino C++ targets
93
88
94
89
## Examples
95
90
@@ -100,7 +95,7 @@ EVE_cmd_dl(DL_CLEAR_COLOR_RGB | WHITE); // sets the background color
EVE_cmd_dl(DL_DISPLAY); // put in the display list to mark its end
98
+
EVE_cmd_dl(DL_DISPLAY); // put in the display list to mark the end
104
99
EVE_cmd_dl(CMD_SWAP); // tell EVE to use the new display list
105
100
while (EVE_busy());
106
101
````
@@ -121,11 +116,11 @@ EVE_end_cmd_burst();
121
116
while (EVE_busy());
122
117
````
123
118
124
-
This does the same as the first example but faster.
119
+
This does the same as the first example but faster.
125
120
The preceding EVE_start_cmd_burst() either sets chip-select to low and sends out the three byte address.
126
-
Or if DMA is available for the target you are compiling for with support code in EVE_target.c / EVE_target.cpp and EVE_target.h, it writes the address to EVE_dma_buffer and sets EVE_dma_buffer_index to 1.
121
+
Or if DMA is available for the target you are compiling for with support code in EVE_target.c / EVE_target.cpp and EVE_target.h, it writes the address to EVE_dma_buffer[] and sets EVE_dma_buffer_index to 1.
127
122
128
-
Note the trailing "_burst" in the following functions, these are special versions of these commands that can only be used within an EVE_start_cmd_burst()/EVE_end_cmd_bust() pair.
123
+
Note the trailing "_burst" in the following functions, these are special versions of these commands that can only be used within an EVE_start_cmd_burst()/EVE_end_cmd_bust() pair.
129
124
These functions are optimized to push out data and nothing else.
130
125
131
126
The final EVE_end_cmd_burst() either pulls back the chip-select to high.
@@ -134,7 +129,7 @@ Or if we have DMA it calls EVE_start_dma_transfer() to start pushing out the buf
134
129
As we have 7 commands for EVE in these simple examples, the second one has the address overhead removed from six commands and therefore needs to transfer 18 bytes less over SPI.
135
130
So even with a small 8-bit controller that does not support DMA this is a usefull optimization for building display lists.
136
131
137
-
Using DMA has one caveat: we need to limit the transfer to <4k as we are writing to the FIFO of EVEs command co-processor. This is usually not an issue though as we can shorten the display list generation with previously generated snippets that we attach to the current list with CMD_APPEND. And when we use widgets like CMD_BUTTON or CMD_CLOCK the generated display list grows by a larger amount than what we need to put into the command-FIFO so we likely reach the 8k limit of the display-list before we hit the 4k limit of the command-FIFO.
132
+
Using DMA has one caveat: we need to limit the transfer to <4k as we are writing to the FIFO of EVEs command co-processor. This is usually not an issue though as we can shorten the display list generation with previously generated snippets that we attach to the current list with CMD_APPEND. And when we use widgets like CMD_BUTTON or CMD_CLOCK the generated display list grows by a larger amount than what we need to put into the command-FIFO so we likely reach the 8k limit of the display-list before we hit the 4k limit of the command-FIFO.
138
133
It is possible to use two or more DMA transfers to the FIFO to build a single display list, either to get around the 4k limit of the FIFO or in order to distribute the workload better of the time necessary between two display renewals.
139
134
140
135
You could for example do this, spread over three consecutive calls:
@@ -160,9 +155,9 @@ EVE_cmd_dl_burst(CMD_SWAP);
160
155
EVE_end_cmd_burst();
161
156
````
162
157
163
-
But you need to check with EVE_busy() before each of these blocks.
164
-
Maybe similar like this never compiled pseudo-code:
165
-
158
+
But you need to check with EVE_busy() before each of these blocks.
159
+
Maybe similar like this never compiled pseudo-code:
160
+
````
166
161
thread_1ms_update_display()
167
162
{
168
163
static uint8_t state = 0;
@@ -193,32 +188,39 @@ thread_1ms_update_display()
193
188
}
194
189
}
195
190
}
196
-
191
+
````
197
192
198
193
## Remarks
199
194
200
-
The examples in the "example_projects" drawer are for use with AtmelStudio7.
195
+
The examples in the "example_projects" drawer are for use with AtmelStudio7.
201
196
For Arduino I am using PlatformIO with Visual Studio Code.
202
197
203
-
The platform the code is compiled for is automatically detected thru compiler flags in EVE_target.h.
204
-
205
-
The desired TFT is selected by adding a define for it to the build-environment, e.g. -DEVE_EVE3_50G
206
-
There is a list of available options at the start of EVE_config.h sorted by chipset.
207
-
208
-
- Provide the pins used for Chip-Select and Power-Down in EVE_target.h for the target configuration you are using
198
+
The platform the code is compiled for is automatically detected thru compiler flags in EVE_target.h.
199
+
The desired TFT is selected by adding a define for it to the build-environment, for example: "-DEVE_EVE3_50G"
200
+
There is a list of available options at the start of EVE_config.h sorted by chipset.
201
+
The pins used for Chip-Select and Power-Down are configured in the EVE_target/EVE_target_xxxx.h files like this:
202
+
````
203
+
#if !defined(EVE_CS)
204
+
#define EVE_CS 10
205
+
#endif
209
206
210
-
When compiling for AVR you need to provide the clock it is running at in order to make the _delay_ms() calls used to initialize the TFT work with the intended timing.
211
-
For other plattforms you need to provide a DELAY_MS(ms) function that works at least between 1ms and 56ms and is not performing these delays shorter than requested.
207
+
#if !defined(EVE_PDN)
208
+
#define EVE_PDN 8
209
+
#endif
210
+
````
211
+
So you can override the default settings by adding your own defines to your build-environment, for example: "-DEVE_CS=9"
212
+
When compiling for AVR you need to provide the clock it is running at in order to make the _delay_ms() calls used to initialize the TFT work with the intended timing.
213
+
For other plattforms you need to provide a DELAY_MS(ms) function that works at least between 1ms and 56ms and is not performing these delays shorter than requested.
212
214
The DELAY_MS(ms) is only used during initialization of the FT8xx/BT8xx.
213
-
See EVE_target.h for examples.
215
+
See EVE_target.h for examples.
214
216
215
-
In Addition you need to initialize the pins used for Chip-Select and Power-Down in your hardware correctly to output.
216
-
Plus setup the SPI accordingly, mode-0, 8-bit, MSB-first, not more than 11MHz for the init.
217
-
A couple of targets already have a function EVE_init_spi() in EVE_target.c.
217
+
In Addition you need to initialize the pins used for Chip-Select and Power-Down in your hardware correctly to output.
218
+
Plus setup the SPI accordingly, mode-0, 8-bit, MSB-first, not more than 11MHz for the init.
219
+
A couple of targets already have a function EVE_init_spi() in EVE_target.c or EVE_cpp_target.cpp.
218
220
219
221
A word of "warning", you have to take a little care yourself to for example not send more than 4kB at once to the command co-processor
220
-
or to not generate display lists that are longer than 8kB.
221
-
My library does not check and re-check the command-FIFO on every step.
222
+
or to not generate display lists that are longer than 8kB.
223
+
My library does not check and re-check the command-FIFO on every step.
222
224
This is optimized for speed, so the training wheels are off.
EVE_cmd_flashread(MEM_FONT, 84928, 320); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */
355
+
EVE_cmd_flashread(MEM_FONT, 61376, 320); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */
345
356
}
346
357
347
358
#endif/* TEST_UTF8 */
@@ -353,7 +364,6 @@ void TFT_init(void)
353
364
}
354
365
}
355
366
356
-
357
367
uint16_ttoggle_state=0;
358
368
uint16_tdisplay_list_size=0;
359
369
@@ -394,19 +404,20 @@ void TFT_touch(void)
394
404
}
395
405
}
396
406
break;
407
+
default:
408
+
break;
397
409
}
398
410
}
399
411
}
400
412
401
-
402
413
/*
403
414
dynamic portion of display-handling, meant to be called every 20ms or more
404
415
*/
405
416
voidTFT_display(void)
406
417
{
407
418
staticint32_trotate=0;
408
419
409
-
if(tft_active!=0)
420
+
if(tft_active!=0U)
410
421
{
411
422
#if defined (EVE_DMA)
412
423
uint16_tcmd_fifo_size;
@@ -418,18 +429,18 @@ void TFT_display(void)
418
429
EVE_cmd_dl_burst(CMD_DLSTART); /* start the display list */
419
430
EVE_cmd_dl_burst(DL_CLEAR_COLOR_RGB | WHITE); /* set the default clear color to white */
420
431
EVE_cmd_dl_burst(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); /* clear the screen - this and the previous prevent artifacts between lists, Attributes are the color, stencil and tag buffers */
421
-
EVE_cmd_dl_burst(TAG(0));
432
+
EVE_cmd_dl_burst(DL_TAG);
422
433
423
434
EVE_cmd_append_burst(MEM_DL_STATIC, num_dl_static); /* insert static part of display-list from copy in gfx-mem */
424
435
/* display a button */
425
436
EVE_color_rgb_burst(WHITE);
426
-
EVE_cmd_fgcolor_burst(0x00c0c0c0); /* some grey */
427
-
EVE_cmd_dl_burst(TAG(10)); /* assign tag-value '10' to the button that follows */
437
+
EVE_cmd_fgcolor_burst(0x00c0c0c0UL); /* some grey */
438
+
EVE_cmd_dl_burst(DL_TAG+10U); /* assign tag-value '10' to the button that follows */
0 commit comments