Skip to content

Instantly share code, notes, and snippets.

@SamP20
Created March 29, 2020 16:56
Show Gist options
  • Save SamP20/08987a4650362961243e002418b89cb5 to your computer and use it in GitHub Desktop.
Save SamP20/08987a4650362961243e002418b89cb5 to your computer and use it in GitHub Desktop.
Turn on an LED
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::entry;
use stm32f4::stm32f429;
#[entry]
fn main() -> ! {
let mut peripherals = stm32f429::Peripherals::take().unwrap();
let gpiob = &peripherals.GPIOB;
gpiob.moder.modify(|_, w| w.moder0().output());
gpiob.bsrr.write(|w| w.bs0().set_bit());
loop {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment