pub struct Temp {
pub temp_source_id: u8,
/* private fields */
}Expand description
Represents a Temperature packet.
Used to transmit temperature telemetry data from the vehicle to the transmitter. This frame can be used to report temperature readings from various sources on the vehicle, such as motors, ESCs, or the environment.
Fields§
§temp_source_id: u8Identifies the source of the temperature data (e.g., 0 = FC, 1 = Ambient, etc.).
Implementations§
Source§impl Temp
impl Temp
Sourcepub fn new(
temp_source_id: u8,
temperatures: &[i16],
) -> Result<Self, CrsfParsingError>
pub fn new( temp_source_id: u8, temperatures: &[i16], ) -> Result<Self, CrsfParsingError>
Creates a new Temp packet from a slice of temperature values.
The number of temperature values must be 20 or less.
Sourcepub fn temperatures(&self) -> &[i16]
pub fn temperatures(&self) -> &[i16]
Returns the temperature values as a slice.
Trait Implementations§
Source§impl CrsfPacket for Temp
impl CrsfPacket for Temp
Source§const PACKET_TYPE: PacketType = PacketType::Temp
const PACKET_TYPE: PacketType = PacketType::Temp
The CRSF frame type identifier for this packet.
Source§const MIN_PAYLOAD_SIZE: usize = 3usize
const MIN_PAYLOAD_SIZE: usize = 3usize
The minimum expected length of the packet’s payload in bytes.
For fixed-size packets, this is the same as the payload size.
fn to_bytes(&self, buffer: &mut [u8]) -> Result<usize, CrsfParsingError>
Source§fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
Creates a packet instance from a payload byte slice.
The slice is guaranteed to have a length of at least
MIN_PAYLOAD_SIZE.fn validate_buffer_size(&self, buffer: &[u8]) -> Result<(), CrsfParsingError>
impl StructuralPartialEq for Temp
Auto Trait Implementations§
impl Freeze for Temp
impl RefUnwindSafe for Temp
impl Send for Temp
impl Sync for Temp
impl Unpin for Temp
impl UnwindSafe for Temp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more