From 84b5abce09c6f88b7adfb631c6779dc90d96196c Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Wed, 30 Oct 2024 20:54:49 +0100 Subject: [PATCH] platform: move platform lib bits into platform module --- src/TODO.md | 2 ++ src/main.rs | 8 +------- src/{ => platform}/embedded_graphics_lib.rs | 0 src/{platform.rs => platform/mod.rs} | 6 ++++++ src/{ => platform}/smart_leds_lib.rs | 4 ++-- 5 files changed, 11 insertions(+), 9 deletions(-) rename src/{ => platform}/embedded_graphics_lib.rs (100%) rename src/{platform.rs => platform/mod.rs} (54%) rename src/{ => platform}/smart_leds_lib.rs (97%) diff --git a/src/TODO.md b/src/TODO.md index 473dd04..d6c7b66 100644 --- a/src/TODO.md +++ b/src/TODO.md @@ -8,3 +8,5 @@ [ ] Weather [ ] Circadian Rhythm [ ] NTP +[ ] Config to only start a subset of tasks on startup +[ ] Serial CLI diff --git a/src/main.rs b/src/main.rs index ea6f7ef..1b88412 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,23 +18,17 @@ use crate::task::Task; use crate::platform::DisplayInit; use crate::lib8::IntoRgb8; -#[cfg(feature="embedded-graphics")] -mod embedded_graphics_lib; - #[cfg(feature="rmt")] #[cfg(feature="embedded-graphics")] use ws2812_esp32_rmt_driver::lib_embedded_graphics::PonderjarTarget; -#[cfg(feature="smart-leds")] -mod smart_leds_lib; - #[cfg(feature="rmt")] #[cfg(feature="smart-leds")] use ws2812_esp32_rmt_driver::lib_smart_leds::Ws2812Esp32Rmt; #[cfg(feature="spi")] #[cfg(feature="smart-leds")] -use crate::smart_leds_lib::spi::SPIDisplay; +use crate::platform::smart_leds_lib::spi::SPIDisplay; #[cfg(feature="threads")] use crate::render::SharedSurface; diff --git a/src/embedded_graphics_lib.rs b/src/platform/embedded_graphics_lib.rs similarity index 100% rename from src/embedded_graphics_lib.rs rename to src/platform/embedded_graphics_lib.rs diff --git a/src/platform.rs b/src/platform/mod.rs similarity index 54% rename from src/platform.rs rename to src/platform/mod.rs index 1557334..1fc3dbd 100644 --- a/src/platform.rs +++ b/src/platform/mod.rs @@ -1,3 +1,9 @@ +#[cfg(feature="embedded-graphics")] +pub mod embedded_graphics_lib; + +#[cfg(feature="smart-leds")] +pub mod smart_leds_lib; + use crate::render::{Surface, Display}; use crate::task::Task; diff --git a/src/smart_leds_lib.rs b/src/platform/smart_leds_lib.rs similarity index 97% rename from src/smart_leds_lib.rs rename to src/platform/smart_leds_lib.rs index 88cbee2..2ecec97 100644 --- a/src/smart_leds_lib.rs +++ b/src/platform/smart_leds_lib.rs @@ -95,7 +95,7 @@ pub mod rmt { use crate::render::{Display, Surface}; use crate::task::Task; - use crate::smart_leds_lib::SmartLedDisplay; + use crate::platform::smart_leds_lib::SmartLedDisplay; use crate::platform::DisplayInit; impl DisplayInit for Ws2812Esp32Rmt<'_> { @@ -121,7 +121,7 @@ pub mod spi { use crate::render::{Display, Surface}; use crate::task::Task; - use crate::smart_leds_lib::SmartLedDisplay; + use crate::platform::smart_leds_lib::SmartLedDisplay; use esp_idf_svc::hal::{ prelude::*,