#![no_std] #![no_main] use cortex_m_rt::entry; use defmt::info; use nb::block; use stm32f1xx_hal::{pac, prelude::*, timer::Timer}; use {defmt_rtt as _, panic_probe as _}; #[entry] fn main() -> ! { let cp = cortex_m::Peripherals::take().unwrap(); let dp = pac::Peripherals::take().unwrap(); let mut rcc = dp.RCC.constrain(); let mut gpioa = dp.GPIOA.split(&mut rcc); // TODO: Button wiring: PA0 -> button -> GND let mut timer = Timer::syst(cp.SYST, &rcc.clocks).counter_hz(); timer.start(40.Hz()).unwrap(); let mut last_pressed = false; loop { // TODO: get the current button status // TODO: print a message when the button is pressed and released // Poll at 25ms to avoid too much log spam. block!(timer.wait()).unwrap(); } }