//! Template project for Rust on ESP32 (`no_std`) based on [`esp-hal`](https://github.com/esp-rs/esp-hal)
//!
//! Useful resources:
//! - [The Rust on ESP Book](https://docs.esp-rs.org/book/)
//! - [Embedded Rust (no_std) on Espressif](https://docs.esp-rs.org/no_std-training/)
//! - [Matrix channel](https://matrix.to/#/#esp-rs:matrix.org)
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_hal::{clock::CpuClock, delay::Delay, main};
use esp_hal::gpio::{Input, Pull};
use log::info;
#[main]
fn main() -> ! {
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
let peripherals = esp_hal::init(config);
let delay = Delay::new();
esp_println::logger::init_logger_from_env();
let button = Input::new(peripherals.GPIO23, Pull::Up);
loop {
if button.is_low() {
info!("PRESSED!");
}
delay.delay_millis(500);
}
}