-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the PCDU handler is already required
- Loading branch information
Showing
7 changed files
with
338 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod pcdu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use std::{ | ||
collections::HashMap, | ||
sync::{mpsc, Arc, Mutex}, | ||
}; | ||
|
||
use derive_new::new; | ||
use satrs::{ | ||
mode::ModeAndSubmode, | ||
power::SwitchState, | ||
pus::EcssTmSender, | ||
request::{GenericMessage, UniqueApidTargetId}, | ||
}; | ||
use satrs_example::TimestampHelper; | ||
|
||
use crate::{acs::mgm::MpscModeLeafInterface, pus::hk::HkReply, requests::CompositeRequest}; | ||
|
||
pub trait SerialInterface {} | ||
|
||
#[derive(Copy, Clone, PartialEq, Eq, Hash)] | ||
#[repr(u32)] | ||
pub enum SwitchId { | ||
Mgm0 = 0, | ||
Mgt = 1, | ||
} | ||
|
||
pub type SwitchMap = HashMap<SwitchId, SwitchState>; | ||
|
||
/// Example PCDU device handler. | ||
#[derive(new)] | ||
#[allow(clippy::too_many_arguments)] | ||
pub struct PcduHandler<ComInterface: SerialInterface, TmSender: EcssTmSender> { | ||
id: UniqueApidTargetId, | ||
dev_str: &'static str, | ||
mode_interface: MpscModeLeafInterface, | ||
composite_request_rx: mpsc::Receiver<GenericMessage<CompositeRequest>>, | ||
hk_reply_tx: mpsc::Sender<GenericMessage<HkReply>>, | ||
tm_sender: TmSender, | ||
pub com_interface: ComInterface, | ||
shared_switch_map: Arc<Mutex<SwitchMap>>, | ||
#[new(value = "ModeAndSubmode::new(satrs_example::DeviceMode::Off as u32, 0)")] | ||
mode_and_submode: ModeAndSubmode, | ||
#[new(default)] | ||
stamp_helper: TimestampHelper, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
mod acs; | ||
mod eps; | ||
mod events; | ||
mod hk; | ||
mod interface; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.