Skip to content

Commit

Permalink
Implemented initial sansio code
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Jan 16, 2023
1 parent 6df3d4c commit b8ca76c
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 24 deletions.
61 changes: 61 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions firmware/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions firmware/src/networking/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub use self::packets::Packets;

use defmt::debug;
use embassy_executor::task;
use embassy_futures::select::select;
use firmware_protocol::{
BoardType, CbPacket, ImuType, McuType, SbPacket, SensorDataType, SensorStatus,
};
Expand All @@ -30,6 +31,13 @@ pub async fn control_task(
}

async fn do_work(packets: &Packets, quat: &Unreliable<Quat>) {
let event = select(packets.clientbound.recv(), quat.wait()).await;
use embassy_futures::select::Either;
match event {
Either::First(cb_packet) => todo!(),
Either::Second(quat) => todo!(),
}

match packets.clientbound.recv().await {
// Identify ourself when discovery packet is received
CbPacket::Discovery => {
Expand Down
5 changes: 5 additions & 0 deletions networking/firmware_protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ edition = "2021"

[dependencies]
deku = { version = "0.15", default-features = false, features = ["alloc"] }
heapless = { version = "0.7", default-features = false }
replace_with = { version = "0.1", default-features = false }
derive_more = "0.99"

# We support multiple versions of nalgebra since it changes so much.
nalgebra031 = { package = "nalgebra", version = "0.31", default-features = false, optional = true }
nalgebra030 = { package = "nalgebra", version = "0.30", default-features = false, optional = true }


[dev-dependencies]
nalgebra031 = { package = "nalgebra", version = "0.31" }
nalgebra030 = { package = "nalgebra", version = "0.30" }
6 changes: 3 additions & 3 deletions networking/firmware_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use deku::prelude::*;
#[derive(Debug, PartialEq, DekuRead, DekuWrite)]
#[deku(endian = "e", ctx = "e: deku::ctx::Endian")]
pub struct SlimeQuaternion {
pub i: f32,
pub j: f32,
pub k: f32,
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}

Expand Down
Loading

0 comments on commit b8ca76c

Please sign in to comment.