Skip to content
This repository was archived by the owner on Dec 4, 2020. It is now read-only.

Commit 2421bad

Browse files
authored
Merge pull request #4 from Pablo2048/bugfix/print_cb
lv_log_register_print method renamed, examples corrected
2 parents 177d586 + 8d26e05 commit 2421bad

File tree

3 files changed

+107
-12
lines changed

3 files changed

+107
-12
lines changed

examples/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void setup() {
6666
lv_init();
6767

6868
#if USE_LV_LOG != 0
69-
lv_log_register_print(my_print); /* register print function for debugging */
69+
lv_log_register_print_cb(my_print); /* register print function for debugging */
7070
#endif
7171

7272
tft.begin(); /* TFT init */
@@ -84,7 +84,7 @@ void setup() {
8484
lv_disp_drv_register(&disp_drv);
8585

8686

87-
/*Initialize the touch pad*/
87+
/*Initialize the input device driver*/
8888
lv_indev_drv_t indev_drv;
8989
lv_indev_drv_init(&indev_drv);
9090
indev_drv.type = LV_INDEV_TYPE_ENCODER;

examples/ESP32_TFT_eSPI_Slider/Setup.ino

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void setup() {
1010
lv_init();
1111

1212
#if USE_LV_LOG != 0
13-
lv_log_register_print(my_print); /* register print function for debugging */
13+
lv_log_register_print_cb(my_print); /* register print function for debugging */
1414
#endif
1515

1616
tft.begin(); /* TFT init */
@@ -30,20 +30,13 @@ void setup() {
3030
disp_drv.buffer = &disp_buf;
3131
lv_disp_drv_register(&disp_drv);
3232

33+
/*Initialize the input device driver*/
3334
lv_indev_drv_t indev_drv;
3435
lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/
3536
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
3637
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
3738
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
3839

39-
40-
/*Initialize the touch pad*/
41-
//lv_indev_drv_t indev_drv;
42-
//lv_indev_drv_init(&indev_drv);
43-
//indev_drv.type = LV_INDEV_TYPE_ENCODER;
44-
//indev_drv.read_cb = read_encoder;
45-
//lv_indev_drv_register(&indev_drv);
46-
4740
/*Initialize the graphics library's tick*/
4841
tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler);
4942

lv_conf.h

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
/*Images pixels with this color will not be drawn (with chroma keying)*/
4444
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
4545

46+
/* Enable chroma keying for indexed images. */
47+
#define LV_INDEXED_CHROMA 1
48+
4649
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
4750
#define LV_ANTIALIAS 1
4851

@@ -193,6 +196,14 @@ typedef void * lv_img_decoder_user_data_t;
193196
* font's bitmaps */
194197
#define LV_ATTRIBUTE_LARGE_CONST
195198

199+
/* Export integer constant to binding.
200+
* This macro is used with constants in the form of LV_<CONST> that
201+
* should also appear on lvgl binding API such as Micropython
202+
*
203+
* The default value just prevents a GCC warning.
204+
*/
205+
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
206+
196207
/*===================
197208
* HAL settings
198209
*==================*/
@@ -220,14 +231,51 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
220231
* LV_LOG_LEVEL_INFO Log important events
221232
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
222233
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
234+
* LV_LOG_LEVEL_NONE Do not log anything
223235
*/
224236
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
225237

226238
/* 1: Print the log with 'printf';
227-
* 0: user need to register a callback with `lv_log_register_print`*/
239+
* 0: user need to register a callback with `lv_log_register_print_cb`*/
228240
# define LV_LOG_PRINTF 0
229241
#endif /*LV_USE_LOG*/
230242

243+
/*=================
244+
* Debug settings
245+
*================*/
246+
247+
/* If Debug is enabled LittelvGL validates the parameters of the functions.
248+
* If an invalid parameter is found an error log message is printed and
249+
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
250+
* If you are debugging the MCU you can pause
251+
* the debugger to see exactly where the issue is.
252+
*
253+
* The behavior of asserts can be overwritten by redefining them here.
254+
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
255+
*/
256+
#define LV_USE_DEBUG 1
257+
#if LV_USE_DEBUG
258+
259+
/*Check if the parameter is NULL. (Quite fast) */
260+
#define LV_USE_ASSERT_NULL 1
261+
262+
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
263+
#define LV_USE_ASSERT_MEM 1
264+
265+
/* Check the strings.
266+
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
267+
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
268+
#define LV_USE_ASSERT_STR 0
269+
270+
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
271+
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
272+
#define LV_USE_ASSERT_OBJ 0
273+
274+
/*Check if the styles are properly initialized. (Fast)*/
275+
#define LV_USE_ASSERT_STYLE 1
276+
277+
#endif /*LV_USE_DEBUG*/
278+
231279
/*================
232280
* THEME USAGE
233281
*================*/
@@ -259,6 +307,10 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
259307
#define LV_FONT_ROBOTO_22 0
260308
#define LV_FONT_ROBOTO_28 0
261309

310+
/* Demonstrate special features */
311+
#define LV_FONT_ROBOTO_12_SUBPX 1
312+
#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/
313+
262314
/*Pixel perfect monospace font
263315
* http://pelulamu.net/unscii/ */
264316
#define LV_FONT_UNSCII_8 0
@@ -274,6 +326,17 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
274326
/*Always set a default font from the built-in fonts*/
275327
#define LV_FONT_DEFAULT &lv_font_roboto_16
276328

329+
/* Enable it if you have fonts with a lot of characters.
330+
* The limit depends on the font size, font face and bpp
331+
* but with > 10,000 characters if you see issues probably you need to enable it.*/
332+
#define LV_FONT_FMT_TXT_LARGE 0
333+
334+
/* Set the pixel order of the display.
335+
* Important only if "subpx fonts" are used.
336+
* With "normal" font it doesn't matter.
337+
*/
338+
#define LV_FONT_SUBPX_BGR 0
339+
277340
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
278341
typedef void * lv_font_user_data_t;
279342

@@ -291,6 +354,42 @@ typedef void * lv_font_user_data_t;
291354
/*Can break (wrap) texts on these chars*/
292355
#define LV_TXT_BREAK_CHARS " ,.;:-_"
293356

357+
/* If a word is at least this long, will break wherever "prettiest"
358+
* To disable, set to a value <= 0 */
359+
#define LV_TXT_LINE_BREAK_LONG_LEN 12
360+
361+
/* Minimum number of characters in a long word to put on a line before a break.
362+
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
363+
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
364+
365+
/* Minimum number of characters in a long word to put on a line after a break.
366+
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
367+
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
368+
369+
/* The control character to use for signalling text recoloring. */
370+
#define LV_TXT_COLOR_CMD "#"
371+
372+
/* Support bidirectional texts.
373+
* Allows mixing Left-to-Right and Right-to-Left texts.
374+
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
375+
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
376+
#define LV_USE_BIDI 0
377+
#if LV_USE_BIDI
378+
/* Set the default direction. Supported values:
379+
* `LV_BIDI_DIR_LTR` Left-to-Right
380+
* `LV_BIDI_DIR_RTL` Right-to-Left
381+
* `LV_BIDI_DIR_AUTO` detect texts base direction */
382+
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
383+
#endif
384+
385+
/*Change the built in (v)snprintf functions*/
386+
#define LV_SPRINTF_CUSTOM 0
387+
#if LV_SPRINTF_CUSTOM
388+
# define LV_SPRINTF_INCLUDE <stdio.h>
389+
# define lv_snprintf snprintf
390+
# define lv_vsnprintf vsnprintf
391+
#endif /*LV_SPRINTF_CUSTOM*/
392+
294393
/*===================
295394
* LV_OBJ SETTINGS
296395
*==================*/
@@ -349,6 +448,9 @@ typedef void * lv_obj_user_data_t;
349448
/*Container (dependencies: -*/
350449
#define LV_USE_CONT 1
351450

451+
/*Color picker (dependencies: -*/
452+
#define LV_USE_CPICKER 1
453+
352454
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
353455
#define LV_USE_DDLIST 1
354456
#if LV_USE_DDLIST != 0

0 commit comments

Comments
 (0)