doc fixes and tweaks

This commit is contained in:
Robin Müller 2023-07-09 12:33:34 +02:00
parent 4fdfb20946
commit b9774c4c9f
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 11 additions and 14 deletions

View File

@ -1,8 +1,8 @@
//! Common definitions and helpers required to create PUS TMTC packets according to //! Common definitions and helpers required to create PUS TMTC packets according to
//! [ECSS-E-ST-70-41C](https://ecss.nl/standard/ecss-e-st-70-41c-space-engineering-telemetry-and-telecommand-packet-utilization-15-april-2016/) //! [ECSS-E-ST-70-41C](https://ecss.nl/standard/ecss-e-st-70-41c-space-engineering-telemetry-and-telecommand-packet-utilization-15-april-2016/)
//! //!
//! You can find the PUS telecommand definitions in the [crate::tc] module and ithe PUS telemetry definitions //! You can find the PUS telecommand definitions in the [tc] module and ithe PUS telemetry definitions
//! inside the [crate::tm] module. //! inside the [tm] module.
use crate::{ByteConversionError, CcsdsPacket, CRC_CCITT_FALSE}; use crate::{ByteConversionError, CcsdsPacket, CRC_CCITT_FALSE};
use core::fmt::{Debug, Display, Formatter}; use core::fmt::{Debug, Display, Formatter};
use core::mem::size_of; use core::mem::size_of;

View File

@ -533,7 +533,7 @@ pub mod legacy_tc {
} }
/// This class can be used to create PUS C telecommand packet. It is the primary data structure to /// This class can be used to create PUS C telecommand packet. It is the primary data structure to
/// generate theraw byte representation of a PUS telecommand. /// generate the raw byte representation of a PUS telecommand.
/// ///
/// This class also derives the [serde::Serialize] and [serde::Deserialize] trait if the /// This class also derives the [serde::Serialize] and [serde::Deserialize] trait if the
/// [serde] feature is used, which allows to send around TC packets in a raw byte format using a /// [serde] feature is used, which allows to send around TC packets in a raw byte format using a
@ -757,7 +757,7 @@ pub mod alloc_mod {
use delegate::delegate; use delegate::delegate;
use zerocopy::AsBytes; use zerocopy::AsBytes;
/// This is the owned variant of [PusTcCreator] where the application data is copied to /// This is the owned variant of [super::PusTcCreator] where the application data is copied to
/// an internal field and is then an owned field of the creator. /// an internal field and is then an owned field of the creator.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
@ -778,7 +778,7 @@ pub mod alloc_mod {
/// and subservice type /// and subservice type
/// * `app_data` - Custom application data /// * `app_data` - Custom application data
/// * `set_ccsds_len` - Can be used to automatically update the CCSDS space packet data length /// * `set_ccsds_len` - Can be used to automatically update the CCSDS space packet data length
/// field. If this is not set to true, [PusTc::update_ccsds_data_len] can be called to set /// field. If this is not set to true, [Self::update_ccsds_data_len] can be called to set
/// the correct value to this field manually /// the correct value to this field manually
pub fn new( pub fn new(
sp_header: &mut SpHeader, sp_header: &mut SpHeader,
@ -800,7 +800,7 @@ pub mod alloc_mod {
pus_tc pus_tc
} }
/// Simplified version of the [PusTcCreator::new] function which allows to only specify service /// Simplified version of the [Self::new] function which allows to only specify service
/// and subservice instead of the full PUS TC secondary header. /// and subservice instead of the full PUS TC secondary header.
pub fn new_simple( pub fn new_simple(
sph: &mut SpHeader, sph: &mut SpHeader,
@ -836,7 +836,7 @@ pub mod alloc_mod {
sp_header_impls!(); sp_header_impls!();
/// Calculate the CCSDS space packet data length field and sets it /// Calculate the CCSDS space packet data length field and sets it
/// This is called automatically if the `set_ccsds_len` argument in the [PusTc::new] call was /// This is called automatically if the `set_ccsds_len` argument in the [Self::new] call was
/// used. /// used.
/// If this was not done or the application data is set or changed after construction, /// If this was not done or the application data is set or changed after construction,
/// this function needs to be called to ensure that the data length field of the CCSDS header /// this function needs to be called to ensure that the data length field of the CCSDS header
@ -846,8 +846,8 @@ pub mod alloc_mod {
self.len_packed() as u16 - size_of::<crate::zc::SpHeader>() as u16 - 1; self.len_packed() as u16 - size_of::<crate::zc::SpHeader>() as u16 - 1;
} }
/// This function should be called before the TC packet is serialized if /// This function can be called to calculate the CRC16 of the packet before it was
/// [PusTc::calc_crc_on_serialization] is set to False. It will calculate and cache the CRC16. /// serialized.
pub fn calc_own_crc16(&self) -> u16 { pub fn calc_own_crc16(&self) -> u16 {
let mut digest = CRC_CCITT_FALSE.digest(); let mut digest = CRC_CCITT_FALSE.digest();
let sph_zc = crate::zc::SpHeader::from(self.sp_header); let sph_zc = crate::zc::SpHeader::from(self.sp_header);
@ -935,8 +935,7 @@ pub mod alloc_mod {
} }
} }
/// This class models the PUS C telecommand packet. It is the primary data structure to generate the /// This class can be used to read a PUS TC telecommand from raw memory.
/// raw byte representation of a PUS telecommand or to deserialize from one from raw bytes.
/// ///
/// This class also derives the [serde::Serialize] and [serde::Deserialize] trait if the /// This class also derives the [serde::Serialize] and [serde::Deserialize] trait if the
/// [serde] feature is used, which allows to send around TC packets in a raw byte format using a /// [serde] feature is used, which allows to send around TC packets in a raw byte format using a
@ -946,9 +945,7 @@ pub mod alloc_mod {
/// ///
/// # Lifetimes /// # Lifetimes
/// ///
/// * `'raw_data` - If the TC is not constructed from a raw slice, this will be the life time of /// * `'raw_data` - Lifetime of the provided raw slice.
/// a buffer where the user provided application data will be serialized into. If it
/// is, this is the lifetime of the raw byte slice it is constructed from.
#[derive(Eq, Copy, Clone, Debug)] #[derive(Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct PusTcReader<'raw_data> { pub struct PusTcReader<'raw_data> {