udpate imu
This commit is contained in:
parent
687f44d8ba
commit
87d713d37d
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -581,7 +581,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "u5-lib"
|
||||
version = "0.1.0"
|
||||
source = "git+ssh://gitea@git.ggeta.com:2002/guangzong/u5_new.git?branch=dev#bc8db5f8e5b3119434beec539902ad507bfb61b6"
|
||||
source = "git+ssh://gitea@git.ggeta.com:2002/guangzong/u5_new.git?branch=dev#985cbf34c6d9e1fb75cf015f0bcdf8b693fd8b2d"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
@ -606,9 +606,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"critical-section",
|
||||
"defmt",
|
||||
"defmt-itm",
|
||||
"defmt-rtt",
|
||||
"eb_cmds",
|
||||
"embassy-executor",
|
||||
|
26
Cargo.toml
26
Cargo.toml
@ -14,24 +14,15 @@ git-fetch-with-cli = true
|
||||
|
||||
[dependencies]
|
||||
# cortex-m = "0.7.0"
|
||||
cortex-m = { version = "0.7.7", features = [
|
||||
"inline-asm",
|
||||
"critical-section-single-core",
|
||||
]}
|
||||
u5-lib = { git = "ssh://gitea@git.ggeta.com:2002/guangzong/u5_new.git",features = [
|
||||
"stm32u5a5qj",
|
||||
# "memory-x",
|
||||
# "stm32u575zi"
|
||||
], default-features = false, branch = "dev" }
|
||||
cortex-m = { version = "0.7.7"}
|
||||
u5-lib = { git = "ssh://gitea@git.ggeta.com:2002/guangzong/u5_new.git",features = [ "stm32u5a5qj"], default-features = false, branch = "dev" }
|
||||
eb_cmds = { git = "ssh://gitea@git.ggeta.com:2002/guangzong/eb_cmds.git"}
|
||||
critical-section = "1.1.2"
|
||||
#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",
|
||||
]}
|
||||
#defmt-itm = { version = "0.3.0" }
|
||||
futures = { version = "0.3.17", default-features = false, fetures = [ "async-await", ]}
|
||||
cortex-m-rt = { version = "0.7.3" }
|
||||
|
||||
|
||||
@ -49,13 +40,6 @@ git = "https://github.com/embassy-rs/embassy"
|
||||
rev = "35f284e"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [dependencies.stm32-metapac]
|
||||
# path = "../stm32-data/build/stm32-metapac"
|
||||
# features = [ "memory-x", "rt"]
|
||||
|
||||
# disable all optimizations
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
32
src/main.rs
32
src/main.rs
@ -66,6 +66,37 @@ fn setup_camera() -> (gpio::GpioPort, i2c::I2c) {
|
||||
(cam_down, i2c)
|
||||
}
|
||||
|
||||
// pub const $name: GpioPort = GpioPort {
|
||||
// port: $port,
|
||||
// pin: $pin,
|
||||
// alt_func: 0,
|
||||
// mode: Moder::OUTPUT,
|
||||
// ot: Ot::PUSHPULL,
|
||||
// pupd: Pupdr::FLOATING,
|
||||
// };
|
||||
fn setup_imu(i2c: &mut i2c::I2c) {
|
||||
// pa3 to ground
|
||||
let mut pa3 = gpio::PA3;
|
||||
pa3.setup();
|
||||
pa3.set_low();
|
||||
delay_ms(100);
|
||||
defmt::info!("start setup imu");
|
||||
// icm-20948
|
||||
let addr = 0x68 << 1;
|
||||
// read who am i
|
||||
let mut buf = [0u8; 1];
|
||||
let option = i2c::I2cMessage {
|
||||
addr,
|
||||
data: &mut buf,
|
||||
};
|
||||
i2c.write_read(addr, &mut [0u8], &mut buf).unwrap();
|
||||
// i2c.receive(option).unwrap();
|
||||
// i2c.receive(addr, 0x00, &mut buf).unwrap();
|
||||
defmt::info!("imu who am i: {:?}", buf[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
fn setup_led() -> gpio::GpioPort {
|
||||
let green: gpio::GpioPort = gpio::PD15;
|
||||
green.setup();
|
||||
@ -119,6 +150,7 @@ async fn async_main(spawner: Spawner) {
|
||||
let dcmi = set_dcmi();
|
||||
(cam_down, i2c, sd, dcmi)
|
||||
});
|
||||
setup_imu(&mut i2c);
|
||||
|
||||
defmt::info!("usb init finished!");
|
||||
let mut power_on = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user