commit c4e4fea6b06e3dc79b1cccb05d0e732411f404a4
Author: Daniel Pérez <steew@psi.my.domain>
Date: Sun Jan 11 23:37:26 2026 +0000
diff --git a/fw/RustFM/Cargo.lock b/fw/RustFM/Cargo.lock
index 44e17d5..6a21320 100644
--- a/fw/RustFM/Cargo.lock
+++ b/fw/RustFM/Cargo.lock
@@ -3487 +3487 @@ dependencies = [
"embedded-io-async",
"futures-core",
"futures-sink",
- "heapless",
+ "heapless 0.8.0",
]
[[package]]
@@ -3847 +3847 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454"
dependencies = [
"embassy-executor-timer-queue",
- "heapless",
+ "heapless 0.8.0",
]
[[package]]
@@ -5086 +5088 @@ dependencies = [
"embedded-hal 1.0.0",
"embedded-hal-async",
"embedded-hal-bus",
+ "heapless 0.9.2",
+ "mpu6050-dmp",
"panic-probe",
]
@@ -56618 +56845 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "heapless"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed"
+dependencies = [
+ "hash32",
+ "stable_deref_trait",
+]
+
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
+[[package]]
+name = "libm"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
+
[[package]]
name = "litrs"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
+[[package]]
+name = "mpu6050-dmp"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a75c0c24f43578e6cd3f518f35ab9f17fd95124cc1a66e04143b498cd37eec4"
+dependencies = [
+ "embedded-hal 1.0.0",
+ "embedded-hal-async",
+ "libm",
+]
+
[[package]]
name = "nb"
version = "0.1.3"
diff --git a/fw/RustFM/Cargo.toml b/fw/RustFM/Cargo.toml
index 31f9549..eff8917 100644
--- a/fw/RustFM/Cargo.toml
+++ b/fw/RustFM/Cargo.toml
@@ -216 +217 @@ embedded-hal-bus = { version = "0.1", features = ["async"] }
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
defmt-rtt = "1.1.0"
defmt = "1.0.1"
+heapless = "0.9.2"
[dependencies.embassy-stm32]
version = "0.4.0"
diff --git a/fw/RustFM/src/main.rs b/fw/RustFM/src/main.rs
index 91aaeec..4f488b1 100644
--- a/fw/RustFM/src/main.rs
+++ b/fw/RustFM/src/main.rs
@@ -47 +411 @@
mod mpu;
mod rf;
-use embassy_sync::{blocking_mutex::raw::{CriticalSectionRawMutex, ThreadModeRawMutex}, rwlock::RwLock};
+use embassy_sync::{
+ blocking_mutex::raw::{CriticalSectionRawMutex, ThreadModeRawMutex},
+ rwlock::RwLock,
+};
+
use heapless::pool::arc::Arc;
use mpu::read_mpu;
use mpu::BUFFERED_QUATERNIONS;
@@ -2210 +269 @@ use embassy_stm32::{
};
use embassy_sync::channel::Channel;
-use embassy_sync::blocking_mutex::raw::NoopRawMutex;
+use crate::mpu::telemetry_sender;
use embassy_time::Timer;
-use crate::mpu::{QuaternionDataBuffer, telemetry_sender};
use {defmt_rtt as _, panic_probe as _};
@@ -718 +749 @@ async fn main(spawner: Spawner) {
- static QUATERNION_CHANNEL: Channel::<ThreadModeRawMutex, Quaternion, BUFFERED_QUATERNIONS> = Channel::<ThreadModeRawMutex, Quaternion, BUFFERED_QUATERNIONS>::new();
-
+ static QUATERNION_CHANNEL: Channel<ThreadModeRawMutex, Quaternion, BUFFERED_QUATERNIONS> =
+ Channel::<ThreadModeRawMutex, Quaternion, BUFFERED_QUATERNIONS>::new();
+
diff --git a/fw/RustFM/src/mpu.rs b/fw/RustFM/src/mpu.rs
index 05416f8..124359c 100644
--- a/fw/RustFM/src/mpu.rs
+++ b/fw/RustFM/src/mpu.rs
@@ -57 +511 @@ use embassy_stm32::{
};
-use embassy_sync::{blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex, ThreadModeRawMutex}, channel::{Channel, Receiver, Sender}, rwlock::RwLock};
+use embassy_sync::{
+ blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex, ThreadModeRawMutex},
+ channel::{Channel, Receiver, Sender},
+ rwlock::RwLock,
+};
use embassy_time::{Delay, WithTimeout};
use heapless::pool::arc::Arc;
use mpu6050_dmp::{
@@ -267 +306 @@ struct MotionState {
-
}
pub const BUFFERED_QUATERNIONS: usize = 5;
@@ -4114 +4421 @@ pub async fn telemetry_sender(
- telemetry_port.write(&next_quaternion_value.w.to_le_bytes()).await;
- telemetry_port.write(&next_quaternion_value.x.to_le_bytes()).await;
- telemetry_port.write(&next_quaternion_value.y.to_le_bytes()).await;
- telemetry_port.write(&next_quaternion_value.z.to_le_bytes()).await;
+ telemetry_port
+ .write(&next_quaternion_value.w.to_le_bytes())
+ .await;
+ telemetry_port
+ .write(&next_quaternion_value.x.to_le_bytes())
+ .await;
+ telemetry_port
+ .write(&next_quaternion_value.y.to_le_bytes())
+ .await;
+ telemetry_port
+ .write(&next_quaternion_value.z.to_le_bytes())
+ .await;
}
-
#[embassy_executor::task]
pub async fn read_mpu(
@@ -607 +707 @@ pub async fn read_mpu(
-
+
@@ -737 +837 @@ pub async fn read_mpu(
-
+
@@ -897 +997 @@ pub async fn read_mpu(
-
+