Flashing works.

This commit is contained in:
2025-09-27 20:12:13 -04:00
parent 08639679fb
commit c087c2446a
4 changed files with 47 additions and 35 deletions

View File

@@ -1,6 +1,13 @@
#![no_std]
#![no_main]
use embedded_hal::{delay::DelayNs, i2c::I2c as I2cEmbedded};
use esp_backtrace as _;
use esp_hal::{
delay::Delay,
xtensa_lx_rt::entry,
};
/// Represents a reading from the sensor.
pub struct SensorReading<T> {
pub humidity: T,
@@ -111,19 +118,15 @@ impl<I: I2cEmbedded, D: DelayNs> Dht20<I, D> {
}
}
use embedded_hal::{delay::DelayNs, i2c::I2c as I2cEmbedded};
use esp_backtrace as _;
use esp_hal::{
clock::CpuClock,
delay::Delay,
gpio::{Level, Pull},
i2c::master::I2c,
xtensa_lx_rt::entry,
};
use fugit::{ExtU64, HertzU32};
// #[panic_handler]
// fn panic(_: &core::panic::PanicInfo) -> ! {
// loop {}
// }
esp_bootloader_esp_idf::esp_app_desc!();
#[entry]
fn main() -> ! {
let peripherals = esp_hal::init(esp_hal::Config::default());
esp_println::logger::init_logger_from_env();
let mut delay = Delay::new();
@@ -132,8 +135,8 @@ fn main() -> ! {
let i2c_for_dht20 =
esp_hal::i2c::master::I2c::new(peripherals.I2C0, esp_hal::i2c::master::Config::default())
.unwrap()
.with_sda(peripherals.pins.gpio21)
.with_scl(peripherals.pins.gpio22);
.with_sda(peripherals.GPIO21)
.with_scl(peripherals.GPIO22);
let mut dht20 = Dht20::new(i2c_for_dht20, delay);
loop {