commit
396b68a92c
8
.gitignore
vendored
8
.gitignore
vendored
@ -20,6 +20,14 @@
|
||||
######################
|
||||
*.swp
|
||||
|
||||
# VIM Session Files
|
||||
######################
|
||||
Session.vim
|
||||
|
||||
# CTags files
|
||||
######################
|
||||
tags
|
||||
|
||||
# Build directory
|
||||
######################
|
||||
build/
|
||||
|
||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -18,6 +18,6 @@
|
||||
[submodule "lib/nrfx"]
|
||||
path = lib/nrfx
|
||||
url = https://github.com/NordicSemiconductor/nrfx.git
|
||||
[submodule "lib/lvgl"]
|
||||
path = lib/lvgl
|
||||
url = https://github.com/amirgon/lvgl.git
|
||||
[submodule "lib/lv_bindings"]
|
||||
path = lib/lv_bindings
|
||||
url = https://github.com/amirgon/lv_bindings.git
|
||||
|
||||
1
lib/lv_bindings
Submodule
1
lib/lv_bindings
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 57a64a07db60b5cf2caadbec30592307d4c454c0
|
||||
137
lib/lv_conf.h
137
lib/lv_conf.h
@ -14,17 +14,27 @@
|
||||
|
||||
/* Memory size which will be used by the library
|
||||
* to store the graphical objects and other data */
|
||||
#define LV_MEM_CUSTOM 0 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/
|
||||
#define LV_MEM_CUSTOM 1 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
#define LV_MEM_SIZE (64U * 1024U) /*Size memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_ATTR /*Complier prefix for big array declaration*/
|
||||
#define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
||||
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <lv_mp_mem_custom_include.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC m_malloc /*Wrapper to malloc*/
|
||||
#define LV_MEM_CUSTOM_FREE m_free /*Wrapper to free*/
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/* Enable GC for Micropython */
|
||||
#define LV_ENABLE_GC 1
|
||||
#if LV_ENABLE_GC == 1
|
||||
long unsigned int gc_nbytes(const void *ptr);
|
||||
# define LV_MEM_CUSTOM_REALLOC m_realloc /*Wrapper to realloc*/
|
||||
# define LV_MEM_CUSTOM_GET_SIZE gc_nbytes /*Wrapper to lv_mem_get_size*/
|
||||
# define LV_GC_INCLUDE "py/mpstate.h"
|
||||
# define LV_GC_ROOT(x) MP_STATE_PORT(x)
|
||||
#endif /* LV_ENABLE_GC */
|
||||
|
||||
/*===================
|
||||
Graphical settings
|
||||
*===================*/
|
||||
@ -32,27 +42,59 @@
|
||||
/* Horizontal and vertical resolution of the library.*/
|
||||
#define LV_HOR_RES (440)
|
||||
#define LV_VER_RES (340)
|
||||
|
||||
/* Dot Per Inch: used to initialize default sizes. E.g. a button with width = LV_DPI / 2 -> half inch wide
|
||||
* (Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI 100
|
||||
|
||||
/* Size of VDB (Virtual Display Buffer: the internal graphics buffer).
|
||||
* Required for buffered drawing, opacity and anti-aliasing
|
||||
* VDB makes the double buffering, you don't need to deal with it!
|
||||
* Typical size: ~1/10 screen */
|
||||
#define LV_VDB_SIZE (80 * LV_HOR_RES) /*Size of VDB in pixel count (1/10 screen size is good for first)*/
|
||||
#define LV_VDB_PX_BPP LV_COLOR_SIZE /*Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays. (Special formats are handled with `disp_drv->vdb_wr`)*/
|
||||
#define LV_VDB_ADR 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate automatically into RAM; LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`)*/
|
||||
|
||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
||||
* The flushing should use DMA to write the frame buffer in the background*/
|
||||
#define LV_VDB_DOUBLE 0 /*1: Enable the use of 2 VDBs*/
|
||||
#define LV_VDB2_ADR 0 /*Place VDB2 to a specific address (e.g. in external RAM) (0: allocate automatically into RAM; LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`)*/
|
||||
|
||||
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
|
||||
#define LV_ANTIALIAS 1 /*1: Enable anti-aliasing*/
|
||||
|
||||
/*Screen refresh settings*/
|
||||
#define LV_REFR_PERIOD 30 /*Screen refresh period in milliseconds*/
|
||||
#define LV_INV_FIFO_SIZE 32 /*The average count of objects on a screen */
|
||||
/*Screen refresh period in milliseconds*/
|
||||
#define LV_REFR_PERIOD 30
|
||||
|
||||
/*-----------------
|
||||
* VDB settings
|
||||
*----------------*/
|
||||
|
||||
/* VDB (Virtual Display Buffer) is an internal graphics buffer.
|
||||
* To images will be drawn into this buffer first and then
|
||||
* the buffer will be passed to your `disp_drv.disp_flush` function to
|
||||
* copy it to your frame buffer.
|
||||
* VDB is required for: buffered drawing, opacity, anti-aliasing and shadows
|
||||
* Learn more: https://docs.littlevgl.com/#Drawing*/
|
||||
|
||||
/* Size of the VDB in pixels. Typical size: ~1/10 screen. Must be >= LV_HOR_RES
|
||||
* Setting it to 0 will disable VDB and `disp_drv.disp_fill` and `disp_drv.disp_map` functions
|
||||
* will be called to draw to the frame buffer directly*/
|
||||
#define LV_VDB_SIZE ((LV_VER_RES * LV_HOR_RES) / 10)
|
||||
|
||||
/* Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays.
|
||||
* Special formats are handled with `disp_drv.vdb_wr`)*/
|
||||
#define LV_VDB_PX_BPP LV_COLOR_SIZE /*LV_COLOR_SIZE comes from LV_COLOR_DEPTH below to set 8, 16 or 32 bit pixel size automatically */
|
||||
|
||||
/* Place VDB to a specific address (e.g. in external RAM)
|
||||
* 0: allocate automatically into RAM
|
||||
* LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/
|
||||
#define LV_VDB_ADR 0
|
||||
|
||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
||||
* The flushing should use DMA to write the frame buffer in the background */
|
||||
#define LV_VDB_DOUBLE 0
|
||||
|
||||
/* Place VDB2 to a specific address (e.g. in external RAM)
|
||||
* 0: allocate automatically into RAM
|
||||
* LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`*/
|
||||
#define LV_VDB2_ADR 0
|
||||
|
||||
/* Using true double buffering in `disp_drv.disp_flush` you will always get the image of the whole screen.
|
||||
* Your only task is to set the rendered image (`color_p` parameter) as frame buffer address or send it to your display.
|
||||
* The best if you do in the blank period of you display to avoid tearing effect.
|
||||
* Requires:
|
||||
* - LV_VDB_SIZE = LV_HOR_RES * LV_VER_RES
|
||||
* - LV_VDB_DOUBLE = 1
|
||||
*/
|
||||
#define LV_VDB_TRUE_DOUBLE_BUFFERED 0
|
||||
|
||||
/*=================
|
||||
Misc. setting
|
||||
@ -75,14 +117,17 @@
|
||||
/*Text settings*/
|
||||
#define LV_TXT_UTF8 1 /*Enable UTF-8 coded Unicode character usage */
|
||||
#define LV_TXT_BREAK_CHARS " ,.;:-_" /*Can break texts on these chars*/
|
||||
#define LV_TXT_LINE_BREAK_LONG_LEN 12 /* If a character is at least this long, will break wherever "prettiest" */
|
||||
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 /* Minimum number of characters of a word to put on a line before a break */
|
||||
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 1 /* Minimum number of characters of a word to put on a line after a break */
|
||||
|
||||
/*Graphics feature usage*/
|
||||
/*Feature usage*/
|
||||
#define USE_LV_ANIMATION 1 /*1: Enable all animations*/
|
||||
#define USE_LV_SHADOW 1 /*1: Enable shadows*/
|
||||
#define USE_LV_GROUP 1 /*1: Enable object groups (for keyboards)*/
|
||||
#define USE_LV_GPU 1 /*1: Enable GPU interface*/
|
||||
#define USE_LV_REAL_DRAW 1 /*1: Enable function which draw directly to the frame buffer instead of VDB (required if LV_VDB_SIZE = 0)*/
|
||||
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
|
||||
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (might be required for images*/
|
||||
|
||||
/*Compiler settings*/
|
||||
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */
|
||||
@ -131,11 +176,9 @@
|
||||
* FONT USAGE
|
||||
*===================*/
|
||||
|
||||
/* More info about fonts: https://littlevgl.com/basics#fonts
|
||||
/* More info about fonts: https://docs.littlevgl.com/#Fonts
|
||||
* To enable a built-in font use 1,2,4 or 8 values
|
||||
* which will determine the bit-per-pixel */
|
||||
#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/
|
||||
|
||||
* which will determine the bit-per-pixel. Higher value means smoother fonts */
|
||||
#define USE_LV_FONT_DEJAVU_10 4
|
||||
#define USE_LV_FONT_DEJAVU_10_LATIN_SUP 4
|
||||
#define USE_LV_FONT_DEJAVU_10_CYRILLIC 4
|
||||
@ -166,6 +209,7 @@
|
||||
*/
|
||||
#define LV_FONT_CUSTOM_DECLARE
|
||||
|
||||
|
||||
#define LV_FONT_DEFAULT &lv_font_dejavu_20 /*Always set a default font from the built-in fonts*/
|
||||
|
||||
/*===================
|
||||
@ -173,12 +217,13 @@
|
||||
*==================*/
|
||||
#define LV_OBJ_FREE_NUM_TYPE uint32_t /*Type of free number attribute (comment out disable free number)*/
|
||||
#define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/
|
||||
#define LV_OBJ_REAILGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
|
||||
|
||||
/*==================
|
||||
* LV OBJ X USAGE
|
||||
*================*/
|
||||
/*
|
||||
* Documentation of the object types: https://littlevgl.com/object-types
|
||||
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
|
||||
*/
|
||||
|
||||
/*****************
|
||||
@ -224,7 +269,7 @@
|
||||
#endif
|
||||
|
||||
/*Tileview (dependencies: lv_page) */
|
||||
#define USE_LV_TILEVIEW 1
|
||||
#define USE_LV_TILEVIEW 0
|
||||
#if USE_LV_TILEVIEW
|
||||
#define LV_TILEVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/
|
||||
#endif
|
||||
@ -238,15 +283,18 @@
|
||||
|
||||
/*Line meter (dependencies: *;)*/
|
||||
#define USE_LV_LMETER 1
|
||||
#define USE_LV_KNOB 1
|
||||
|
||||
/*Gauge (dependencies:bar, lmeter)*/
|
||||
/*Gauge (dependencies:lv_bar, lv_lmeter)*/
|
||||
#define USE_LV_GAUGE 1
|
||||
|
||||
/*Chart (dependencies: -)*/
|
||||
#define USE_LV_CHART 1
|
||||
|
||||
#define USE_LV_TABLE 1
|
||||
/*Table (dependencies: lv_label)*/
|
||||
#define USE_LV_TABLE 0
|
||||
#if USE_LV_TABLE
|
||||
#define LV_TABLE_COL_MAX 12
|
||||
#endif
|
||||
|
||||
/*LED (dependencies: -)*/
|
||||
#define USE_LV_LED 1
|
||||
@ -261,16 +309,22 @@
|
||||
#define LV_TA_PWD_SHOW_TIME 1500 /*ms*/
|
||||
#endif
|
||||
|
||||
/*Spinbox (dependencies: lv_ta)*/
|
||||
#define USE_LV_SPINBOX 0
|
||||
|
||||
/*Calendar (dependencies: -)*/
|
||||
#define USE_LV_CALENDAR 1
|
||||
|
||||
/*Preload (dependencies: arc)*/
|
||||
/*Preload (dependencies: lv_arc)*/
|
||||
#define USE_LV_PRELOAD 1
|
||||
#if USE_LV_PRELOAD != 0
|
||||
#define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
|
||||
#define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
|
||||
#define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
|
||||
#endif
|
||||
|
||||
/*Canvas (dependencies: lv_img)*/
|
||||
#define USE_LV_CANVAS 0
|
||||
/*************************
|
||||
* User input objects
|
||||
*************************/
|
||||
@ -283,6 +337,9 @@
|
||||
|
||||
/*Image Button (dependencies: lv_btn*/
|
||||
#define USE_LV_IMGBTN 1
|
||||
#if USE_LV_IMGBTN
|
||||
#define LV_IMGBTN_TILED 0 /*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
|
||||
#endif
|
||||
|
||||
/*Button matrix (dependencies: -)*/
|
||||
#define USE_LV_BTNM 1
|
||||
@ -299,7 +356,7 @@
|
||||
#define LV_LIST_FOCUS_TIME 100 /*Default animation time of focusing to a list element [ms] (0: no animation) */
|
||||
#endif
|
||||
|
||||
/*Drop down list (dependencies: lv_page, lv_label)*/
|
||||
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
|
||||
#define USE_LV_DDLIST 1
|
||||
#if USE_LV_DDLIST != 0
|
||||
#define LV_DDLIST_ANIM_TIME 200 /*Open and close default animation time [ms] (0: no animation)*/
|
||||
@ -317,20 +374,10 @@
|
||||
/*Switch (dependencies: lv_slider)*/
|
||||
#define USE_LV_SW 1
|
||||
|
||||
#define USE_LV_CPICKER 1
|
||||
#if USE_LV_CPICKER != 0
|
||||
#define LV_CPICKER_DEF_TYPE LV_CPICKER_TYPE_RECT
|
||||
#define LV_CPICKER_DEF_HUE 0
|
||||
#define LV_CPICKER_DEF_SAT 100
|
||||
#define LV_CPICKER_DEF_VAL 100
|
||||
#define LV_CPICKER_DEF_IND_TYPE LV_CPICKER_IND_CIRCLE
|
||||
#define LV_CPICKER_DEF_QF 4
|
||||
#define LV_CPICKER_USE_TRI 1
|
||||
#endif
|
||||
/*************************
|
||||
* Non-user section
|
||||
*************************/
|
||||
#ifdef _MSC_VER /* Disable warnings for Visual Studio*/
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
|
||||
1
lib/lvgl
1
lib/lvgl
@ -1 +0,0 @@
|
||||
Subproject commit f2a77c70c1e114e4f0af49fc0c62b0a2ecf5b8cd
|
||||
@ -27,7 +27,7 @@ CFLAGS = $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
ifdef DEBUG
|
||||
CFLAGS += -g
|
||||
CFLAGS += -g3
|
||||
COPT = -O0
|
||||
else
|
||||
COPT = -Os -fdata-sections -ffunction-sections -DNDEBUG
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
#if 1 /*Set it to "1" to enable the content*/
|
||||
|
||||
#include "../../lib/lvgl/lvgl.h"
|
||||
#include "../../lib/lv_bindings/lvgl/lvgl.h"
|
||||
|
||||
/*********************
|
||||
* DELAY INTERFACE
|
||||
|
||||
7
ports/unix/lv_mp_mem_custom_include.h
Normal file
7
ports/unix/lv_mp_mem_custom_include.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
#define __LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
|
||||
#include <py/mpconfig.h>
|
||||
#include <py/misc.h>
|
||||
|
||||
#endif //__LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
@ -1,5 +1,5 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../../lib/lvgl/lvgl.h"
|
||||
#include "../../lib/lv_bindings/lvgl/lvgl.h"
|
||||
#include "monitor.h"
|
||||
#include "mouse.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
@ -282,7 +282,7 @@ void lv_task_handler(void);
|
||||
|
||||
static void monitor_sdl_refr_core(void)
|
||||
{
|
||||
lv_task_handler() ;
|
||||
// lv_task_handler() ;
|
||||
if(sdl_refr_qry != false) {
|
||||
sdl_refr_qry = false;
|
||||
SDL_UpdateTexture(texture, NULL, tft_fb, MONITOR_HOR_RES * sizeof(uint32_t));
|
||||
|
||||
@ -49,8 +49,8 @@
|
||||
#define MICROPY_ENABLE_GC (1)
|
||||
#define MICROPY_ENABLE_FINALISER (1)
|
||||
#define MICROPY_STACK_CHECK (1)
|
||||
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
|
||||
#define MICROPY_MEM_STATS (1)
|
||||
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (0)
|
||||
#define MICROPY_MEM_STATS (0)
|
||||
#define MICROPY_DEBUG_PRINTERS (1)
|
||||
#define MICROPY_ENABLE_SCHEDULER (1)
|
||||
#define MICROPY_MODULE_BUILTIN_INIT (1)
|
||||
@ -296,8 +296,9 @@ void mp_unix_mark_exec(void);
|
||||
{ MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
|
||||
|
||||
#define MP_STATE_PORT MP_STATE_VM
|
||||
|
||||
#include "lib/lv_bindings/lvgl/lv_misc/lv_gc.h"
|
||||
#define MICROPY_PORT_ROOT_POINTERS \
|
||||
LV_ROOTS \
|
||||
const char *readline_hist[50]; \
|
||||
void *mmap_region_head; \
|
||||
|
||||
|
||||
19
py/py.mk
19
py/py.mk
@ -120,12 +120,21 @@ $(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
|
||||
endif
|
||||
|
||||
#LittlevGL
|
||||
|
||||
|
||||
LVGL_DIR = lib/lvgl
|
||||
LVGL_BINDING_DIR = lib/lv_bindings
|
||||
LVGL_DIR = $(LVGL_BINDING_DIR)/lvgl
|
||||
INC += -I$(TOP)/$(LVGL_DIR)
|
||||
ALL_LVGL_SRC = $(shell find $(TOP)/$(LVGL_DIR) -type f)
|
||||
QSTR_GLOBAL_DEPENDENCIES += $(BUILD)/micropython/lv_mpy.c
|
||||
$(BUILD)/micropython/lv_mpy.c: $(ALL_LVGL_SRC)
|
||||
$(ECHO) "LVGL-GEN $@"
|
||||
$(Q)mkdir -p $(BUILD)/micropython
|
||||
$(Q)$(PYTHON) $(TOP)/$(LVGL_BINDING_DIR)/micropython/gen_mpy.py -X anim -X group -X task $(INC) -I $(TOP)/$(LVGL_BINDING_DIR)/micropython/pycparser/utils/fake_libc_include $(TOP)/$(LVGL_DIR)/lvgl.h > $@
|
||||
|
||||
SRC_MOD += $(addprefix $(LVGL_DIR)/,\
|
||||
CFLAGS_MOD += -Wno-unused-function
|
||||
|
||||
|
||||
SRC_MOD += $(BUILD)/micropython/lv_mpy.c \
|
||||
$(addprefix $(LVGL_DIR)/,\
|
||||
lv_core/lv_group.c \
|
||||
lv_core/lv_indev.c \
|
||||
lv_core/lv_obj.c \
|
||||
@ -176,6 +185,7 @@ SRC_MOD += $(addprefix $(LVGL_DIR)/,\
|
||||
lv_misc/lv_templ.c \
|
||||
lv_misc/lv_txt.c \
|
||||
lv_misc/lv_ufs.c \
|
||||
lv_misc/lv_gc.c \
|
||||
lv_objx/lv_arc.c \
|
||||
lv_objx/lv_bar.c \
|
||||
lv_objx/lv_btn.c \
|
||||
@ -213,7 +223,6 @@ SRC_MOD += $(addprefix $(LVGL_DIR)/,\
|
||||
lv_themes/lv_theme_night.c \
|
||||
lv_themes/lv_theme_templ.c \
|
||||
lv_themes/lv_theme_zen.c \
|
||||
micropython/lv_mpy.c \
|
||||
)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user