add mode module with basic defintions

This commit is contained in:
Robin Müller 2023-02-15 00:33:33 +01:00
parent 72e560dd81
commit d960c089fd
3 changed files with 29 additions and 1 deletions

View File

@ -26,6 +26,7 @@ pub mod events;
pub mod executable; pub mod executable;
pub mod hal; pub mod hal;
pub mod hk; pub mod hk;
pub mod mode;
pub mod objects; pub mod objects;
pub mod params; pub mod params;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]

View File

@ -0,0 +1,25 @@
use crate::tmtc::TargetId;
use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ModePair {
mode: u32,
submode: u16,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ModeCommand {
address: TargetId,
mode: ModePair,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ModeRequest {
SetMode(ModeCommand),
ReadMode(TargetId),
AnnounceMode(TargetId),
AnnounceModeRecursive(TargetId),
}

View File

@ -23,10 +23,12 @@ pub use ccsds_distrib::{CcsdsDistributor, CcsdsError, CcsdsPacketHandler};
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub use pus_distrib::{PusDistributor, PusServiceProvider}; pub use pus_distrib::{PusDistributor, PusServiceProvider};
pub type TargetId = u32;
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct AddressableId { pub struct AddressableId {
pub target_id: u32, pub target_id: TargetId,
pub unique_id: u32, pub unique_id: u32,
} }