tasks: implement a task for writing measurement straems to the SD card

This commit is contained in:
2026-03-14 12:19:24 +01:00
parent 462de0af99
commit f8e53e85a7
3 changed files with 155 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ async fn main(spawner: Spawner) {
static MOTION_BUS: StaticCell<Channel<CriticalSectionRawMutex,Measurement,5> > = StaticCell::new();
let motion_bus = MOTION_BUS.init_with(|| { Channel::new() });
static RECORDING_BUS: StaticCell<PubSubChannel<CriticalSectionRawMutex,Measurement,1, 1, 1> > = StaticCell::new();
static RECORDING_BUS: StaticCell<PubSubChannel<CriticalSectionRawMutex,Measurement,1, 2, 1> > = StaticCell::new();
let recording_bus = RECORDING_BUS.init_with(|| { PubSubChannel::new() });
info!("Setting up rendering pipeline");
@@ -114,6 +114,16 @@ async fn main(spawner: Spawner) {
let mut io = esp_hal::gpio::Io::new(peripherals.IO_MUX);
io.set_interrupt_handler(gpio_interrupt_handler);
spawner.must_spawn(renderbug_bike::tasks::sd_card::sdcard_task(
peripherals.SPI3.degrade(),
peripherals.GPIO41.degrade(),
peripherals.GPIO2.degrade(),
peripherals.GPIO1.degrade(),
Output::new(peripherals.GPIO40.degrade(), esp_hal::gpio::Level::High, OutputConfig::default()),
sd_detect_interrupt,
recording_bus.dyn_subscriber().unwrap()
));
#[cfg(feature="i2c")]
{
use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice;