Standby UI updated.

This commit is contained in:
imi415 2022-07-02 10:15:05 +08:00
parent cbc12d55ac
commit 023fff397f
Signed by: imi415
GPG Key ID: 885EC2B5A8A6F8A7
10 changed files with 53 additions and 21 deletions

View File

@ -596,7 +596,7 @@
<setting name="writeAddressHold" value="kFLEXBUS_Hold1Cycle"/> <setting name="writeAddressHold" value="kFLEXBUS_Hold1Cycle"/>
<setting name="readAddressHold" value="kFLEXBUS_Hold1Or0Cycles"/> <setting name="readAddressHold" value="kFLEXBUS_Hold1Or0Cycles"/>
<setting name="addressSetup" value="kFLEXBUS_FirstRisingEdge"/> <setting name="addressSetup" value="kFLEXBUS_FirstRisingEdge"/>
<setting name="waitStates" value="6"/> <setting name="waitStates" value="4"/>
<setting name="burstWrite" value="false"/> <setting name="burstWrite" value="false"/>
<setting name="burstRead" value="false"/> <setting name="burstRead" value="false"/>
<setting name="writeProtect" value="false"/> <setting name="writeProtect" value="false"/>

View File

@ -49,7 +49,7 @@
/* Entry Point */ /* Entry Point */
ENTRY(Reset_Handler) ENTRY(Reset_Handler)
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x1000; HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x1C00;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400; STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0; M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;

2
SDK

@ -1 +1 @@
Subproject commit ede33dcf057746da396088a4d9dcea87b02f3b25 Subproject commit ebf85f1dc65f670d3be63f59795c2bde9a8d59da

View File

@ -109,7 +109,7 @@ instance:
- writeAddressHold: 'kFLEXBUS_Hold1Cycle' - writeAddressHold: 'kFLEXBUS_Hold1Cycle'
- readAddressHold: 'kFLEXBUS_Hold1Or0Cycles' - readAddressHold: 'kFLEXBUS_Hold1Or0Cycles'
- addressSetup: 'kFLEXBUS_FirstRisingEdge' - addressSetup: 'kFLEXBUS_FirstRisingEdge'
- waitStates: '6' - waitStates: '4'
- burstWrite: 'false' - burstWrite: 'false'
- burstRead: 'false' - burstRead: 'false'
- writeProtect: 'false' - writeProtect: 'false'
@ -153,7 +153,7 @@ flexbus_config_t FB_LCD_config = {
.writeAddressHold = kFLEXBUS_Hold1Cycle, .writeAddressHold = kFLEXBUS_Hold1Cycle,
.readAddressHold = kFLEXBUS_Hold1Or0Cycles, .readAddressHold = kFLEXBUS_Hold1Or0Cycles,
.addressSetup = kFLEXBUS_FirstRisingEdge, .addressSetup = kFLEXBUS_FirstRisingEdge,
.waitStates = 6U, .waitStates = 4U,
.secondaryWaitStates = false, .secondaryWaitStates = false,
.burstWrite = false, .burstWrite = false,
.burstRead = false, .burstRead = false,

View File

@ -49,7 +49,7 @@
#define LV_MEM_CUSTOM 0 #define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0 #if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
#define LV_MEM_SIZE (128U * 1024U) /*[bytes]*/ #define LV_MEM_SIZE (192U * 1024U) /*[bytes]*/
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /* FB SRAM */ #define LV_MEM_ADR 0 /* FB SRAM */
@ -78,10 +78,10 @@
*====================*/ *====================*/
/*Default display refresh period. LVG will redraw changed areas with this period time*/ /*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ #define LV_DISP_DEF_REFR_PERIOD 33 /*[ms]*/
/*Input device read period in milliseconds*/ /*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ #define LV_INDEV_DEF_READ_PERIOD 33 /*[ms]*/
/*Use a custom tick source that tells the elapsed time in milliseconds. /*Use a custom tick source that tells the elapsed time in milliseconds.
*It removes the need to manually update the tick with `lv_tick_inc()`)*/ *It removes the need to manually update the tick with `lv_tick_inc()`)*/
@ -243,7 +243,7 @@
*-----------*/ *-----------*/
/*1: Show CPU usage and FPS count*/ /*1: Show CPU usage and FPS count*/
#define LV_USE_PERF_MONITOR 0 #define LV_USE_PERF_MONITOR 1
#if LV_USE_PERF_MONITOR #if LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
#endif #endif

View File

@ -1,9 +1,13 @@
#ifndef UI_HELPERS_H #ifndef UI_HELPERS_H
#define UI_HELPERS_H #define UI_HELPERS_H
/* FreeRTOS */
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "semphr.h" #include "semphr.h"
/* LVGL */
#include "lvgl.h"
typedef enum { typedef enum {
UI_STANDBY_CMD_UPDATE_TIME, UI_STANDBY_CMD_UPDATE_TIME,
} ui_standby_queue_cmd_t; } ui_standby_queue_cmd_t;
@ -16,6 +20,9 @@ typedef struct {
extern SemaphoreHandle_t g_lvgl_semphr; extern SemaphoreHandle_t g_lvgl_semphr;
extern QueueHandle_t g_ui_standby_queue; extern QueueHandle_t g_ui_standby_queue;
extern lv_font_t *g_font_noto_sans_bold_72;
extern lv_obj_t *g_screen_standby;
int ui_setup(void); int ui_setup(void);
#endif #endif

View File

@ -20,7 +20,7 @@
#define LVGL_RES_HOR 240 #define LVGL_RES_HOR 240
#define LVGL_RES_VER 320 #define LVGL_RES_VER 320
#define LVGL_CACHE_DEPTH 20 #define LVGL_CACHE_DEPTH 40
SemaphoreHandle_t g_lvgl_semphr; SemaphoreHandle_t g_lvgl_semphr;
EventGroupHandle_t g_lvgl_event_group; EventGroupHandle_t g_lvgl_event_group;

View File

@ -81,6 +81,8 @@ static void vTaskHello(void *pvParameters) {
ip_stack_setup(); ip_stack_setup();
mtls_selftests(1);
time_t t; time_t t;
struct tm *cur_tm; struct tm *cur_tm;
for (;;) { for (;;) {

View File

@ -1,18 +1,33 @@
#include "ui_helpers.h" #include "ui_helpers.h"
QueueHandle_t g_ui_standby_queue; QueueHandle_t g_ui_standby_queue;
lv_font_t *g_font_noto_sans_bold_72;
lv_obj_t *g_screen_standby;
void ui_standby_task(void *pvParameters); void ui_standby_task(void *pvParameters);
int ui_setup(void) { int ui_setup(void) {
g_ui_standby_queue = xQueueCreate(2, sizeof(ui_standby_queue_t)); g_ui_standby_queue = xQueueCreate(2, sizeof(ui_standby_queue_t));
if(g_ui_standby_queue == NULL) { if (g_ui_standby_queue == NULL) {
return -1; return -1;
} }
if(xTaskCreate(ui_standby_task, "U_STBY", 256, NULL, 14, NULL) != pdPASS) { g_font_noto_sans_bold_72 = lv_font_load("A:/resources/fonts/noto-sans_bold_72.bin");
if (g_font_noto_sans_bold_72 == NULL) {
return -2; return -2;
} }
g_screen_standby = lv_obj_create(NULL);
if (g_screen_standby == NULL) {
return -3;
}
lv_scr_load(g_screen_standby);
if (xTaskCreate(ui_standby_task, "U_STBY", 256, NULL, 14, NULL) != pdPASS) {
return -4;
}
return 0; return 0;
} }

View File

@ -9,22 +9,30 @@
#include "ui_helpers.h" #include "ui_helpers.h"
void ui_standby_task(void *pvParameters) { void ui_standby_task(void *pvParameters) {
lv_obj_t *img_background = NULL;
lv_font_t *font_noto_sans_bold_72 = NULL;
lv_style_t style_label_time; lv_style_t style_label_time;
lv_style_t style_image_background;
lv_obj_t *label_time = NULL; lv_obj_t *label_time = NULL;
lv_obj_t *image_background = NULL;
if (xSemaphoreTake(g_lvgl_semphr, portMAX_DELAY) == pdTRUE) { if (xSemaphoreTake(g_lvgl_semphr, portMAX_DELAY) == pdTRUE) {
img_background = lv_img_create(lv_scr_act());
lv_img_set_src(img_background, "A:/resources/images/bg_image_1.bin");
font_noto_sans_bold_72 = lv_font_load("A:/resources/fonts/noto-sans_bold_72.bin"); /* Background style */
lv_style_init(&style_image_background);
lv_style_set_opa(&style_image_background, LV_OPA_30);
/* Label style */
lv_style_init(&style_label_time); lv_style_init(&style_label_time);
lv_style_set_text_font(&style_label_time, font_noto_sans_bold_72); lv_style_set_text_font(&style_label_time, g_font_noto_sans_bold_72);
lv_style_set_text_color(&style_label_time, lv_color_make(181, 27, 58)); lv_style_set_text_color(&style_label_time, lv_palette_main(LV_PALETTE_PINK));
label_time = lv_label_create(lv_scr_act()); /* Background image */
image_background = lv_img_create(g_screen_standby);
lv_img_set_src(image_background, "A:/resources/images/bg_image_1.bin");
lv_obj_add_style(image_background, &style_image_background, LV_STATE_DEFAULT);
lv_obj_move_background(image_background);
/* Time label */
label_time = lv_label_create(g_screen_standby);
lv_obj_add_style(label_time, &style_label_time, 0); lv_obj_add_style(label_time, &style_label_time, 0);
lv_obj_set_width(label_time, 240); lv_obj_set_width(label_time, 240);
lv_obj_set_height(label_time, 80); lv_obj_set_height(label_time, 80);