Add shared JC3636W518 board library and PlatformIO config

- shared/lib/JC3636W518: display/touch/backlight init with LVGL 9 glue
  (from scr_st77916.h), pin map, perf monitor (FPS/refresh/CPU)
- shared/include/lv_conf.h: LVGL 9.6 config for all projects
- shared/jc3636w518.ini: common platform/board/build settings
- display_gif_embedded uses it (23.2 fps, 86% CPU)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patriandClaude Opus 5.5 committed 2026-10-23 01:11:02 +02:00
1 parent 9684ab39f2
commit d6982ab7e7
14 files changed
+799 -2357

No files matched your search

@@ -0,0 +1,64 @@
#include "perf_monitor.h"
#include <Arduino.h>
static uint32_t refr_count = 0; // refreshes that actually rendered something
static uint32_t refr_time_us = 0; // time spent in those refreshes
static uint32_t busy_us = 0; // time spent inside lv_timer_handler()
static void refr_event_cb(lv_event_t *e)
{
static uint32_t refr_start_us = 0;
static bool rendered = false;
switch (lv_event_get_code(e))
{
case LV_EVENT_REFR_START:
refr_start_us = micros();
rendered = false;
break;
case LV_EVENT_RENDER_START:
rendered = true;
break;
case LV_EVENT_REFR_READY:
if (rendered)
{
refr_count++;
refr_time_us += micros() - refr_start_us;
}
break;
default:
break;
}
}
void perf_monitor_begin(lv_display_t *disp)
{
lv_display_add_event_cb(disp, refr_event_cb, LV_EVENT_ALL, NULL);
}
uint32_t perf_timer_handler()
{
uint32_t t0 = micros();
uint32_t next = lv_timer_handler();
busy_us += micros() - t0;
return next;
}
void perf_monitor_print()
{
static uint32_t last_us = 0;
uint32_t now = micros();
uint32_t elapsed = now - last_us;
if (elapsed < 1000000)
return;
uint32_t other_us = busy_us > refr_time_us ? busy_us - refr_time_us : 0;
Serial.printf("FPS: %.1f refresh: %.1f ms other: %.1f ms cpu: %.0f%%\n",
refr_count * 1e6f / elapsed,
refr_count ? refr_time_us / 1000.0f / refr_count : 0.0f,
refr_count ? other_us / 1000.0f / refr_count : 0.0f,
busy_us * 100.0f / elapsed);
refr_count = 0;
refr_time_us = 0;
busy_us = 0;
last_us = now;
}