MCU LED Now turns on!
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -10,12 +10,22 @@ use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch
|
||||
use cortex_m::asm;
|
||||
use cortex_m_rt::entry;
|
||||
use cortex_m_semihosting::hprintln;
|
||||
use stm32f1::stm32f103;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
asm::nop(); // To not have main optimize to abort in release mode, remove when you add code
|
||||
hprintln!("Hello, world!");
|
||||
|
||||
let peripherals = stm32f103::Peripherals::take().unwrap();
|
||||
|
||||
// Enable clock for GPIOA by setting IOPAEN in RCC APB2ENR
|
||||
peripherals.RCC.apb2enr.modify(|_, w| w.iopaen().set_bit());
|
||||
|
||||
peripherals.GPIOA.crl.modify(|_, w| w.mode3().output());
|
||||
peripherals.GPIOA.crl.modify(|_, w| w.cnf3().push_pull());
|
||||
peripherals.GPIOA.odr.modify(|_, w| w.odr3().high());
|
||||
|
||||
loop {
|
||||
// your code goes here
|
||||
asm::nop();
|
||||
|
||||
Reference in New Issue
Block a user