new mib crate
This commit is contained in:
@ -29,6 +29,10 @@ optional = true
|
||||
version= "0.5"
|
||||
default-features = false
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
default-features = false
|
||||
|
||||
[dependencies.spacepackets]
|
||||
path = "../spacepackets"
|
||||
|
||||
@ -42,8 +46,8 @@ version = "1.0"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["downcast-rs/std", "alloc", "bus", "postcard/use-std", "crossbeam-channel/std"]
|
||||
alloc = []
|
||||
std = ["downcast-rs/std", "alloc", "bus", "postcard/use-std", "crossbeam-channel/std", "serde/std"]
|
||||
alloc = ["serde/alloc"]
|
||||
heapless = []
|
||||
doc-images = []
|
||||
|
||||
|
@ -29,6 +29,6 @@ pub mod params;
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
|
||||
pub mod pool;
|
||||
pub mod pus;
|
||||
pub mod resultcode;
|
||||
pub mod res_code;
|
||||
pub mod seq_count;
|
||||
pub mod tmtc;
|
||||
|
@ -1,7 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use spacepackets::ecss::{EcssEnumU16, EcssEnumeration};
|
||||
use spacepackets::{ByteConversionError, SizeMissmatch};
|
||||
use spacepackets::ecss::{EcssEnumeration, EcssEnumU16};
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct ResultU16 {
|
||||
group_id: u8,
|
||||
unique_id: u8,
|
||||
@ -40,7 +41,7 @@ impl EcssEnumeration for ResultU16 {
|
||||
if buf.len() < 2 {
|
||||
return Err(ByteConversionError::ToSliceTooSmall(SizeMissmatch {
|
||||
found: buf.len(),
|
||||
expected: 2
|
||||
expected: 2,
|
||||
}));
|
||||
}
|
||||
buf[0] = self.group_id;
|
||||
@ -48,20 +49,3 @@ impl EcssEnumeration for ResultU16 {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ResultU16Ext {
|
||||
pub name: &'static str,
|
||||
pub result: &'static ResultU16,
|
||||
pub info: &'static str,
|
||||
}
|
||||
|
||||
impl ResultU16Ext {
|
||||
pub const fn const_new(
|
||||
name: &'static str,
|
||||
result: &'static ResultU16,
|
||||
info: &'static str,
|
||||
) -> Self {
|
||||
Self { name, result, info }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user