ui_net_sink 拆分为协议层与平台后端,新增 RemoDispBus 设计文档

This commit is contained in:
2026-09-11 21:25:02 +08:00
parent 2429955d1a
commit d150810587
20 changed files with 1600 additions and 408 deletions
+50
View File
@@ -0,0 +1,50 @@
/*
* 模块名称:Simulator Display Port (SDL2 模拟器端口)
* 模块功能:为 PC 模拟器提供 LVGL SDL2 显示与键盘输入端口
* 适用平台:Windows / Linux / macOS (SDL2)
* 说明:替代 MCU 端的 ui_port.c,用于 PC 上 UI 开发与调试
*/
#ifndef __SIM_PORT_H
#define __SIM_PORT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* 函数功能:初始化 SDL2 显示窗口与键盘输入设备
* 入口参数:hor_res - 水平分辨率 int32_t
* ver_res - 垂直分辨率 int32_t
* 返回值:0 - 成功,-1 - 失败
* 限定条件:lv_init() 已调用
* 函数说明:创建 SDL 窗口、键盘输入设备及默认输入组
*/
int sim_port_init(int32_t hor_res, int32_t ver_res);
/*
* 函数功能:获取 SDL 显示设备句柄
* 入口参数:无
* 返回值:显示设备指针 lv_display_t * 可能为 NULL
* 限定条件:sim_port_init() 已成功调用
*/
void *sim_port_get_display(void);
/*
* 函数功能:读取当前屏幕内容并转换为 1bpp 单色位图
* 入口参数:buf - 输出缓冲(调用方分配,≥ 宽*高/8 字节)
* buf_size - buf 容量(字节)
* 返回值:0 - 成功,-1 - 失败
* 限定条件:sim_port_init() 已成功;须在 SDL 所属线程(主循环线程)调用
* 函数说明:经 SDL_RenderReadPixels 读回屏幕实际呈现的 ARGB8888 像素,
* 按红通道阈值 128 判白(=1/墨)/黑(=0),打包为 1bpp MSB-first,
* 与 MCU 端 ui_port_get_framebuffer 的 1bpp 布局一致
*/
int sim_port_get_screen_mono(uint8_t *buf, uint32_t buf_size);
#ifdef __cplusplus
}
#endif
#endif /* __SIM_PORT_H */