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