Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "lvgl"]
path = lvgl
url = https://github.com/lvgl/lvgl.git
[submodule "micropython/pycparser"]
path = pycparser
url = https://github.com/eliben/pycparser.git
57 changes: 29 additions & 28 deletions lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
*-----------*/
/* PRIVATE API */

#define LV_USE_PRIVATE_API 1
#define LV_USE_PRIVATE_API 0

/*Garbage Collector settings
*Used if LVGL is bound to higher level language and the memory is managed by that language*/
Expand Down Expand Up @@ -424,10 +424,10 @@ extern void mp_lv_deinit_gc();
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 1
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_20 1
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 1
#define LV_FONT_MONTSERRAT_26 0
Expand All @@ -442,6 +442,7 @@ extern void mp_lv_deinit_gc();
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
#define LV_FONT_SIYUAN_HEITI_MEDIUM_24 1

/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
Expand All @@ -458,7 +459,7 @@ extern void mp_lv_deinit_gc();
#define LV_FONT_CUSTOM_DECLARE

/*Always set a default font*/
#define LV_FONT_DEFAULT &lv_font_montserrat_14
#define LV_FONT_DEFAULT &lv_font_montserrat_16

/*Enable handling large font and/or fonts with a lot of characters.
*The limit depends on the font size, font face and bpp.
Expand Down Expand Up @@ -522,17 +523,17 @@ extern void mp_lv_deinit_gc();

#define LV_WIDGETS_HAS_DEFAULT_VALUE 0

#define LV_USE_ANIMIMG 1
#define LV_USE_ANIMIMG 0

#define LV_USE_ARC 1
#define LV_USE_ARC 0

#define LV_USE_BAR 1

#define LV_USE_BUTTON 1

#define LV_USE_BUTTONMATRIX 1
#define LV_USE_BUTTONMATRIX 0

#define LV_USE_CALENDAR 1
#define LV_USE_CALENDAR 0
#if LV_USE_CALENDAR
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#if LV_CALENDAR_WEEK_STARTS_MONDAY
Expand All @@ -546,19 +547,19 @@ extern void mp_lv_deinit_gc();
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#endif /*LV_USE_CALENDAR*/

#define LV_USE_CANVAS 1
#define LV_USE_CANVAS 0

#define LV_USE_CHART 1

#define LV_USE_CHECKBOX 1
#define LV_USE_CHECKBOX 0

#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
#define LV_USE_DROPDOWN 0 /*Requires: lv_label*/

#define LV_USE_IMAGE 1 /*Requires: lv_label*/

#define LV_USE_IMAGEBUTTON 1

#define LV_USE_KEYBOARD 1
#define LV_USE_KEYBOARD 0

#define LV_USE_LABEL 1
#if LV_USE_LABEL
Expand All @@ -567,33 +568,33 @@ extern void mp_lv_deinit_gc();
#define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/
#endif

#define LV_USE_LED 1
#define LV_USE_LED 0

#define LV_USE_LINE 1

#define LV_USE_LIST 1
#define LV_USE_LIST 0

#define LV_USE_MENU 1
#define LV_USE_MENU 0

#define LV_USE_MSGBOX 1
#define LV_USE_MSGBOX 0

#define LV_USE_ROLLER 1 /*Requires: lv_label*/
#define LV_USE_ROLLER 0 /*Requires: lv_label*/

#define LV_USE_SCALE 1

#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
#define LV_USE_SLIDER 0 /*Requires: lv_bar*/

#define LV_USE_SPAN 1
#define LV_USE_SPAN 0
#if LV_USE_SPAN
/*A line text can contain maximum num of span descriptor */
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif

#define LV_USE_SPINBOX 1
#define LV_USE_SPINBOX 0

#define LV_USE_SPINNER 1
#define LV_USE_SPINNER 0

#define LV_USE_SWITCH 1
#define LV_USE_SWITCH 0

#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/
#if LV_USE_TEXTAREA != 0
Expand All @@ -602,11 +603,11 @@ extern void mp_lv_deinit_gc();

#define LV_USE_TABLE 1

#define LV_USE_TABVIEW 1
#define LV_USE_TABVIEW 0

#define LV_USE_TILEVIEW 1
#define LV_USE_TILEVIEW 0

#define LV_USE_WIN 1
#define LV_USE_WIN 0

/*==================
* THEMES
Expand Down Expand Up @@ -728,10 +729,10 @@ extern void mp_lv_deinit_gc();
#define LV_USE_RLE 0

/*QR code library*/
#define LV_USE_QRCODE 1
#define LV_USE_QRCODE 0

/*Barcode code library*/
#define LV_USE_BARCODE 1
#define LV_USE_BARCODE 0

/*FreeType library*/
#ifdef MICROPY_FREETYPE
Expand Down Expand Up @@ -862,7 +863,7 @@ extern void mp_lv_deinit_gc();
#define LV_USE_FRAGMENT 0

/*1: Support using images as font in label or span widgets */
#define LV_USE_IMGFONT 1
#define LV_USE_IMGFONT 0

