mirror of
https://github.com/Djeeberjr/fw-anwesenheit.git
synced 2025-10-13 15:06:39 +00:00
return sdcard from hardware init
This commit is contained in:
parent
57ccc0cc8b
commit
cc3605b75d
@ -34,7 +34,7 @@ use log::{debug, error, info};
|
|||||||
|
|
||||||
use crate::FEEDBACK_STATE;
|
use crate::FEEDBACK_STATE;
|
||||||
use crate::init::network;
|
use crate::init::network;
|
||||||
use crate::init::sd_card::setup_sdcard;
|
use crate::init::sd_card::{setup_sdcard, SDCardPersistence};
|
||||||
use crate::init::wifi;
|
use crate::init::wifi;
|
||||||
use crate::store::AttendanceDay;
|
use crate::store::AttendanceDay;
|
||||||
use crate::store::persistence::Persistence;
|
use crate::store::persistence::Persistence;
|
||||||
@ -79,6 +79,7 @@ pub async fn hardware_init(
|
|||||||
SmartLedsAdapterAsync<ConstChannelAccess<esp_hal::rmt::Tx, 0>, LED_BUFFER_SIZE>,
|
SmartLedsAdapterAsync<ConstChannelAccess<esp_hal::rmt::Tx, 0>, LED_BUFFER_SIZE>,
|
||||||
GPIO21<'static>,
|
GPIO21<'static>,
|
||||||
GPIO0<'static>,
|
GPIO0<'static>,
|
||||||
|
SDCardPersistence,
|
||||||
) {
|
) {
|
||||||
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
let peripherals = esp_hal::init(config);
|
let peripherals = esp_hal::init(config);
|
||||||
@ -104,7 +105,7 @@ pub async fn hardware_init(
|
|||||||
|
|
||||||
let i2c_device = setup_i2c(peripherals.I2C0, peripherals.GPIO22, peripherals.GPIO23);
|
let i2c_device = setup_i2c(peripherals.I2C0, peripherals.GPIO22, peripherals.GPIO23);
|
||||||
|
|
||||||
let mut sd_det_gpio = peripherals.GPIO0;
|
let sd_det_gpio = peripherals.GPIO0;
|
||||||
|
|
||||||
let spi_bus = setup_spi(
|
let spi_bus = setup_spi(
|
||||||
peripherals.SPI2,
|
peripherals.SPI2,
|
||||||
@ -119,7 +120,7 @@ pub async fn hardware_init(
|
|||||||
OutputConfig::default(),
|
OutputConfig::default(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut vol_mgr = setup_sdcard(spi_bus, sd_cs_pin);
|
let vol_mgr = setup_sdcard(spi_bus, sd_cs_pin);
|
||||||
|
|
||||||
let buzzer_gpio = peripherals.GPIO21;
|
let buzzer_gpio = peripherals.GPIO21;
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ pub async fn hardware_init(
|
|||||||
led,
|
led,
|
||||||
buzzer_gpio,
|
buzzer_gpio,
|
||||||
sd_det_gpio,
|
sd_det_gpio,
|
||||||
|
vol_mgr,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ type TallyPublisher = Publisher<'static, NoopRawMutex, TallyID, 8, 2, 1>;
|
|||||||
|
|
||||||
#[esp_hal_embassy::main]
|
#[esp_hal_embassy::main]
|
||||||
async fn main(mut spawner: Spawner) {
|
async fn main(mut spawner: Spawner) {
|
||||||
let (uart_device, stack, _i2c, _led, buzzer_gpio, sd_det_gpio) =
|
let (uart_device, stack, _i2c, _led, buzzer_gpio, sd_det_gpio, persistence_layer) =
|
||||||
init::hardware::hardware_init(&mut spawner).await;
|
init::hardware::hardware_init(&mut spawner).await;
|
||||||
|
|
||||||
wait_for_stack_up(stack).await;
|
wait_for_stack_up(stack).await;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user