diff --git a/MK60DN512xxx10.mex b/MK60DN512xxx10.mex index bbf683a..c102f99 100644 --- a/MK60DN512xxx10.mex +++ b/MK60DN512xxx10.mex @@ -596,7 +596,7 @@ - + diff --git a/MK60DN512xxx10_flash_sram.ld b/MK60DN512xxx10_flash_sram.ld index f7d9e78..55b3fcd 100644 --- a/MK60DN512xxx10_flash_sram.ld +++ b/MK60DN512xxx10_flash_sram.ld @@ -49,7 +49,7 @@ /* Entry Point */ 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; M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0; diff --git a/SDK b/SDK index ede33dc..ebf85f1 160000 --- a/SDK +++ b/SDK @@ -1 +1 @@ -Subproject commit ede33dcf057746da396088a4d9dcea87b02f3b25 +Subproject commit ebf85f1dc65f670d3be63f59795c2bde9a8d59da diff --git a/board/peripherals.c b/board/peripherals.c index ae06d9b..203d294 100644 --- a/board/peripherals.c +++ b/board/peripherals.c @@ -109,7 +109,7 @@ instance: - writeAddressHold: 'kFLEXBUS_Hold1Cycle' - readAddressHold: 'kFLEXBUS_Hold1Or0Cycles' - addressSetup: 'kFLEXBUS_FirstRisingEdge' - - waitStates: '6' + - waitStates: '4' - burstWrite: 'false' - burstRead: 'false' - writeProtect: 'false' @@ -153,7 +153,7 @@ flexbus_config_t FB_LCD_config = { .writeAddressHold = kFLEXBUS_Hold1Cycle, .readAddressHold = kFLEXBUS_Hold1Or0Cycles, .addressSetup = kFLEXBUS_FirstRisingEdge, - .waitStates = 6U, + .waitStates = 4U, .secondaryWaitStates = false, .burstWrite = false, .burstRead = false, diff --git a/include/lv_conf.h b/include/lv_conf.h index d78e9c7..0885819 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -49,7 +49,7 @@ #define LV_MEM_CUSTOM 0 #if LV_MEM_CUSTOM == 0 /*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.*/ #define LV_MEM_ADR 0 /* FB SRAM */ @@ -78,10 +78,10 @@ *====================*/ /*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*/ -#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. *It removes the need to manually update the tick with `lv_tick_inc()`)*/ @@ -243,7 +243,7 @@ *-----------*/ /*1: Show CPU usage and FPS count*/ -#define LV_USE_PERF_MONITOR 0 +#define LV_USE_PERF_MONITOR 1 #if LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT #endif diff --git a/include/ui_helpers.h b/include/ui_helpers.h index 4c2ffc0..5168568 100644 --- a/include/ui_helpers.h +++ b/include/ui_helpers.h @@ -1,9 +1,13 @@ #ifndef UI_HELPERS_H #define UI_HELPERS_H +/* FreeRTOS */ #include "FreeRTOS.h" #include "semphr.h" +/* LVGL */ +#include "lvgl.h" + typedef enum { UI_STANDBY_CMD_UPDATE_TIME, } ui_standby_queue_cmd_t; @@ -16,6 +20,9 @@ typedef struct { extern SemaphoreHandle_t g_lvgl_semphr; 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); #endif \ No newline at end of file diff --git a/src/lvgl_helpers.c b/src/lvgl_helpers.c index a7afc08..90021f9 100644 --- a/src/lvgl_helpers.c +++ b/src/lvgl_helpers.c @@ -20,7 +20,7 @@ #define LVGL_RES_HOR 240 #define LVGL_RES_VER 320 -#define LVGL_CACHE_DEPTH 20 +#define LVGL_CACHE_DEPTH 40 SemaphoreHandle_t g_lvgl_semphr; EventGroupHandle_t g_lvgl_event_group; diff --git a/src/main.c b/src/main.c index 88282b9..5c3078b 100644 --- a/src/main.c +++ b/src/main.c @@ -81,6 +81,8 @@ static void vTaskHello(void *pvParameters) { ip_stack_setup(); + mtls_selftests(1); + time_t t; struct tm *cur_tm; for (;;) { diff --git a/src/ui/ui.c b/src/ui/ui.c index 4837194..7016dd2 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -1,18 +1,33 @@ #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); int ui_setup(void) { 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; } - 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; } + 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; } \ No newline at end of file diff --git a/src/ui/ui_standby.c b/src/ui/ui_standby.c index d4fe224..a8fb80f 100644 --- a/src/ui/ui_standby.c +++ b/src/ui/ui_standby.c @@ -9,22 +9,30 @@ #include "ui_helpers.h" 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_image_background; lv_obj_t *label_time = NULL; + lv_obj_t *image_background = NULL; 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_set_text_font(&style_label_time, font_noto_sans_bold_72); - lv_style_set_text_color(&style_label_time, lv_color_make(181, 27, 58)); + lv_style_set_text_font(&style_label_time, g_font_noto_sans_bold_72); + 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_set_width(label_time, 240); lv_obj_set_height(label_time, 80);