diff --git a/code/esp32c3_espidf/components/lvgl b/code/esp32c3_espidf/components/lvgl new file mode 160000 index 0000000..0a05078 --- /dev/null +++ b/code/esp32c3_espidf/components/lvgl @@ -0,0 +1 @@ +Subproject commit 0a050784550d3d38355ce5f1676315f881edfa4c diff --git a/code/esp32c3_espidf/dependencies.lock b/code/esp32c3_espidf/dependencies.lock index 2a7d37e..89bb3a2 100644 --- a/code/esp32c3_espidf/dependencies.lock +++ b/code/esp32c3_espidf/dependencies.lock @@ -2,7 +2,7 @@ dependencies: idf: source: type: idf - version: 5.5.2 + version: 5.5.1 manifest_hash: a52a8cabe7f10f1636effa39e0be0f2d62531803ed5f518e7921b728e64c8752 target: esp32c3 version: 2.0.0 diff --git a/code/esp32c3_espidf/main/hello_world_main.c b/code/esp32c3_espidf/main/hello_world_main.c index d1df705..1b7b08b 100644 --- a/code/esp32c3_espidf/main/hello_world_main.c +++ b/code/esp32c3_espidf/main/hello_world_main.c @@ -40,14 +40,14 @@ static const char *TAG = "SYS"; // 自定义 tick 获取函数 -static uint32_t custom_tick_get(void) -{ - // 返回从启动到现在的毫秒数 - // 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值 - uint64_t time_us = esp_timer_get_time(); - return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000 - //return (uint32_t)(esp_timer_get_time() / 1000); -} +// static uint32_t custom_tick_get(void) +// { +// // 返回从启动到现在的毫秒数 +// // 使用64位中间变量避免溢出,采用乘以1.024的倒数近似值 +// uint64_t time_us = esp_timer_get_time(); +// return (uint32_t)((time_us * 1073) >> 20); // 1073/2^20 ≈ 1/1000 +// //return (uint32_t)(esp_timer_get_time() / 1000); +// } esp_timer_handle_t timer_handle; diff --git a/code/esp32c3_espidf/main/lv_apps/helloworld/lv_helloworld.c b/code/esp32c3_espidf/main/lv_apps/helloworld/lv_helloworld.c index 8af0ea6..6874f6e 100644 --- a/code/esp32c3_espidf/main/lv_apps/helloworld/lv_helloworld.c +++ b/code/esp32c3_espidf/main/lv_apps/helloworld/lv_helloworld.c @@ -9,7 +9,7 @@ LV_FONT_DECLARE(my_cn_font); * Create styles from scratch for buttons. */ -unsigned int t=0; +unsigned long t=0; char str[32]={0}; lv_obj_t *label3 ; //lv_label_create(lv_screen_active()); /*Add a label to the button*/ @@ -17,7 +17,7 @@ lv_obj_t *label3 ; //lv_label_create(lv_screen_active()); /*Add a label to the b void this_work_loop(){ t++; - lv_label_set_text_fmt(label3,"这是啥xxx:%d",t); + lv_label_set_text_fmt(label3,"时间过去了:%lu秒",t); } @@ -57,7 +57,6 @@ void lv_example_get_started_1(void) label3=lv_label_create(lv_screen_active()); /*Add a label to the button*/ lv_obj_add_style(label3, &style_label, 0); - lv_label_set_text_fmt(label3,"这是xxx:%d",t); lv_timer_create(this_work_loop, 1000, NULL); }