refactor: extract shared ESP32-S3 board module

Move common type aliases, peripheral bundles, and init helpers for
ESP32-S3 boards into src/board/esp32s3.rs. Heltec V3 (146->48 lines)
and V4 (155->57 lines) become thin wrappers containing only
board-specific code (Vext GPIO pin, display reset sequence).

Update build.rs to exclude esp32s3.rs from board discovery and
mod.rs.j2 to include the shared module under an ESP feature gate.
This commit is contained in:
swaits committed 2026-03-31 17:31:55 -06:00
1 parent 83a76d4b48
commit 0943274496
6 files changed
+201 -221

No files matched your search

+12 -1
View File
@@ -3,13 +3,24 @@ use owo_colors::OwoColorize;
use std::fs;
fn main() {
// Protocol tests run on the host without a board feature. Cargo doesn't
// expose `cfg(test)` to build scripts, so we rely on an env var set by
// the justfile `test` recipe. See: `just test`
if std::env::var_os("DONGLORA_HOST_TEST").is_some() {
return;
}
let board_dir = "src/board";
let boards: Vec<String> = fs::read_dir(board_dir)
.expect("failed to read src/board directory")
.filter_map(|e| {
let p = e.ok()?.path();
let stem = p.file_stem()?.to_str()?;
if p.is_file() && p.extension()? == "rs" && stem != "mod" && stem != "traits" {
// Exclude non-board files: mod.rs, traits.rs, and platform helpers (esp32s3.rs).
if p.is_file()
&& p.extension()? == "rs"
&& !matches!(stem, "mod" | "traits" | "esp32s3")
{
return Some(p.file_stem()?.to_str()?.to_string());
}
None