Compare commits
No commits in common. "800e73e59c38464bbf31b0ce75d946e01aab3c3f" and "02f4cd0de11ad981520684650fcbe844880c9dac" have entirely different histories.
800e73e59c
...
02f4cd0de1
|
@ -6,7 +6,5 @@ edition = "2018"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = "0.6.4"
|
|
||||||
cortex-m-rt = "0.6.13"
|
cortex-m-rt = "0.6.13"
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
stm32f0xx-hal = { version = "0.17.1", features = ["rt", "stm32f072"] }
|
|
||||||
|
|
30
src/main.rs
30
src/main.rs
|
@ -21,36 +21,8 @@
|
||||||
|
|
||||||
use cortex_m_rt::entry;
|
use cortex_m_rt::entry;
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use stm32f0xx_hal::pac::Peripherals;
|
|
||||||
use stm32f0xx_hal::prelude::*;
|
|
||||||
|
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut p = Peripherals::take().unwrap();
|
loop {}
|
||||||
|
|
||||||
let mut rcc = p.RCC.configure().freeze(&mut p.FLASH);
|
|
||||||
|
|
||||||
let gpioa = p.GPIOA.split(&mut rcc);
|
|
||||||
let gpiob = p.GPIOB.split(&mut rcc);
|
|
||||||
|
|
||||||
let (mut led1_b, mut led1_g, mut led1_r, mut led2_g, mut led2_r, mut led2_b) = cortex_m::interrupt::free(|cs| (
|
|
||||||
gpioa.pa0.into_push_pull_output(cs),
|
|
||||||
gpioa.pa1.into_push_pull_output(cs),
|
|
||||||
gpioa.pa2.into_push_pull_output(cs),
|
|
||||||
gpiob.pb0.into_push_pull_output(cs),
|
|
||||||
gpiob.pb1.into_push_pull_output(cs),
|
|
||||||
gpiob.pb5.into_push_pull_output(cs),
|
|
||||||
));
|
|
||||||
led1_r.set_high().ok(); // 0
|
|
||||||
led1_g.set_high().ok(); // 0
|
|
||||||
led1_b.set_low().ok(); // 255
|
|
||||||
// ^ blue
|
|
||||||
led2_r.set_high().ok(); // 0
|
|
||||||
led2_g.set_low().ok(); // 255
|
|
||||||
led2_b.set_low().ok(); // 255
|
|
||||||
// ^ cyan
|
|
||||||
|
|
||||||
loop {
|
|
||||||
cortex_m::asm::nop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue