addded lvl shifter init

This commit is contained in:
Philipp_EndevourOS 2025-07-27 02:24:29 +02:00
parent 8cb118e0ee
commit 46e207bd2a
3 changed files with 41 additions and 2 deletions

29
Cargo.lock generated
View File

@ -1005,6 +1005,7 @@ dependencies = [
"picoserve",
"smoltcp",
"static_cell",
"ws2812-spi",
]
[[package]]
@ -1472,6 +1473,15 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
[[package]]
name = "rgb"
version = "0.8.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce"
dependencies = [
"bytemuck",
]
[[package]]
name = "riscv"
version = "0.12.1"
@ -1593,6 +1603,15 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "smart-leds-trait"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edeb89c73244414bb0568611690dd095b2358b3fda5bae65ad784806cca00157"
dependencies = [
"rgb",
]
[[package]]
name = "smoltcp"
version = "0.12.0"
@ -1982,6 +2001,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "ws2812-spi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2fd98e2b649252eced2ec3aa8d5048e7d2ac294276b0567939bbf47741f9934"
dependencies = [
"embedded-hal 1.0.0",
"smart-leds-trait",
]
[[package]]
name = "xtensa-lx"
version = "0.12.0"

View File

@ -61,6 +61,7 @@ picoserve = { version = "0.16.0", features = ["embassy", "log"] }
embassy-sync = { version = "0.7.0", features = ["log"] }
ds3231 = "0.3.0"
ws2812-spi = "0.5.1"
[profile.dev]

View File

@ -7,7 +7,8 @@ use esp_hal::{
clock::CpuClock,
timer::{systimer::SystemTimer, timg::TimerGroup},
uart::Uart,
i2c::master::I2c
i2c::master::I2c,
gpio::{Output, OutputConfig}
};
use esp_println::logger::init_logger;
use log::error;
@ -41,12 +42,13 @@ pub async fn hardware_init(spawner: &mut Spawner) -> (Uart<'static, Async>, Stac
let interfaces = wifi::setup_wifi(timer1.timer0, rng, peripherals.WIFI, spawner);
let stack = network::setup_network(network_seed, interfaces.ap, spawner);
init_lvl_shifter(peripherals.GPIO0);
let uart_device = setup_uart(peripherals.UART1, peripherals.GPIO7, peripherals.GPIO6);
let i2c_device = setup_i2c(peripherals.I2C0, peripherals.GPIO22, peripherals.GPIO23);
(uart_device, stack)
}
fn setup_uart(
@ -80,3 +82,10 @@ fn setup_i2c(
}
}
}
// 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();
}