diff --git a/Cargo.lock b/Cargo.lock index 3ea2c46..b9d6035 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -254,6 +254,7 @@ dependencies = [ "delegate 0.8.0", "fsrc-core", "spacepackets", + "zerocopy", ] [[package]] diff --git a/fsrc-example/Cargo.toml b/fsrc-example/Cargo.toml index 8bccc84..853e98e 100644 --- a/fsrc-example/Cargo.toml +++ b/fsrc-example/Cargo.toml @@ -7,6 +7,7 @@ authors = ["Robin Mueller "] [dependencies] crossbeam-channel = "0.5" delegate = "0.8" +zerocopy = "0.6.1" [dependencies.spacepackets] path = "../spacepackets" diff --git a/fsrc-example/src/bin/test.rs b/fsrc-example/src/bin/test.rs index a979878..62577cd 100644 --- a/fsrc-example/src/bin/test.rs +++ b/fsrc-example/src/bin/test.rs @@ -1,5 +1,6 @@ use crossbeam_channel::{bounded, Receiver, Sender}; use std::thread; +use zerocopy::{FromBytes, AsBytes, Unaligned, U16, NetworkEndian}; trait FieldDataProvider: Send { fn get_data(&self) -> &[u8]; @@ -26,6 +27,18 @@ impl FieldDataProvider for FixedFieldDataWrapper { type FieldDataTraitObj = Box; +struct ExampleMgmSet { + mgm_vec: [f32; 3], + temperature: u16 +} + +#[derive(FromBytes, AsBytes, Unaligned)] +#[repr(C)] +struct ExampleMgmSetZc { + mgm_vec: [u8; 12], + temperatur: U16 +} + fn main() { let (s0, r0): (Sender, Receiver) = bounded(5); let data_wrapper = FixedFieldDataWrapper::from_two_u32(2, 3);