Setup for pm3 building

This commit is contained in:
Edith Boles
2026-03-01 18:10:48 -08:00
parent d70c09e03c
commit e0d0728b12
6 changed files with 1196 additions and 26 deletions

1156
.config Normal file

File diff suppressed because it is too large Load Diff

4
.gitignore vendored
View File

@@ -1,3 +1,7 @@
bin/
obj/
.cache
.build
build.log
include
.config.old

View File

@@ -1,7 +1,17 @@
.PHONY: all clean build zip
API := x11
CFLAGS := -MD -Wall -g -lm -pthread -I ./inc/
ifeq ($(API), arm)
CC := arm-cortexa9_neon-linux-gnueabihf-gcc
CFLAGS := $(CFLAGS) -D LV_TARGET_FB
else
CC := gcc
CFLAGS := -MD -Wall -g -lm -lX11 -I ./inc/
CFLAGS := $(CFLAGS) -lX11
endif
TARGETS := pm3-lvgl
EXES := $(patsubst %,bin/%,$(TARGETS))
SRCS := $(shell find src inc -type f -iname '*.c')

View File

@@ -1,10 +1,5 @@
#define LV_TARGET_X11
// #define LV_TARGET_FB
#ifdef LV_TARGET_X11
#include "./lv_conf_x11.h"
#endif
#ifdef LV_TARGET_FB
#include "./lv_conf_fb.h"
#else
#include "./lv_conf_x11.h"
#endif

View File

@@ -80,7 +80,7 @@
*====================*/
/** Default display refresh, input device read and animation step period. */
#define LV_DEF_REFR_PERIOD 33 /**< [ms] */
#define LV_DEF_REFR_PERIOD 100 /**< [ms] */
/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
* (Not so important, you can adjust it to modify default sizes and spaces.) */
@@ -643,7 +643,7 @@
/* Montserrat fonts with ASCII range and some symbols using bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_10 1
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
@@ -652,7 +652,7 @@
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_28 1
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
@@ -662,7 +662,7 @@
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
#define LV_FONT_MONTSERRAT_48 1
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
@@ -898,7 +898,7 @@
/** Setting a default driver letter allows skipping the driver prefix in filepaths.
* Documentation about how to use the below driver-identifier letters can be found at
* https://docs.lvgl.io/master/main-modules/fs.html#lv-fs-identifier-letters . */
#define LV_FS_DEFAULT_DRIVER_LETTER '\0'
#define LV_FS_DEFAULT_DRIVER_LETTER 'D'
/** API for fopen, fread, etc. */
#define LV_USE_FS_STDIO 0
@@ -911,7 +911,7 @@
/** API for open, read, etc. */
#define LV_USE_FS_POSIX 0
#if LV_USE_FS_POSIX
#define LV_FS_POSIX_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */
#define LV_FS_POSIX_LETTER 'D' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */
#define LV_FS_POSIX_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */
#define LV_FS_POSIX_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */
#endif
@@ -1271,7 +1271,7 @@
#endif
/** Use X11 to open window on Linux desktop and handle mouse and keyboard */
#define LV_USE_X11 1
#define LV_USE_X11 0
#if LV_USE_X11
#define LV_X11_DIRECT_EXIT 1 /**< Exit application when all X11 windows have been closed */
#define LV_X11_DOUBLE_BUFFER 1 /**< Use double buffers for rendering */
@@ -1288,7 +1288,7 @@
#endif
/** Driver for /dev/fb */
#define LV_USE_LINUX_FBDEV 0
#define LV_USE_LINUX_FBDEV 1
#if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL

View File

@@ -15,6 +15,7 @@ LV_IMG_DECLARE(hop_logo);
static lv_anim_t anim_template;
static lv_anim_t *running_anim;
lv_display_t *display;
lv_obj_t *label_time;
lv_obj_t *label_date;
@@ -60,19 +61,19 @@ void create_screen()
lv_label_set_text(label_sku, "DEMO-DEV-LVGL");
lv_obj_set_style_text_font(label_sku, &dejavu_bold_10, 0);
lv_obj_set_style_text_color(label_sku, lv_color_hex(0xffffff), 0);
lv_obj_align(label_sku, LV_ALIGN_CENTER, 0, 226);
lv_obj_align(label_sku, LV_ALIGN_CENTER, 0, 233);
label_date = lv_label_create(lv_screen_active());
lv_label_set_text(label_date, "01-01-99");
lv_obj_set_style_text_font(label_date, &dejavu_28, 0);
lv_obj_set_style_text_color(label_date, lv_color_hex(0xffffff), 0);
lv_obj_align(label_date, LV_ALIGN_CENTER, -315, 226);
lv_obj_align(label_date, LV_ALIGN_CENTER, -275, 226);
label_time = lv_label_create(lv_screen_active());
lv_label_set_text(label_time, "12:59 a.m.");
lv_obj_set_style_text_font(label_time, &dejavu_28, 0);
lv_obj_set_style_text_color(label_time, lv_color_hex(0xffffff), 0);
lv_obj_align(label_time, LV_ALIGN_CENTER, 315, 226);
lv_obj_align(label_time, LV_ALIGN_CENTER, 275, 226);
}
int main(int argc, char *argv[])
@@ -83,8 +84,12 @@ int main(int argc, char *argv[])
char buf[100];
lv_init();
lv_display_t *display =
lv_x11_window_create("LVGL X11 Simulation", 800, 480);
#ifdef LV_TARGET_FB
display = lv_linux_fbdev_create();
lv_linux_fbdev_set_file(display, "/dev/fb0");
#else
display = lv_x11_window_create("LVGL X11 Simulation", 800, 480);
#endif
create_screen();
@@ -95,7 +100,7 @@ int main(int argc, char *argv[])
local_time = localtime(&curr_time);
strftime(buf, 100, "%m-%d-%y", local_time);
lv_label_set_text(label_date, buf);
strftime(buf, 90, "%I:%M %P", local_time);
strftime(buf, 90, "%l:%M %P", local_time);
int i = 0;
while (buf[i])
i++;