#![no_main]
#![no_std]
use panic_halt as _;
use cortex_m_rt::entry;
use stm32f4xx_hal as hal;
use crate::hal::{pac, prelude::*};
use core::fmt::Write;
#[entry]
fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
let gpioa = dp.GPIOA.split();
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.use_hse(25.MHz()).freeze();
let mut delay = dp.TIM1.delay_ms(&clocks);
let tx_pin = gpioa.pa9.into_alternate();
let mut tx = dp.USART1.tx(tx_pin, 9600.bps(), &clocks).unwrap();
let mut value: u8 = 0;
loop {
writeln!(tx, "value: {:02}\r", value).unwrap();
value = value.wrapping_add(1);
delay.delay(2.secs());
}
}