#![deny(unsafe_code)]
#![no_std]
#![no_main]
use panic_halt as _;
use nb::block;
use cortex_m_rt::entry;
use cortex_m_semihosting::hprintln;
use stm32f4xx_hal::{gpio::PinState, pac, prelude::*, timer::Timer};
#[entry]
fn main() -> ! {
let cp = cortex_m::Peripherals::take().unwrap();
let dp = pac::Peripherals::take().unwrap();
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.freeze();
let gpioc = dp.GPIOC.split();
let mut pin = gpioc.pc13.into_dynamic();
let mut timer = Timer::syst(cp.SYST, &clocks).counter_us();
timer.start(1.secs()).unwrap();
loop {
pin.make_floating_input();
block!(timer.wait()).unwrap();
hprintln!("{}", pin.is_high().unwrap()).unwrap();
pin.make_push_pull_output_in_state(PinState::High);
block!(timer.wait()).unwrap();
pin.set_low().unwrap();
block!(timer.wait()).unwrap();
}
}