it's alive
This commit is contained in:
@ -7,6 +7,7 @@ version = "0.1.0"
|
||||
[features]
|
||||
default = [
|
||||
"defmt-default",
|
||||
"f429",
|
||||
]
|
||||
defmt-default = []
|
||||
defmt-trace = []
|
||||
@ -15,23 +16,23 @@ defmt-info = []
|
||||
defmt-warn = []
|
||||
defmt-error = []
|
||||
|
||||
stm32f401 = ["embassy-stm32/stm32f401"]
|
||||
stm32f405 = ["embassy-stm32/stm32f405"]
|
||||
stm32f407 = ["embassy-stm32/stm32f407"]
|
||||
stm32f410 = ["embassy-stm32/stm32f410"]
|
||||
stm32f411 = ["embassy-stm32/stm32f411"]
|
||||
stm32f412 = ["embassy-stm32/stm32f412"]
|
||||
stm32f413 = ["embassy-stm32/stm32f413"]
|
||||
stm32f415 = ["embassy-stm32/stm32f405"]
|
||||
stm32f417 = ["embassy-stm32/stm32f407"]
|
||||
stm32f423 = ["embassy-stm32/stm32f413"]
|
||||
stm32f427 = ["embassy-stm32/stm32f427"]
|
||||
stm32f429 = ["embassy-stm32/stm32f429"]
|
||||
stm32f437 = ["embassy-stm32/stm32f427"]
|
||||
stm32f439 = ["embassy-stm32/stm32f429"]
|
||||
stm32f446 = ["embassy-stm32/stm32f446"]
|
||||
stm32f469 = ["embassy-stm32/stm32f469"]
|
||||
stm32f479 = ["embassy-stm32/stm32f469"]
|
||||
f401 = ["embassy-stm32/f401"]
|
||||
f405 = ["embassy-stm32/f405"]
|
||||
f407 = ["embassy-stm32/f407"]
|
||||
f410 = ["embassy-stm32/f410"]
|
||||
f411 = ["embassy-stm32/f411"]
|
||||
f412 = ["embassy-stm32/f412"]
|
||||
f413 = ["embassy-stm32/f413"]
|
||||
f415 = ["embassy-stm32/f405"]
|
||||
f417 = ["embassy-stm32/f407"]
|
||||
f423 = ["embassy-stm32/f413"]
|
||||
f427 = ["embassy-stm32/f427"]
|
||||
f429 = ["embassy-stm32/f429"]
|
||||
f437 = ["embassy-stm32/f427"]
|
||||
f439 = ["embassy-stm32/f429"]
|
||||
f446 = ["embassy-stm32/f446"]
|
||||
f469 = ["embassy-stm32/f469"]
|
||||
f479 = ["embassy-stm32/f469"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
@ -39,6 +40,7 @@ embassy = { version = "0.1.0", path = "../embassy", features = ["defmt", "defmt-
|
||||
embassy-traits = { version = "0.1.0", path = "../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" }
|
||||
embassy-extras = {version = "0.1.0", path = "../embassy-extras" }
|
||||
stm32f4 = { version = "0.13", features = ["stm32f429"] }
|
||||
|
||||
defmt = "0.2.0"
|
||||
defmt-rtt = "0.2.0"
|
||||
@ -49,5 +51,3 @@ embedded-hal = { version = "0.2.4" }
|
||||
panic-probe = "0.1.0"
|
||||
futures = { version = "0.3.8", default-features = false, features = ["async-await"] }
|
||||
rtt-target = { version = "0.3", features = ["cortex-m"] }
|
||||
bxcan = "0.5.0"
|
||||
usb-device = "0.2.7"
|
||||
|
52
embassy-stm32-examples/src/bin/blinky.rs
Normal file
52
embassy-stm32-examples/src/bin/blinky.rs
Normal file
@ -0,0 +1,52 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(min_type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_bindings)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
#[path = "../example_common.rs"]
|
||||
mod example_common;
|
||||
use embassy_stm32::gpio::{Level, Output};
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
use example_common::*;
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
use stm32f4::stm32f429 as pac;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
info!("Hello World!");
|
||||
|
||||
let pp = pac::Peripherals::take().unwrap();
|
||||
|
||||
pp.DBGMCU.cr.modify(|_, w| {
|
||||
w.dbg_sleep().set_bit();
|
||||
w.dbg_standby().set_bit();
|
||||
w.dbg_stop().set_bit()
|
||||
});
|
||||
pp.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
|
||||
|
||||
pp.RCC.ahb1enr.modify(|_, w| {
|
||||
w.gpioaen().enabled();
|
||||
w.gpioben().enabled();
|
||||
w.gpiocen().enabled();
|
||||
w.gpioden().enabled();
|
||||
w.gpioeen().enabled();
|
||||
w.gpiofen().enabled();
|
||||
w
|
||||
});
|
||||
|
||||
let p = embassy_stm32::Peripherals::take().unwrap();
|
||||
let mut led = Output::new(p.PB7, Level::High);
|
||||
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high().unwrap();
|
||||
cortex_m::asm::delay(1_000_000);
|
||||
|
||||
info!("low");
|
||||
led.set_low().unwrap();
|
||||
cortex_m::asm::delay(1_000_000);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(min_type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_bindings)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
#[path = "../example_common.rs"]
|
||||
mod example_common;
|
||||
use example_common::*;
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
use embassy_stm32::hal::prelude::*;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
info!("Hello World!");
|
||||
|
||||
let p = embassy_stm32::pac::Peripherals::take().unwrap();
|
||||
|
||||
p.DBGMCU.cr.modify(|_, w| {
|
||||
w.dbg_sleep().set_bit();
|
||||
w.dbg_standby().set_bit();
|
||||
w.dbg_stop().set_bit()
|
||||
});
|
||||
p.RCC.ahb1enr.modify(|_, w| w.dma1en().enabled());
|
||||
|
||||
let gpioa = p.GPIOA.split();
|
||||
let gpioc = p.GPIOC.split();
|
||||
|
||||
let mut led = gpioc.pc13.into_push_pull_output();
|
||||
let button = gpioa.pa0.into_pull_up_input();
|
||||
led.set_low().unwrap();
|
||||
|
||||
loop {
|
||||
if button.is_high().unwrap() {
|
||||
led.set_low().unwrap();
|
||||
} else {
|
||||
led.set_high().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user