diff --git a/src/bin/init/mod.rs b/src/bin/init/mod.rs index f5e6b30..302a36e 100644 --- a/src/bin/init/mod.rs +++ b/src/bin/init/mod.rs @@ -48,9 +48,17 @@ pub async fn hardware_init(spawner: &mut Spawner) -> (Uart<'static, Async>, Stac let i2c_device = setup_i2c(peripherals.I2C0, peripherals.GPIO22, peripherals.GPIO23); + //TODO change to get I2C device back / maybe init for each protocol + (uart_device, stack) } +// Initialize the level shifter for the NFC reader and LED (output-enable (OE) input is low, all outputs are placed in the high-impedance (Hi-Z) state) +fn init_lvl_shifter(oe_pin: GPIO0<'static>){ + let mut oe_lvl_shifter = Output::new(oe_pin, esp_hal::gpio::Level::Low, OutputConfig::default()); + oe_lvl_shifter.set_high(); +} + fn setup_uart( uart1: UART1<'static>, uart_rx: GPIO7<'static>, @@ -83,9 +91,14 @@ fn setup_i2c( } } +fn setup_spi_led() { -// Initialize the level shifter for the NFC reader and LED (output-enable (OE) input is low, all outputs are placed in the high-impedance (Hi-Z) state) -fn init_lvl_shifter(oe_pin: GPIO0<'static>){ - let mut oe_lvl_shifter = Output::new(oe_pin, esp_hal::gpio::Level::Low, OutputConfig::default()); - oe_lvl_shifter.set_high(); } + +fn setup_rtc() { + //TODO + //setup rtc with i2c + //setup interrupt for SQW + //setup 24-h alarm +} + diff --git a/src/bin/main.rs b/src/bin/main.rs index d2cd773..40b2ce3 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -28,6 +28,8 @@ mod webserver; type TallyChannel = PubSubChannel; type TallyPublisher = Publisher<'static, NoopRawMutex, TallyID, 8, 2, 1>; +static mut UTC_TIME: u64 = 0; + #[esp_hal_embassy::main] async fn main(mut spawner: Spawner) { let (uart_device, stack) = init::hardware_init(&mut spawner).await;