diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..679c448e6df2eaeb21c86f68eb5097495b1f4a9f --- /dev/null +++ b/README.en.md @@ -0,0 +1,79 @@ +# Project-II: LVGL Project Based on Framebuffer + +This project is an embedded graphics interface application example based on **LVGL (Light and Versatile Graphics Library)**, specifically adapted and integrated for **Linux Framebuffer Devices**. + +## Project Introduction + +This project aims to provide an out-of-the-box LVGL development environment, suitable for scenarios requiring the display of graphical interfaces via framebuffer (typically `/dev/fb0`) on embedded Linux devices (such as Raspberry Pi, development boards, etc.). It integrates the LVGL core library, device drivers, and custom application logic. + +### Main Features + +* **Graphics Library Core**: Integrated LVGL v8, providing powerful 2D graphics rendering capabilities. +* **Framebuffer Driver**: Uses `fbdev` driver to directly operate the frame buffer, without needing X11 or Wayland. +* **Input Device Support**: Supports touchscreens (such as XPT2046), mice, keyboards, and other input devices (via `evdev` or dedicated drivers). +* **Rich Demos**: Built-in LVGL official examples (Widgets, Benchmark, Music Player, Stress Test, etc.). +* **Custom Applications**: Includes sample code such as `dir_brower.c`, demonstrating how to implement complex UI logic like a file browser. + +## Directory Structure + +The main project code is located in the `code/` directory: + +* `code/` + * `lvgl/`: **LVGL Core Library Source Code**. Contains core drawing logic, widget implementations, animation systems, etc. + * `lv_drivers/`: **Device Driver Layer**. + * `display/`: Display drivers (e.g., `fbdev.c`, `ILI9341.c`, etc.). Among them, `fbdev` is responsible for outputting LVGL rendering results to the Framebuffer. + * `indev/`: Input device drivers (e.g., `evdev.c` for Linux system input, `XPT2046.c` for touchscreen control). + * `demo1/`: Main application or Demo entry code. + * `dir_brower.c`: A custom directory browsing and image preview demonstration program. + * `lv_conf.h`: LVGL configuration file, used to trim functions, set color depth, memory size, etc. + * `Makefile`: Project build script. + +## Environment Requirements + +* **Linux System**: Kernel with Framebuffer support (most embedded Linux environments have this by default). +* **Development Tools**: GCC compiler, Make tool. +* **Runtime Dependencies**: Typically requires Root privileges or specific user group permissions to access `/dev/fb*` and `/dev/input/*` device nodes. + +## Compilation and Running + +1. **Enter the code directory**: + ```bash + cd code + ``` + +2. **Compile the project**: + The project provides a `Makefile`; you can compile directly using the make command: + ```bash + make + ``` + After compilation completes, an executable file will be generated (usually located in the `code` directory). + +3. **Run the program**: + Copy the compiled binary file to the target embedded device to run. Before running, ensure the monitor is connected normally and the Framebuffer device node exists. + ```bash + ./your_executable + ``` + +## Configuration Instructions + +### Display and Driver Configuration + +* **`lv_conf.h`**: Modify this file to adjust LVGL behavior, for example: + * `#define LV_COLOR_DEPTH 16`: Set color depth (typically 16 or 32). + * `#define LV_USE_LOG 1`: Enable logs for debugging. +* **`lv_drivers/lv_drv_conf.h`** (or corresponding configuration in the code directory): Select enabled display and input drivers. + * Ensure `#define USE_FBDEV 1` is enabled. + * Enable `#define USE_EVDEV` or touchscreen driver as needed. + +### Code Example + +The `dir_brower.c` in the project demonstrates how to combine file system operations with image display in LVGL. You can develop your own UI applications based on this. + +## Related Documents + +* **LVGL Official Documentation**: For detailed API descriptions and usage guides, please refer to the documentation under the `code/lvgl/docs/` directory, or visit the [LVGL Official Website](https://lvgl.io/). +* **Driver Documentation**: The `lv_drivers/` directory provides usage instructions for some drivers. + +## License + +This project uses the LVGL library; relevant source code follows the MIT License. Please refer to `code/lv_drivers/LICENSE` and `code/lvgl/LICENCE.txt` for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fe57922d34e89be2fda458865e7c0ea38e9435d6 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ + + +# Project-II:基于 Framebuffer 的 LVGL 项目 + +本项目是一个基于 **LVGL (Light and Versatile Graphics Library)** 的嵌入式图形界面应用示例,专门针对 **Linux 帧缓冲设备 (Framebuffer Device)** 进行了适配与集成。 + +## 项目简介 + +该项目旨在提供一个开箱即用的 LVGL 开发环境,适用于需要在嵌入式 Linux 设备(如树莓派、开发板等)上通过帧缓冲(通常为 `/dev/fb0`)显示图形界面的场景。它集成了 LVGL 核心库、设备驱动以及自定义的应用程序逻辑。 + +### 主要特性 + +* **图形库核心**: 集成 LVGL v8,提供强大的 2D 图形渲染能力。 +* **帧缓冲驱动**: 使用 `fbdev` 驱动直接操作帧缓冲区,无需 X11 或 Wayland。 +* **输入设备支持**: 支持触摸屏(如 XPT2046)、鼠标、键盘等输入设备(通过 `evdev` 或专用驱动)。 +* **丰富的 Demo**: 内置 LVGL 官方示例(Widgets、Benchmark、Music Player、Stress Test 等)。 +* **自定义应用**: 包含 `dir_brower.c` 等示例代码,演示了如何实现文件浏览器等复杂 UI 逻辑。 + +## 目录结构 + +项目主要代码位于 `code/` 目录下: + +* `code/` + * `lvgl/`: **LVGL 核心库源码**。包含核心绘图逻辑、控件(Widgets)实现、动画系统等。 + * `lv_drivers/`: **设备驱动层**。 + * `display/`: 显示器驱动(如 `fbdev.c`, `ILI9341.c` 等)。其中 `fbdev` 负责将 LVGL 的渲染结果输出到 Framebuffer。 + * `indev/`: 输入设备驱动(如 `evdev.c` 用于 Linux 系统输入, `XPT2046.c` 用于触摸屏控制)。 + * `demo1/`: 主应用程序或 Demo 入口代码。 + * `dir_brower.c`: 一个自定义的目录浏览与图片预览演示程序。 + * `lv_conf.h`: LVGL 的配置文件,用于裁剪功能、设置颜色深度、内存大小等。 + * `Makefile`: 项目构建脚本。 + +## 环境要求 + +* **Linux 系统**: 带有 Framebuffer 支持的内核(大多数嵌入式 Linux 环境默认具备)。 +* **开发工具**: GCC 编译器、Make 工具。 +* **运行依赖**: 通常需要 Root 权限或特定的用户组权限来访问 `/dev/fb*` 和 `/dev/input/*` 设备节点。 + +## 编译与运行 + +1. **进入代码目录**: + ```bash + cd code + ``` + +2. **编译项目**: + 项目提供了 `Makefile`,可以直接使用 make 命令编译: + ```bash + make + ``` + 编译完成后,会生成可执行文件(通常位于 `code` 目录下)。 + +3. **运行程序**: + 将编译出的二进制文件复制到目标嵌入式设备上运行。运行前请确保显示器连接正常且 Framebuffer 设备节点存在。 + ```bash + ./your_executable + ``` + +## 配置说明 + +### 显示与驱动配置 + +* **`lv_conf.h`**: 修改此文件以调整 LVGL 的行为,例如: + * `#define LV_COLOR_DEPTH 16`: 设置颜色深度(通常为 16 或 32)。 + * `#define LV_USE_LOG 1`: 开启日志以便调试。 +* **`lv_drivers/lv_drv_conf.h`** (或在 code 目录下的对应配置): 选择启用的显示和输入驱动。 + * 确保 `#define USE_FBDEV 1` 被开启。 + * 根据需要开启 `#define USE_EVDEV` 或触摸屏驱动。 + +### 代码示例 + +项目中的 `dir_brower.c` 展示了如何在 LVGL 中结合文件系统操作与图片显示。你可以在此基础上开发自己的 UI 应用。 + +## 相关文档 + +* **LVGL 官方文档**: 详细的 API 说明和使用指南请参考 `code/lvgl/docs/` 目录下的文档,或访问 [LVGL 官网](https://lvgl.io/)。 +* **驱动文档**: `lv_drivers/` 目录下提供了部分驱动的使用说明。 + +## 许可证 + +本项目使用了 LVGL 库,相关源码遵循 MIT 许可证。请参考 `code/lv_drivers/LICENSE` 和 `code/lvgl/LICENCE.txt` 了解详情。 \ No newline at end of file