update
This commit is contained in:
parent
5567293f0c
commit
cc1c3facf3
@ -11,15 +11,11 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
cortex-m = { version = "0.7.7" }
|
cortex-m = { version = "0.7.7" }
|
||||||
aligned = "0.4.2"
|
aligned = "0.4.2"
|
||||||
u5-lib = { path="../u5_new", features = [
|
u5-lib = { path = "../u5_new", features = ["utils"] }
|
||||||
# "stm32u5a5zj",
|
|
||||||
], default-features = false }
|
|
||||||
eb_cmds = { git = "ssh://gitea@git.ggeta.com:2002/guangzong/eb_cmds.git" }
|
eb_cmds = { git = "ssh://gitea@git.ggeta.com:2002/guangzong/eb_cmds.git" }
|
||||||
#critical-section = "1.1.2"
|
|
||||||
|
|
||||||
defmt = "0.3.6"
|
defmt = "0.3.6"
|
||||||
defmt-rtt = { version = "0.4.0" }
|
defmt-rtt = { version = "0.4.0" }
|
||||||
#defmt-itm = { version = "0.3.0" }
|
|
||||||
futures = { version = "0.3.17", default-features = false, fetures = [
|
futures = { version = "0.3.17", default-features = false, fetures = [
|
||||||
"async-await",
|
"async-await",
|
||||||
] }
|
] }
|
||||||
|
27
src/main.rs
27
src/main.rs
@ -3,29 +3,19 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use aligned::Aligned;
|
|
||||||
use defmt::println;
|
|
||||||
|
|
||||||
use defmt_rtt as _;
|
use defmt_rtt as _;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
|
|
||||||
use u5_lib::{
|
use u5_lib::{
|
||||||
*,
|
*,
|
||||||
clock::delay_ms,
|
low_power::{Executor, no_deep_sleep_request},
|
||||||
com_interface::ComInterface,
|
clock, clock::delay_ms, com_interface::ComInterface, exti, gpio, task,
|
||||||
|
i2c, i2c::I2c,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[panic_handler]
|
fn i2c_init() -> I2c {
|
||||||
fn panic(_info: &PanicInfo) -> ! {
|
let i2c_config = i2c::I2cConfig::new(1, 100_000, gpio::I2C1_SCL_PB6, gpio::I2C1_SDA_PB7);
|
||||||
defmt::info!("panic");
|
I2c::new(i2c_config).unwrap()
|
||||||
defmt::error!(
|
|
||||||
"Location file name: {:?}, line: {:?}, col: {:?}",
|
|
||||||
_info.location().unwrap().file(),
|
|
||||||
_info.location().unwrap().line(),
|
|
||||||
_info.location().unwrap().column()
|
|
||||||
);
|
|
||||||
loop {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task]
|
#[task]
|
||||||
@ -38,6 +28,8 @@ async fn async_main(spawner: Spawner) {
|
|||||||
let green: gpio::GpioPort = gpio::PB7;
|
let green: gpio::GpioPort = gpio::PB7;
|
||||||
green.setup();
|
green.setup();
|
||||||
green.set_high();
|
green.set_high();
|
||||||
|
let i2c = i2c_init();
|
||||||
|
panic!("panic");
|
||||||
loop {
|
loop {
|
||||||
exti::EXTI13_PC13.wait_for_raising().await;
|
exti::EXTI13_PC13.wait_for_raising().await;
|
||||||
green.toggle();
|
green.toggle();
|
||||||
@ -45,8 +37,6 @@ async fn async_main(spawner: Spawner) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use low_power::Executor;
|
|
||||||
use u5_lib::low_power::no_deep_sleep_request;
|
|
||||||
|
|
||||||
#[cortex_m_rt::entry]
|
#[cortex_m_rt::entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
@ -54,3 +44,4 @@ fn main() -> ! {
|
|||||||
spawner.spawn(async_main(spawner)).unwrap();
|
spawner.spawn(async_main(spawner)).unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user