Skip to main content

rlvgl_platform/
lib.rs

1//! Hardware and simulator backends for `rlvgl`.
2#![no_std]
3#![deny(missing_docs)]
4// Register-Mashing Discipline rule #7 enforcement: every `unsafe`
5// operation inside an `unsafe fn` body MUST sit in an explicit
6// `unsafe { ... }` block carrying a `// SAFETY:` comment. Edition 2024
7// makes the lint `warn` by default; this `deny` upgrades it to a hard
8// error so the unsafe envelope can't silently expand through `unsafe
9// fn` body inheritance.
10#![deny(unsafe_op_in_unsafe_fn)]
11
12extern crate alloc;
13
14#[cfg(any(feature = "simulator", feature = "fatfs", feature = "linux_fbdev"))]
15extern crate std;
16
17#[cfg(feature = "simulator")]
18pub mod app_loader;
19#[cfg(all(
20    feature = "audio",
21    feature = "stm32h747i_disco",
22    any(target_arch = "arm", target_os = "none")
23))]
24/// Audio player state machine with DMA double-buffering.
25pub mod audio_player;
26#[cfg(all(
27    feature = "audio",
28    feature = "stm32h747i_disco",
29    any(target_arch = "arm", target_os = "none")
30))]
31/// BDMA driver for SAI4 PDM capture (D3 domain, SRAM4 buffers).
32pub mod bdma;
33/// Blitter traits and helpers.
34pub mod blit;
35/// DPR-02 Board Runtime — warm-reset peripheral safe-stop, named boot
36/// sentinels, and the byte-offset layout for the DPR-00 §5.3 reserved
37/// SRAM4 telemetry window. Scaffold — consumer wiring lands under
38/// DPR-02a / DPR-02b per the DPR-01a / DPR-01b precedent.
39pub mod board_runtime;
40/// Dirty-region compositor for framebuffer restoration.
41pub mod compositor;
42/// CPU fallback blitter.
43pub mod cpu_blitter;
44/// Display driver traits and implementations.
45pub mod display;
46#[cfg(all(
47    feature = "stm32h747i_disco",
48    any(target_arch = "arm", target_os = "none")
49))]
50/// Full DSI + LTDC init sequence (raw register, no PAC dependency).
51pub mod display_init;
52#[cfg(all(feature = "dma2d", any(target_arch = "arm", target_os = "none")))]
53pub mod dma2d;
54#[cfg(all(feature = "dma2d", any(target_arch = "arm", target_os = "none")))]
55/// DMA2D-accelerated drawing with rotation for overlay rendering.
56pub mod dma2d_draw;
57#[cfg(all(
58    feature = "audio",
59    feature = "stm32h747i_disco",
60    any(target_arch = "arm", target_os = "none")
61))]
62/// DMA1 driver for SAI1 sub-block A transmit streaming.
63pub mod dma_sai;
64#[cfg(all(
65    feature = "stm32h747i_disco",
66    any(target_arch = "arm", target_os = "none")
67))]
68/// Shared DSI adapted command mode register configuration.
69pub mod dsi_cmd_mode;
70/// Platform-level visual effect primitives ([`Effect`] trait,
71/// [`CrawlParams`] struct).
72pub mod effect;
73/// DPR-01 Frame Scheduler — sole owner of per-frame DSI / LTDC writes
74/// (`DSI_WCR`, `DSI_WIER`, `DSI_WIFCR`, `LTDC_L1CFBAR`, `LTDC_SRCR`)
75/// per DPR-00 INV-DPR-3. Generic over [`frame_scheduler::ScanMode`] and
76/// [`frame_scheduler::Pacing`]. Scaffold — call-site migration lands
77/// under DPR-01a / DPR-01b. Marker types compile on host; the
78/// [`frame_scheduler::FrameScheduler`] constructor still requires the
79/// caller to assert MMIO unaliasing per its `unsafe` contract.
80pub mod frame_scheduler;
81/// Frame synchronization traits for ERIF-based scheduling.
82pub mod frame_sync;
83#[cfg(all(
84    feature = "stm32h747i_disco",
85    any(target_arch = "arm", target_os = "none")
86))]
87pub mod ft5336;
88/// Gesture recognition (debounced tap, press-down/release).
89pub mod gesture;
90/// Hardware-abstraction substrate (address newtypes, framebuffer ownership,
91/// ISR channels, typed register blocks). See the "Register-Mashing
92/// Discipline" section of `CLAUDE.md`.
93pub mod hwcore;
94/// Input device abstractions.
95pub mod input;
96#[cfg(feature = "linux_fbdev")]
97pub mod linux_evdev;
98#[cfg(feature = "linux_fbdev")]
99pub mod linux_fbdev;
100#[cfg(all(
101    feature = "audio",
102    feature = "stm32h747i_disco",
103    any(target_arch = "arm", target_os = "none")
104))]
105/// High-level microphone capture API (SAI4 PDM + BDMA + CIC filter).
106pub mod mic_capture;
107#[cfg(all(
108    feature = "stm32h747i_disco",
109    any(target_arch = "arm", target_os = "none")
110))]
111/// NT35510 MIPI-DSI panel driver for MB1166 Rev A-09.
112pub mod nt35510;
113/// DPR-01 Pacing backends — OS-axis dispatch impls for
114/// [`frame_scheduler::Pacing`]. Hosts the generic [`pacing::FreeRtosPacing`]
115/// scaffold per DPR-01-A §4 phase-2 step 1; the Zephyr backend is
116/// deferred to DPR-01c.
117pub mod pacing;
118#[cfg(all(
119    feature = "audio",
120    feature = "stm32h747i_disco",
121    any(target_arch = "arm", target_os = "none")
122))]
123/// CIC decimation filter for PDM-to-PCM conversion.
124pub mod pdm_filter;
125#[cfg(feature = "simulator")]
126pub mod pixels_renderer;
127#[cfg(all(
128    feature = "stm32h747i_disco",
129    any(target_arch = "arm", target_os = "none")
130))]
131/// QSPI flash driver for MT25TL01G (indirect + memory-mapped modes).
132pub mod qspi_flash;
133#[cfg(all(
134    feature = "audio",
135    feature = "stm32h747i_disco",
136    any(target_arch = "arm", target_os = "none")
137))]
138/// SAI1 serial audio interface driver for I2S playback/recording.
139#[allow(dead_code)]
140pub mod sai;
141#[cfg(all(
142    feature = "audio",
143    feature = "stm32h747i_disco",
144    any(target_arch = "arm", target_os = "none")
145))]
146/// SAI4 PDM interface driver for onboard MP34DT05-A MEMS digital microphone.
147pub mod sai4_pdm;
148/// Display geometry abstraction: logical dimensions + scan rotation.
149pub mod screen;
150#[cfg(all(
151    feature = "stm32h747i_disco",
152    feature = "sd_storage",
153    any(target_arch = "arm", target_os = "none")
154))]
155/// SD card adapter for `embedded-sdmmc` filesystem access.
156pub mod sd_emmc_adapter;
157#[cfg(all(
158    feature = "stm32h747i_disco",
159    feature = "fatfs_nostd",
160    any(target_arch = "arm", target_os = "none")
161))]
162/// No-std FATFS adapter to mount and list assets on SDMMC-backed block devices.
163pub mod sd_fatfs_adapter;
164#[cfg(feature = "simulator")]
165pub mod simulator;
166#[cfg(feature = "ssd1306")]
167pub mod ssd1306;
168#[cfg(feature = "st7789")]
169pub mod st7789;
170#[cfg(all(
171    feature = "stm32h747i_disco",
172    any(target_arch = "arm", target_os = "none")
173))]
174pub mod stm32h747i_disco;
175#[cfg(all(
176    feature = "stm32h747i_disco",
177    any(target_arch = "arm", target_os = "none")
178))]
179pub mod stm32h747i_disco_sd;
180#[cfg(feature = "uefi")]
181pub mod uefi;
182#[cfg(feature = "uefi")]
183/// PlayitTransport implementation over UEFI Serial I/O protocol.
184pub mod uefi_serial_transport;
185#[cfg(all(
186    feature = "audio",
187    feature = "stm32h747i_disco",
188    any(target_arch = "arm", target_os = "none")
189))]
190/// WAV (RIFF) header parser for embedded audio playback.
191pub mod wav;
192#[cfg(feature = "simulator")]
193pub mod wgpu_blitter;
194#[cfg(all(
195    feature = "audio",
196    feature = "stm32h747i_disco",
197    any(target_arch = "arm", target_os = "none")
198))]
199/// WM8994 audio codec driver (I2C control, headphone/speaker output).
200#[allow(dead_code)]
201pub mod wm8994;
202
203#[cfg(feature = "simulator")]
204pub use app_loader::LoadedApp;
205#[cfg(all(
206    feature = "audio",
207    feature = "stm32h747i_disco",
208    any(target_arch = "arm", target_os = "none")
209))]
210pub use audio_player::AudioPlayer;
211pub use blit::{
212    BlitCaps, BlitPlanner, Blitter, BlitterRenderer, PixelFmt, Rect as BlitRect, Surface,
213};
214pub use cpu_blitter::CpuBlitter;
215pub use display::DisplayDriver;
216#[cfg(all(feature = "dma2d", any(target_arch = "arm", target_os = "none")))]
217pub use dma2d::Dma2dBlitter;
218pub use effect::{BlitterSink, CrawlParams, Effect, EffectExt, EffectSink, SubSink};
219#[cfg(all(
220    feature = "stm32h747i_disco",
221    any(target_arch = "arm", target_os = "none")
222))]
223pub use ft5336::Ft5336;
224pub use hwcore::addr::{AddrError, DmaAddr, MmioAddr, PhysAddr};
225pub use hwcore::isr::{IsrChannel, IsrCounter, IsrFlag};
226#[cfg(any(test, feature = "mock_blitter"))]
227pub use hwcore::mock::{MockBlitter, MockOp};
228pub use hwcore::surface::{
229    BackBuffer, BankCollision, BorrowedForDma, FrameBuffer, FrontBuffer, InFlight, Scanout,
230};
231pub use input::{InputDevice, InputEvent};
232#[cfg(feature = "linux_fbdev")]
233pub use linux_evdev::LinuxEvdevInput;
234#[cfg(feature = "linux_fbdev")]
235pub use linux_fbdev::LinuxFbdevDisplay;
236#[cfg(feature = "simulator")]
237pub use pixels_renderer::PixelsRenderer;
238#[cfg(all(
239    feature = "stm32h747i_disco",
240    any(target_arch = "arm", target_os = "none")
241))]
242pub use qspi_flash::{Mt25tlFlash, QspiMemoryMapped};
243pub use rlvgl_core::event::Key;
244#[cfg(all(
245    feature = "audio",
246    feature = "stm32h747i_disco",
247    any(target_arch = "arm", target_os = "none")
248))]
249pub use sai::Sai1Audio;
250pub use screen::{ColorFormat, Rotation, Screen};
251#[cfg(all(
252    feature = "stm32h747i_disco",
253    feature = "sd_storage",
254    any(target_arch = "arm", target_os = "none")
255))]
256pub use sd_emmc_adapter::{DummyTimeSource, SdMmcBlockDev};
257#[cfg(all(
258    feature = "stm32h747i_disco",
259    feature = "fatfs_nostd",
260    any(target_arch = "arm", target_os = "none")
261))]
262pub use sd_fatfs_adapter::{FatfsBlockStream, mount_and_list_assets};
263#[cfg(feature = "simulator")]
264pub use simulator::WgpuDisplay;
265#[cfg(feature = "ssd1306")]
266pub use ssd1306::Ssd1306Display;
267#[cfg(feature = "st7789")]
268pub use st7789::St7789Display;
269#[cfg(all(
270    feature = "stm32h747i_disco",
271    any(target_arch = "arm", target_os = "none")
272))]
273pub use stm32h747i_disco::{Stm32h747iDiscoDisplay, Stm32h747iDiscoInput};
274#[cfg(all(
275    feature = "stm32h747i_disco",
276    any(target_arch = "arm", target_os = "none")
277))]
278pub use stm32h747i_disco_sd::DiscoSdBlockDevice;
279#[cfg(feature = "uefi")]
280pub use uefi::{SyntheticKeyRelease, UefiDisplay, UefiInput};
281#[cfg(feature = "uefi")]
282pub use uefi_serial_transport::UefiSerialTransport;
283#[cfg(all(
284    feature = "audio",
285    feature = "stm32h747i_disco",
286    any(target_arch = "arm", target_os = "none")
287))]
288pub use wav::parse_wav_header;
289#[cfg(feature = "simulator")]
290pub use wgpu_blitter::WgpuBlitter;
291#[cfg(all(
292    feature = "audio",
293    feature = "stm32h747i_disco",
294    any(target_arch = "arm", target_os = "none")
295))]
296pub use wm8994::Wm8994;