lv_conf.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. /**
  2. * @file lv_conf.h
  3. *
  4. */
  5. /*
  6. * COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER
  7. */
  8. #if 1 /*Set it to "1" to enable content*/
  9. #ifndef LV_CONF_H
  10. #define LV_CONF_H
  11. /* clang-format off */
  12. #include <stdint.h>
  13. /*====================
  14. Graphical settings
  15. *====================*/
  16. /* Maximal horizontal and vertical resolution to support by the library.*/
  17. #define LV_HOR_RES_MAX (320)
  18. #define LV_VER_RES_MAX (240)
  19. /* Color depth:
  20. * - 1: 1 byte per pixel
  21. * - 8: RGB233
  22. * - 16: RGB565
  23. * - 32: ARGB8888
  24. */
  25. #define LV_COLOR_DEPTH 32
  26. /* Swap the 2 bytes of RGB565 color.
  27. * Useful if the display has a 8 bit interface (e.g. SPI)*/
  28. #define LV_COLOR_16_SWAP 0
  29. /* 1: Enable screen transparency.
  30. * Useful for OSD or other overlapping GUIs.
  31. * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
  32. #define LV_COLOR_SCREEN_TRANSP 0
  33. /*Images pixels with this color will not be drawn (with chroma keying)*/
  34. #define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
  35. /* Enable anti-aliasing (lines, and radiuses will be smoothed) */
  36. #define LV_ANTIALIAS 1
  37. /* Default display refresh period.
  38. * Can be changed in the display driver (`lv_disp_drv_t`).*/
  39. #define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
  40. /* Dot Per Inch: used to initialize default sizes.
  41. * E.g. a button with width = LV_DPI / 2 -> half inch wide
  42. * (Not so important, you can adjust it to modify default sizes and spaces)*/
  43. #define LV_DPI 100 /*[px]*/
  44. /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
  45. typedef int16_t lv_coord_t;
  46. /*=========================
  47. Memory manager settings
  48. *=========================*/
  49. /* LittelvGL's internal memory manager's settings.
  50. * The graphical objects and other related data are stored here. */
  51. /* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
  52. #ifndef LV_MEM_CUSTOM
  53. #define LV_MEM_CUSTOM 0
  54. #endif
  55. #if LV_MEM_CUSTOM == 0
  56. /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
  57. # define LV_MEM_SIZE (128U * 1024U)
  58. /* Complier prefix for a big array declaration */
  59. # define LV_MEM_ATTR
  60. /* Set an address for the memory pool instead of allocating it as an array.
  61. * Can be in external SRAM too. */
  62. # define LV_MEM_ADR 0
  63. /* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
  64. # define LV_MEM_AUTO_DEFRAG 1
  65. #else /*LV_MEM_CUSTOM*/
  66. # define LV_MEM_CUSTOM_INCLUDE "bh_platform.h" /*Header for the dynamic memory function*/
  67. # define LV_MEM_CUSTOM_ALLOC BH_MALLOC /*Wrapper to malloc*/
  68. # define LV_MEM_CUSTOM_FREE BH_FREE /*Wrapper to free*/
  69. #endif /*LV_MEM_CUSTOM*/
  70. /* Garbage Collector settings
  71. * Used if lvgl is binded to higher level language and the memory is managed by that language */
  72. #define LV_ENABLE_GC 0
  73. #if LV_ENABLE_GC != 0
  74. # define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
  75. # define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
  76. # define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
  77. #endif /* LV_ENABLE_GC */
  78. /*=======================
  79. Input device settings
  80. *=======================*/
  81. /* Input device default settings.
  82. * Can be changed in the Input device driver (`lv_indev_drv_t`)*/
  83. /* Input device read period in milliseconds */
  84. #define LV_INDEV_DEF_READ_PERIOD 30
  85. /* Drag threshold in pixels */
  86. #define LV_INDEV_DEF_DRAG_LIMIT 10
  87. /* Drag throw slow-down in [%]. Greater value -> faster slow-down */
  88. #define LV_INDEV_DEF_DRAG_THROW 20
  89. /* Long press time in milliseconds.
  90. * Time to send `LV_EVENT_LONG_PRESSSED`) */
  91. #define LV_INDEV_DEF_LONG_PRESS_TIME 400
  92. /* Repeated trigger period in long press [ms]
  93. * Time between `LV_EVENT_LONG_PRESSED_REPEAT */
  94. #define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
  95. /*==================
  96. * Feature usage
  97. *==================*/
  98. /*1: Enable the Animations */
  99. #define LV_USE_ANIMATION 1
  100. #if LV_USE_ANIMATION
  101. /*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
  102. typedef void * lv_anim_user_data_t;
  103. #endif
  104. /* 1: Enable shadow drawing*/
  105. #define LV_USE_SHADOW 1
  106. /* 1: Enable object groups (for keyboard/encoder navigation) */
  107. #define LV_USE_GROUP 1
  108. #if LV_USE_GROUP
  109. typedef void * lv_group_user_data_t;
  110. #endif /*LV_USE_GROUP*/
  111. /* 1: Enable GPU interface*/
  112. #define LV_USE_GPU 1
  113. /* 1: Enable file system (might be required for images */
  114. #define LV_USE_FILESYSTEM 1
  115. #if LV_USE_FILESYSTEM
  116. /*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
  117. typedef void * lv_fs_drv_user_data_t;
  118. #endif
  119. /*1: Add a `user_data` to drivers and objects*/
  120. #define LV_USE_USER_DATA 1
  121. /*========================
  122. * Image decoder and cache
  123. *========================*/
  124. /* 1: Enable indexed (palette) images */
  125. #define LV_IMG_CF_INDEXED 1
  126. /* 1: Enable alpha indexed images */
  127. #define LV_IMG_CF_ALPHA 1
  128. /* Default image cache size. Image caching keeps the images opened.
  129. * If only the built-in image formats are used there is no real advantage of caching.
  130. * (I.e. no new image decoder is added)
  131. * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
  132. * However the opened images might consume additional RAM.
  133. * LV_IMG_CACHE_DEF_SIZE must be >= 1 */
  134. #define LV_IMG_CACHE_DEF_SIZE 1
  135. /*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
  136. typedef void * lv_img_decoder_user_data_t;
  137. /*=====================
  138. * Compiler settings
  139. *====================*/
  140. /* Define a custom attribute to `lv_tick_inc` function */
  141. #define LV_ATTRIBUTE_TICK_INC
  142. /* Define a custom attribute to `lv_task_handler` function */
  143. #define LV_ATTRIBUTE_TASK_HANDLER
  144. /* With size optimization (-Os) the compiler might not align data to
  145. * 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
  146. * E.g. __attribute__((aligned(4))) */
  147. #define LV_ATTRIBUTE_MEM_ALIGN
  148. /* Attribute to mark large constant arrays for example
  149. * font's bitmaps */
  150. #define LV_ATTRIBUTE_LARGE_CONST
  151. /*===================
  152. * HAL settings
  153. *==================*/
  154. /* 1: use a custom tick source.
  155. * It removes the need to manually update the tick with `lv_tick_inc`) */
  156. #define LV_TICK_CUSTOM 1
  157. #if LV_TICK_CUSTOM == 1
  158. #define LV_TICK_CUSTOM_INCLUDE "system_header.h" /*Header for the sys time function*/
  159. #define LV_TICK_CUSTOM_SYS_TIME_EXPR (time_get_ms()) /*Expression evaluating to current systime in ms*/
  160. #endif /*LV_TICK_CUSTOM*/
  161. typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
  162. typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
  163. /*================
  164. * Log settings
  165. *===============*/
  166. /*1: Enable the log module*/
  167. #define LV_USE_LOG 1
  168. #if LV_USE_LOG
  169. /* How important log should be added:
  170. * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
  171. * LV_LOG_LEVEL_INFO Log important events
  172. * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
  173. * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
  174. * LV_LOG_LEVEL_NONE Do not log anything
  175. */
  176. # define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
  177. /* 1: Print the log with 'printf';
  178. * 0: user need to register a callback with `lv_log_register_print`*/
  179. # define LV_LOG_PRINTF 1
  180. #endif /*LV_USE_LOG*/
  181. /*================
  182. * THEME USAGE
  183. *================*/
  184. #define LV_THEME_LIVE_UPDATE 1 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
  185. #define LV_USE_THEME_TEMPL 1 /*Just for test*/
  186. #define LV_USE_THEME_DEFAULT 1 /*Built mainly from the built-in styles. Consumes very few RAM*/
  187. #define LV_USE_THEME_ALIEN 1 /*Dark futuristic theme*/
  188. #define LV_USE_THEME_NIGHT 1 /*Dark elegant theme*/
  189. #define LV_USE_THEME_MONO 1 /*Mono color theme for monochrome displays*/
  190. #define LV_USE_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/
  191. #define LV_USE_THEME_ZEN 1 /*Peaceful, mainly light theme */
  192. #define LV_USE_THEME_NEMO 1 /*Water-like theme based on the movie "Finding Nemo"*/
  193. /*==================
  194. * FONT USAGE
  195. *===================*/
  196. /* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
  197. * The symbols are available via `LV_SYMBOL_...` defines
  198. * More info about fonts: https://docs.littlevgl.com/#Fonts
  199. * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
  200. */
  201. /* Robot fonts with bpp = 4
  202. * https://fonts.google.com/specimen/Roboto */
  203. #define LV_FONT_ROBOTO_12 1
  204. #define LV_FONT_ROBOTO_16 1
  205. #define LV_FONT_ROBOTO_22 1
  206. #define LV_FONT_ROBOTO_28 1
  207. /*Pixel perfect monospace font
  208. * http://pelulamu.net/unscii/ */
  209. #define LV_FONT_UNSCII_8 1
  210. /* Optionally declare your custom fonts here.
  211. * You can use these fonts as default font too
  212. * and they will be available globally. E.g.
  213. * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
  214. * LV_FONT_DECLARE(my_font_2)
  215. */
  216. #define LV_FONT_CUSTOM_DECLARE
  217. /*Always set a default font from the built-in fonts*/
  218. #define LV_FONT_DEFAULT &lv_font_roboto_16
  219. /* Enable it if you have fonts with a lot of characters.
  220. * The limit depends on the font size, font face and bpp
  221. * but with > 10,000 characters if you see issues probably you need to enable it.*/
  222. #define LV_FONT_FMT_TXT_LARGE 1
  223. /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
  224. typedef void * lv_font_user_data_t;
  225. /*=================
  226. * Text settings
  227. *=================*/
  228. /* Select a character encoding for strings.
  229. * Your IDE or editor should have the same character encoding
  230. * - LV_TXT_ENC_UTF8
  231. * - LV_TXT_ENC_ASCII
  232. * */
  233. #define LV_TXT_ENC LV_TXT_ENC_UTF8
  234. /*Can break (wrap) texts on these chars*/
  235. #define LV_TXT_BREAK_CHARS " ,.;:-_"
  236. /*===================
  237. * LV_OBJ SETTINGS
  238. *==================*/
  239. /*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
  240. typedef void * lv_obj_user_data_t;
  241. /*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
  242. #define LV_USE_OBJ_REALIGN 1
  243. /* Enable to make the object clickable on a larger area.
  244. * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
  245. * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
  246. * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
  247. */
  248. #define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL
  249. /*==================
  250. * LV OBJ X USAGE
  251. *================*/
  252. /*
  253. * Documentation of the object types: https://docs.littlevgl.com/#Object-types
  254. */
  255. /*Arc (dependencies: -)*/
  256. #define LV_USE_ARC 1
  257. /*Bar (dependencies: -)*/
  258. #define LV_USE_BAR 1
  259. /*Button (dependencies: lv_cont*/
  260. #define LV_USE_BTN 1
  261. #if LV_USE_BTN != 0
  262. /*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
  263. # define LV_BTN_INK_EFFECT 1
  264. #endif
  265. /*Button matrix (dependencies: -)*/
  266. #define LV_USE_BTNM 1
  267. /*Calendar (dependencies: -)*/
  268. #define LV_USE_CALENDAR 1
  269. /*Canvas (dependencies: lv_img)*/
  270. #define LV_USE_CANVAS 1
  271. /*Check box (dependencies: lv_btn, lv_label)*/
  272. #define LV_USE_CB 1
  273. /*Chart (dependencies: -)*/
  274. #define LV_USE_CHART 1
  275. #if LV_USE_CHART
  276. # define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
  277. #endif
  278. /*Container (dependencies: -*/
  279. #define LV_USE_CONT 1
  280. /*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
  281. #define LV_USE_DDLIST 1
  282. #if LV_USE_DDLIST != 0
  283. /*Open and close default animation time [ms] (0: no animation)*/
  284. # define LV_DDLIST_DEF_ANIM_TIME 200
  285. #endif
  286. /*Gauge (dependencies:lv_bar, lv_lmeter)*/
  287. #define LV_USE_GAUGE 1
  288. /*Image (dependencies: lv_label*/
  289. #define LV_USE_IMG 1
  290. /*Image Button (dependencies: lv_btn*/
  291. #define LV_USE_IMGBTN 1
  292. #if LV_USE_IMGBTN
  293. /*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
  294. # define LV_IMGBTN_TILED 0
  295. #endif
  296. /*Keyboard (dependencies: lv_btnm)*/
  297. #define LV_USE_KB 1
  298. /*Label (dependencies: -*/
  299. #define LV_USE_LABEL 1
  300. #if LV_USE_LABEL != 0
  301. /*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
  302. # define LV_LABEL_DEF_SCROLL_SPEED 25
  303. /* Waiting period at beginning/end of animation cycle */
  304. # define LV_LABEL_WAIT_CHAR_COUNT 3
  305. /*Enable selecting text of the label */
  306. # define LV_LABEL_TEXT_SEL 1
  307. /*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
  308. # define LV_LABEL_LONG_TXT_HINT 0
  309. #endif
  310. /*LED (dependencies: -)*/
  311. #define LV_USE_LED 1
  312. /*Line (dependencies: -*/
  313. #define LV_USE_LINE 1
  314. /*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
  315. #define LV_USE_LIST 1
  316. #if LV_USE_LIST != 0
  317. /*Default animation time of focusing to a list element [ms] (0: no animation) */
  318. # define LV_LIST_DEF_ANIM_TIME 100
  319. #endif
  320. /*Line meter (dependencies: *;)*/
  321. #define LV_USE_LMETER 1
  322. /*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
  323. #define LV_USE_MBOX 1
  324. /*Page (dependencies: lv_cont)*/
  325. #define LV_USE_PAGE 1
  326. #if LV_USE_PAGE != 0
  327. /*Focus default animation time [ms] (0: no animation)*/
  328. # define LV_PAGE_DEF_ANIM_TIME 400
  329. #endif
  330. /*Preload (dependencies: lv_arc, lv_anim)*/
  331. #define LV_USE_PRELOAD 1
  332. #if LV_USE_PRELOAD != 0
  333. # define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
  334. # define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
  335. # define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
  336. #endif
  337. /*Roller (dependencies: lv_ddlist)*/
  338. #define LV_USE_ROLLER 1
  339. #if LV_USE_ROLLER != 0
  340. /*Focus animation time [ms] (0: no animation)*/
  341. # define LV_ROLLER_DEF_ANIM_TIME 200
  342. /*Number of extra "pages" when the roller is infinite*/
  343. # define LV_ROLLER_INF_PAGES 7
  344. #endif
  345. /*Slider (dependencies: lv_bar)*/
  346. #define LV_USE_SLIDER 1
  347. /*Spinbox (dependencies: lv_ta)*/
  348. #define LV_USE_SPINBOX 1
  349. /*Switch (dependencies: lv_slider)*/
  350. #define LV_USE_SW 1
  351. /*Text area (dependencies: lv_label, lv_page)*/
  352. #define LV_USE_TA 1
  353. #if LV_USE_TA != 0
  354. # define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
  355. # define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/
  356. #endif
  357. /*Table (dependencies: lv_label)*/
  358. #define LV_USE_TABLE 1
  359. #if LV_USE_TABLE
  360. # define LV_TABLE_COL_MAX 12
  361. #endif
  362. /*Tab (dependencies: lv_page, lv_btnm)*/
  363. #define LV_USE_TABVIEW 1
  364. # if LV_USE_TABVIEW != 0
  365. /*Time of slide animation [ms] (0: no animation)*/
  366. # define LV_TABVIEW_DEF_ANIM_TIME 300
  367. #endif
  368. /*Tileview (dependencies: lv_page) */
  369. #define LV_USE_TILEVIEW 1
  370. #if LV_USE_TILEVIEW
  371. /*Time of slide animation [ms] (0: no animation)*/
  372. # define LV_TILEVIEW_DEF_ANIM_TIME 300
  373. #endif
  374. /*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
  375. #define LV_USE_WIN 1
  376. /*==================
  377. * Non-user section
  378. *==================*/
  379. #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
  380. # define _CRT_SECURE_NO_WARNINGS
  381. #endif
  382. /*--END OF LV_CONF_H--*/
  383. /*Be sure every define has a default value*/
  384. #include "lvgl/src/lv_conf_checker.h"
  385. #endif /*LV_CONF_H*/
  386. #endif /*End of "Content enable"*/