Skip to content

Commit

Permalink
Adapt for the updated LVGL submodules.
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jan 14, 2024
1 parent 1d32a9a commit a6b8d06
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 3,062 deletions.
935 changes: 54 additions & 881 deletions LvglWindowsDesktopApplication/LvglWindowsDesktopApplication.cpp

Large diffs are not rendered by default.

107 changes: 74 additions & 33 deletions LvglWindowsDesktopApplication/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (256 * 1024U) /*[bytes]*/
#define LV_MEM_SIZE (64 * 1024U) /*[bytes]*/

/*Size of the memory expand for `lv_malloc()` in bytes*/
#define LV_MEM_POOL_EXPAND_SIZE 0
Expand All @@ -67,6 +67,23 @@
*(Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI_DEF 130 /*[px/inch]*/

/*=================
* OPERATING SYSTEM
*=================*/
/*Select an operating system to use. Possible options:
* - LV_OS_NONE
* - LV_OS_PTHREAD
* - LV_OS_FREERTOS
* - LV_OS_CMSIS_RTOS2
* - LV_OS_RTTHREAD
* - LV_OS_WINDOWS
* - LV_OS_CUSTOM */
#define LV_USE_OS LV_OS_WINDOWS

#if LV_USE_OS == LV_OS_CUSTOM
#define LV_OS_CUSTOM_INCLUDE <stdint.h>
#endif

/*========================
* RENDERING CONFIGURATION
*========================*/
Expand Down Expand Up @@ -116,12 +133,33 @@
#endif
#endif

/* Use Arm-2D on Cortex-M based devices. Please only enable it for Helium Powered devices for now */
#define LV_USE_DRAW_ARM2D 0

/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#define LV_USE_DRAW_VGLITE 0

#if LV_USE_DRAW_VGLITE
/* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */
#define LV_USE_VGLITE_BLIT_SPLIT 0

#if LV_USE_OS
/* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */
#define LV_USE_VGLITE_DRAW_ASYNC 1
#endif

/* Enable VGLite asserts. */
#define LV_USE_VGLITE_ASSERT 0
#endif

/* Use NXP's PXP on iMX RTxxx platforms. */
#define LV_USE_DRAW_PXP 0

#if LV_USE_DRAW_PXP
/* Enable PXP asserts. */
#define LV_USE_PXP_ASSERT 0
#endif

/* Use Renesas Dave2D on RA platforms. */
#define LV_USE_DRAW_DAVE2D 0

Expand All @@ -132,28 +170,12 @@
#define LV_USE_DRAW_VG_LITE 0

#if LV_USE_DRAW_VG_LITE
/* Enbale VG-Lite custom external 'gpu_init()' function */
/* Enable VG-Lite custom external 'gpu_init()' function */
#define LV_VG_LITE_USE_GPU_INIT 0

/* Enable VG-Lite assert. */
#define LV_VG_LITE_USE_ASSERT 0
#endif

/*=================
* OPERATING SYSTEM
*=================*/
/*Select an operating system to use. Possible options:
* - LV_OS_NONE
* - LV_OS_PTHREAD
* - LV_OS_FREERTOS
* - LV_OS_CMSIS_RTOS2
* - LV_OS_RTTHREAD
* - LV_OS_WINDOWS
* - LV_OS_CUSTOM */
#define LV_USE_OS LV_OS_WINDOWS

#if LV_USE_OS == LV_OS_CUSTOM
#define LV_OS_CUSTOM_INCLUDE <stdint.h>
#endif

/*=======================
Expand Down Expand Up @@ -259,10 +281,6 @@
* Others
*-----------*/

/*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/
#define LV_DISPLAY_ROT_MAX_BUF (10*1024)

#define LV_ENABLE_GLOBAL_CUSTOM 0
#if LV_ENABLE_GLOBAL_CUSTOM
/*Header to include for the custom 'lv_global' function"*/
Expand All @@ -271,8 +289,8 @@

/*Default cache size in bytes.
*Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory.
*Data larger than the size of the cache also can be allocated but
*will be dropped immediately after usage.*/
*If size is not set to 0, the decoder will fail to decode when the cache is full.
*If size is 0, the cache function is not enabled and the decoded mem will be released immediately after use.*/
#define LV_CACHE_DEF_SIZE 0

/*Number of stops allowed per gradient. Increase this to allow more stops.
Expand All @@ -295,6 +313,26 @@
/*Use obj property set/get API*/
#define LV_USE_OBJ_PROPERTY 0

/* VG-Lite Simulator */
/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
#define LV_USE_VG_LITE_THORVG 0

#if LV_USE_VG_LITE_THORVG

/*Enable LVGL's blend mode support*/
#define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0

/*Enable YUV color format support*/
#define LV_VG_LITE_THORVG_YUV_SUPPORT 0

/*Enable 16 pixels alignment*/
#define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1

/*Enable multi-thread render*/
#define LV_VG_LITE_THORVG_THREAD_RENDER 0

#endif

/*=====================
* COMPILER SETTINGS
*====================*/
Expand Down Expand Up @@ -497,8 +535,6 @@

#define LV_USE_MENU 1

#define LV_USE_METER 1

#define LV_USE_MSGBOX 1

#define LV_USE_ROLLER 1 /*Requires: lv_label*/
Expand Down Expand Up @@ -655,17 +691,11 @@
/*Let FreeType to use LVGL memory and file porting*/
#define LV_FREETYPE_USE_LVGL_PORT 0

/*FreeType cache type:
* LV_FREETYPE_CACHE_TYPE_IMAGE - Image cache
* LV_FREETYPE_CACHE_TYPE_SBIT - Sbit cache
* LV_FREETYPE_CACHE_TYPE_OUTLINE - Outline cache*/
#define LV_FREETYPE_CACHE_TYPE LV_FREETYPE_CACHE_TYPE_IMAGE

/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
/* (0:use system defaults) */
#define LV_FREETYPE_CACHE_FT_FACES 8
#define LV_FREETYPE_CACHE_FT_SIZES 8
#define LV_FREETYPE_CACHE_FT_OUTLINES 256
#define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256
#endif

/* Built-in TTF decoder */
Expand Down Expand Up @@ -855,6 +885,17 @@
/*Driver for evdev input devices*/
#define LV_USE_EVDEV 0

/*Drivers for LCD devices connected via SPI/parallel port*/
#define LV_USE_ST7735 0
#define LV_USE_ST7789 0
#define LV_USE_ST7796 0
#define LV_USE_ILI9341 0

#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341)

/* LVGL Windows backend */
#define LV_USE_WINDOWS 1

/*==================
* EXAMPLES
*==================*/
Expand Down
43 changes: 8 additions & 35 deletions LvglWindowsSimulator/LvglWindowsSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,19 @@

#include <LvglWindowsIconResource.h>

#if _MSC_VER >= 1200
// Disable compilation warnings.
#pragma warning(push)
// nonstandard extension used : bit field types other than int
#pragma warning(disable:4214)
// 'conversion' conversion from 'type1' to 'type2', possible loss of data
#pragma warning(disable:4244)
#endif

#include "lvgl/lvgl.h"
#include "lvgl/examples/lv_examples.h"
#include "lvgl/demos/lv_demos.h"

#include "lv_windows_context.h"
#include "lv_windows_input.h"
#include "lv_windows_display.h"

#if _MSC_VER >= 1200
// Restore compilation warnings.
#pragma warning(pop)
#endif

uint32_t tick_count_callback()
{
return GetTickCount();
}

int main()
{
lv_init();

lv_tick_set_cb(tick_count_callback);

lv_windows_platform_init();

int32_t zoom_level = 100;
bool allow_dpi_override = false;
bool simulator_mode = false;
bool simulator_mode = true;
lv_display_t* display = lv_windows_create_display(
L"LVGL Simulator for Windows Desktop (Display 1)",
L"LVGL Windows Simulator Display 1",
800,
480,
zoom_level,
Expand Down Expand Up @@ -85,20 +58,20 @@ int main()
(LPARAM)icon_handle);
}

lv_indev_t* pointer_device = lv_windows_acquire_pointer_device(display);
if (!pointer_device)
lv_indev_t* pointer_indev = lv_windows_acquire_pointer_indev(display);
if (!pointer_indev)
{
return -1;
}

lv_indev_t* keypad_device = lv_windows_acquire_keypad_device(display);
if (!keypad_device)
lv_indev_t* keypad_indev = lv_windows_acquire_keypad_indev(display);
if (!keypad_indev)
{
return -1;
}

lv_indev_t* encoder_device = lv_windows_acquire_encoder_device(display);
if (!encoder_device)
lv_indev_t* encoder_indev = lv_windows_acquire_encoder_indev(display);
if (!encoder_indev)
{
return -1;
}
Expand Down
6 changes: 0 additions & 6 deletions LvglWindowsSimulator/LvglWindowsSimulator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\LvglPlatform\lvgl\src\widgets\tileview\lv_tileview.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\LvglPlatform\lvgl\src\widgets\win\lv_win.h" />
<ClInclude Include="lv_conf.h" />
<ClInclude Include="lv_windows_context.h" />
<ClInclude Include="lv_windows_display.h" />
<ClInclude Include="lv_windows_input.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="LvglWindowsSimulator.manifest" />
Expand Down Expand Up @@ -976,9 +973,6 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\LvglPlatform\lvgl\src\widgets\tileview\lv_tileview.c" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\LvglPlatform\lvgl\src\widgets\win\lv_win.c" />
<ClCompile Include="LvglWindowsSimulator.cpp" />
<ClCompile Include="lv_windows_context.c" />
<ClCompile Include="lv_windows_display.c" />
<ClCompile Include="lv_windows_input.c" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\LvglPlatform\freetype\.clang-format" />
Expand Down
6 changes: 0 additions & 6 deletions LvglWindowsSimulator/LvglWindowsSimulator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,6 @@
<Filter>lvgl\src\widgets\win</Filter>
</ClInclude>
<ClInclude Include="lv_conf.h" />
<ClInclude Include="lv_windows_context.h" />
<ClInclude Include="lv_windows_input.h" />
<ClInclude Include="lv_windows_display.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="LvglWindowsSimulator.manifest" />
Expand Down Expand Up @@ -2792,9 +2789,6 @@
<Filter>lvgl\src\widgets\win</Filter>
</ClCompile>
<ClCompile Include="LvglWindowsSimulator.cpp" />
<ClCompile Include="lv_windows_context.c" />
<ClCompile Include="lv_windows_input.c" />
<ClCompile Include="lv_windows_display.c" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\LvglPlatform\freetype\.clang-format">
Expand Down
Loading

0 comments on commit a6b8d06

Please sign in to comment.