/*1: Enable an observer pattern implementation*/
#define LV_USE_OBSERVER 1
Expand Down
1 change: 0 additions & 1 deletion lvgl
Submodule lvgl deleted from 773860
27 changes: 27 additions & 0 deletions lvgl/.devcontainer/__CMakeLists.txt__
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.12)
project (lv_emscripten)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -s USE_SDL=2")

include_directories(${PROJECT_SOURCE_DIR})

add_subdirectory(lvgl)
file(GLOB MY_SOURCES "./*.c")
set(SOURCES ${MY_SOURCES})

add_executable(index ${SOURCES} ${INCLUDES})

if(NOT LVGL_CHOSEN_DEMO)
set(LVGL_CHOSEN_DEMO lv_demo_widgets)
endif()
set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS -DCHOSEN_DEMO=${LVGL_CHOSEN_DEMO})

set(CMAKE_EXECUTABLE_SUFFIX ".html")
target_link_libraries(index
lvgl
lvgl_examples
lvgl_demos
lvgl_thorvg
SDL2
)
set_target_properties(index PROPERTIES LINK_FLAGS "--shell-file ${PROJECT_SOURCE_DIR}/lvgl/.devcontainer/lvgl_shell.html -s SINGLE_FILE=1")
5 changes: 5 additions & 0 deletions lvgl/.devcontainer/__build_all.sh__
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd build
emcmake cmake ..
emmake make -j$(nproc)
echo "Built succesfully, opening index.html"
code index.html
17 changes: 17 additions & 0 deletions lvgl/.devcontainer/__c_cpp_properties.json__
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/emsdk/upstream/emscripten/cache/sysroot/include/"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
107 changes: 107 additions & 0 deletions lvgl/.devcontainer/__main.c__
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@

/**
* @file main
*
*/

/*********************
* INCLUDES
*********************/
#include <stdlib.h>
#include <unistd.h>
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
#include <SDL2/SDL.h>
#include <emscripten.h>
#include "lvgl/lvgl.h"
#include "lvgl/demos/lv_demos.h"
#include "lvgl/examples/lv_examples.h"

/*********************
* DEFINES
*********************/

/*On OSX SDL needs different handling*/
#if defined(__APPLE__) && defined(TARGET_OS_MAC)
# if __APPLE__ && TARGET_OS_MAC
#define SDL_APPLE
# endif
#endif

/**********************
* TYPEDEFS
**********************/

/**********************
* STATIC PROTOTYPES
**********************/
static void hal_init(void);
static int tick_thread(void * data);
static void memory_monitor(lv_timer_t * param);

/**********************
* STATIC VARIABLES
**********************/
static lv_display_t * disp1;

int monitor_hor_res, monitor_ver_res;

/**********************
* MACROS
**********************/

/**********************
* GLOBAL FUNCTIONS
**********************/
void do_loop(void *arg);

/* Allows disabling CHOSEN_DEMO */
static void lv_example_noop(void) {
}

int main(int argc, char ** argv)
{

monitor_hor_res = 800;
monitor_ver_res = 480;
printf("Starting with screen resolution of %dx%d px\n", monitor_hor_res, monitor_ver_res);

/*Initialize LittlevGL*/
lv_init();

/*Initialize the HAL (display, input devices, tick) for LittlevGL*/
hal_init();

lv_demo_widgets();

emscripten_set_main_loop_arg(do_loop, NULL, -1, true);
}

void do_loop(void *arg)
{
/* Periodically call the lv_timer handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_timer_handler();
}

/**********************
* STATIC FUNCTIONS
**********************/


/**
* Initialize the Hardware Abstraction Layer (HAL) for the Littlev graphics library
*/
static void hal_init(void)
{
lv_display_t * disp = lv_sdl_window_create(monitor_hor_res, monitor_ver_res);

lv_group_t * g = lv_group_create();
lv_group_set_default(g);

lv_sdl_mouse_create();
lv_indev_t * mousewheel = lv_sdl_mousewheel_create();
lv_indev_set_group(mousewheel, lv_group_get_default());

lv_indev_t * keyboard = lv_sdl_keyboard_create();
lv_indev_set_group(keyboard, lv_group_get_default());
}
5 changes: 5 additions & 0 deletions lvgl/.devcontainer/__settings.json__
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"sdl.h": "c"
}
}
28 changes: 28 additions & 0 deletions lvgl/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/ebaskoro/devcontainer-features/emscripten:1": {}
},
"postCreateCommand": "chmod +x /workspace/lvgl_app/lvgl/.devcontainer/setup.sh; /workspace/lvgl_app/lvgl/.devcontainer/setup.sh",
"postStartCommand": ". /usr/local/emsdk/emsdk_env.sh;",

// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
//"searKing.preview-vscode"
"analytic-signal.preview-html"
]
}
},

"hostRequirements": {
"cpus": 4
},

"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/lvgl_app/lvgl,type=bind",
"workspaceFolder": "/workspace/lvgl_app"

}
Loading
Loading