some test code
This commit is contained in:
parent
1ef3e13b3d
commit
ed30bef4aa
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -254,6 +254,7 @@ dependencies = [
|
|||||||
"delegate 0.8.0",
|
"delegate 0.8.0",
|
||||||
"fsrc-core",
|
"fsrc-core",
|
||||||
"spacepackets",
|
"spacepackets",
|
||||||
|
"zerocopy",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -7,6 +7,7 @@ authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
crossbeam-channel = "0.5"
|
crossbeam-channel = "0.5"
|
||||||
delegate = "0.8"
|
delegate = "0.8"
|
||||||
|
zerocopy = "0.6.1"
|
||||||
|
|
||||||
[dependencies.spacepackets]
|
[dependencies.spacepackets]
|
||||||
path = "../spacepackets"
|
path = "../spacepackets"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crossbeam_channel::{bounded, Receiver, Sender};
|
use crossbeam_channel::{bounded, Receiver, Sender};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
use zerocopy::{FromBytes, AsBytes, Unaligned, U16, NetworkEndian};
|
||||||
|
|
||||||
trait FieldDataProvider: Send {
|
trait FieldDataProvider: Send {
|
||||||
fn get_data(&self) -> &[u8];
|
fn get_data(&self) -> &[u8];
|
||||||
@ -26,6 +27,18 @@ impl FieldDataProvider for FixedFieldDataWrapper {
|
|||||||
|
|
||||||
type FieldDataTraitObj = Box<dyn FieldDataProvider>;
|
type FieldDataTraitObj = Box<dyn FieldDataProvider>;
|
||||||
|
|
||||||
|
struct ExampleMgmSet {
|
||||||
|
mgm_vec: [f32; 3],
|
||||||
|
temperature: u16
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(FromBytes, AsBytes, Unaligned)]
|
||||||
|
#[repr(C)]
|
||||||
|
struct ExampleMgmSetZc {
|
||||||
|
mgm_vec: [u8; 12],
|
||||||
|
temperatur: U16<NetworkEndian>
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (s0, r0): (Sender<FieldDataTraitObj>, Receiver<FieldDataTraitObj>) = bounded(5);
|
let (s0, r0): (Sender<FieldDataTraitObj>, Receiver<FieldDataTraitObj>) = bounded(5);
|
||||||
let data_wrapper = FixedFieldDataWrapper::from_two_u32(2, 3);
|
let data_wrapper = FixedFieldDataWrapper::from_two_u32(2, 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user