2024-10-20 17:23:13 +02:00
|
|
|
mod power;
|
|
|
|
mod lib8;
|
2024-10-27 11:19:26 +01:00
|
|
|
mod render;
|
|
|
|
mod task;
|
|
|
|
mod time;
|
2024-10-27 15:14:28 +01:00
|
|
|
mod geometry;
|
2024-10-30 19:52:02 +01:00
|
|
|
mod platform;
|
2024-10-30 21:55:15 +01:00
|
|
|
mod animations;
|
2024-11-16 11:49:10 +01:00
|
|
|
mod mappings;
|
2024-10-30 19:52:02 +01:00
|
|
|
|
2024-10-30 20:48:00 +01:00
|
|
|
use crate::platform::DisplayInit;
|
2024-10-30 21:56:03 +01:00
|
|
|
use crate::render::Surfaces;
|
2024-10-30 20:48:00 +01:00
|
|
|
|
2024-10-30 19:52:02 +01:00
|
|
|
#[cfg(feature="embedded-graphics")]
|
|
|
|
#[cfg(feature="rmt")]
|
2024-10-30 21:56:03 +01:00
|
|
|
use crate::platform::embedded_graphics_lib::PonderjarTarget as DisplayType;
|
|
|
|
|
2024-10-30 19:52:02 +01:00
|
|
|
#[cfg(feature="smart-leds")]
|
2024-10-30 21:56:03 +01:00
|
|
|
#[cfg(feature="rmt")]
|
|
|
|
use ws2812_esp32_rmt_driver::lib_smart_leds::Ws2812Esp32Rmt as DisplayType;
|
2024-10-30 19:52:02 +01:00
|
|
|
|
|
|
|
#[cfg(feature="smart-leds")]
|
2024-10-30 21:56:03 +01:00
|
|
|
#[cfg(feature="spi")]
|
|
|
|
use crate::platform::smart_leds_lib::spi::SPIDisplay as DisplayType;
|
2024-10-27 11:19:26 +01:00
|
|
|
|
2024-10-30 19:59:19 +01:00
|
|
|
#[cfg(feature="threads")]
|
2024-10-30 21:56:03 +01:00
|
|
|
use crate::render::SharedSurface as SurfaceType;
|
2024-10-30 19:59:19 +01:00
|
|
|
|
|
|
|
#[cfg(not(feature="threads"))]
|
2024-10-30 21:56:03 +01:00
|
|
|
use crate::render::SimpleSurface as SurfaceType;
|
2024-10-27 15:14:28 +01:00
|
|
|
|
2024-11-02 15:22:37 +01:00
|
|
|
use crate::render::Renderer;
|
|
|
|
|
2024-10-20 17:22:27 +02:00
|
|
|
fn main() {
|
|
|
|
// It is necessary to call this function once. Otherwise some patches to the runtime
|
|
|
|
// implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71
|
|
|
|
esp_idf_svc::sys::link_patches();
|
|
|
|
|
|
|
|
// Bind the log crate to the ESP Logging facilities
|
|
|
|
esp_idf_svc::log::EspLogger::initialize_default();
|
|
|
|
|
2024-10-27 11:19:26 +01:00
|
|
|
log::info!("Setting up display");
|
2024-10-30 19:52:02 +01:00
|
|
|
|
2024-10-30 21:56:03 +01:00
|
|
|
let mut display = DisplayType::new_display::<SurfaceType>();
|
2024-10-27 11:19:26 +01:00
|
|
|
|
2024-11-02 15:22:37 +01:00
|
|
|
log::info!("Created new display type {}", core::any::type_name_of_val(&display));
|
|
|
|
|
2024-10-27 11:19:26 +01:00
|
|
|
log::info!("Creating runner");
|
|
|
|
let mut runner = task::Scheduler::new(vec![
|
2024-10-30 21:55:15 +01:00
|
|
|
Box::new(animations::IdleTask::new(display.new_surface().unwrap())),
|
|
|
|
Box::new(animations::TestPattern::new(display.new_surface().unwrap())),
|
2024-11-02 15:22:37 +01:00
|
|
|
Box::new(Renderer::new(display)),
|
2024-10-27 11:19:26 +01:00
|
|
|
]);
|
|
|
|
|
2024-11-02 15:22:37 +01:00
|
|
|
log::info!("Runner ready: {:?}", runner);
|
|
|
|
|
2024-10-27 11:19:26 +01:00
|
|
|
log::info!("Ready to rock and roll");
|
2024-10-20 17:22:27 +02:00
|
|
|
loop {
|
2024-10-27 11:19:26 +01:00
|
|
|
runner.tick();
|
2024-10-20 17:22:27 +02:00
|
|
|
}
|
|
|
|
}
|