![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Implementation: **components/drivers/graphic/logo/logo.c**. Build converts a PPM asset into **logo.inc** (RGB triplets) at compile time. At runtime **rt_graphic_logo_render()** draws the logo centered on the framebuffer when a **rt_graphic_device** registers.
Graphic stack overview: Graphics (DM).
| Option | Role |
|---|---|
**RT_GRAPHIC_LOGO** | Enable logo subsystem; selects **RT_GRAPHIC_FB** |
**RT_GRAPHIC_LOGO_NONE** | No built-in image — use **rt_graphic_logo_change()** at runtime |
**RT_GRAPHIC_LOGO_RT_THREAD_CLUT224** | Embed **logo-rt-thread-clut224.ppm** (default) |
**RT_GRAPHIC_LOGO_RT_THREAD_WHITE_CLUT224** | White variant PPM |
**SOC_DM_GRAPHIC_LOGO_DIR** | BSP adds custom logo choices via **Kconfig** / **Kconfig.path** |
Custom BSP logos: define **RT_GRAPHIC_LOGO_<NAME>** in Kconfig and **RT_GRAPHIC_LOGO_<NAME>_PATH** (string, path to .ppm). **logo/SConscript** parses the file and generates **logo.inc**.
graphic.c**).RT_GRAPHIC_LOGO** and non-empty **startup_logo** (built-in or **rt_graphic_logo_change**).var.xres / var.yres**, render fails with **-RT_EINVAL**.| Arguments | Meaning |
|---|---|
**data** | Pointer to packed RGB bytes (width * height * 3), same order as PPM pixmap data |
**width / height** | Logo size in pixels |
**color_max** | Max channel value in **data** (PPM max pixel value, e.g. 255 or 15) |
| Call pattern | Effect |
|---|---|
**data == NULL && all sizes 0** | Disable logo (**startup_logo = NULL**) |
Valid **data + dimensions** | Replace logo used on next **rt_graphic_logo_render** |
| Otherwise | **-RT_EINVAL** |
Use with **RT_GRAPHIC_LOGO_NONE** or to override the built-in clut224 asset before the first **register**.
Normally called from **rt_graphic_device_register()** — drivers rarely invoke it directly. Steps:
rt_device_open** on the graphic **rt_device**FBIOGET_VSCREENINFO** — grayscale vs RGB bitfield layoutRTGRAPHIC_CTRL_GET_INFO** — framebuffer base + pitchRTGRAPHIC_CTRL_POWERON**rect.x/y = (screen - logo) / 2**bits_per_pixel**RTGRAPHIC_CTRL_RECT_UPDATE** + **RTGRAPHIC_CTRL_WAIT_VSYNC**startup_logo** (one-shot)Without **RT_GRAPHIC_LOGO**, both APIs compile to inline no-ops returning **RT_EOK**.
**logo/SConscript** (when a logo path is selected):
width height**, **max_pixel_value**, pixel stream.logo.inc**: rows of **R,G,B** byte triplets.__STARTUP_LOGO_WIDTH__**, **__STARTUP_LOGO_HEIGHT__**, **__STARTUP_LOGO_COLOR_MAX__**.**logo.c** includes **logo.inc** into **builtin_logo[]** when all three macros are non-zero.
| Magic | Kind | Encoding | Notes |
|---|---|---|---|
| P1 | Bitmap | ASCII | Build script ASCII path |
| P2 | Graymap | ASCII | Build script ASCII path |
| P3 | Pixmap | ASCII | Typical for clut224 logos |
| P4 | Bitmap | Binary | Convert to P3 for embed |
| P5 | Graymap | Binary | Convert to P3 for embed |
| P6 | Pixmap | Binary | Use **pnmnoraw** → P3 for SConscript |
Runtime rendering always uses RGB triplets in memory.
| Col 0 | Col 1 | Col 2 | Col 3 | |
|---|---|---|---|---|
| Row 0 | 0,0,0 | 0,0,0 | 0,0,0 | 15,0,15 |
| Row 1 | 0,0,0 | 0,15,7 | 0,0,0 | 0,0,0 |
| Row 2 | 0,0,0 | 0,0,0 | 0,15,7 | 0,0,0 |
| Row 3 | 15,0,15 | 0,0,0 | 0,0,0 | 0,0,0 |
RT_GRAPHIC_LOGO_<NAME>_PATH** at the file, or replace in-tree **logo-rt-thread-clut224.ppm**.Open **components/drivers/graphic/logo/logo.html** in a browser to preview a PPM before building.
| Topic | Guidance |
|---|---|
| Asset size | Large PPM bloats **logo.inc** and slows boot — keep resolution modest. |
| Display readiness | Logo runs at **register** — enable backlight after first frame if needed (Backlight devices). |
| Format | Invalid PPM fails SConscript at build time; validate in CI. |
| One-shot | After first render, **startup_logo** is cleared — call **rt_graphic_logo_change** again for another splash. |
-RT_EINVAL** — match PPM to panel resolution.RT_GRAPHIC_LOGO_NONE without logo_change**: no logo (by design).pnmnoraw**.simple-framebuffer)components/drivers/graphic/logo/logo.c, logo/SConscriptcomponents/drivers/include/drivers/graphic.h