stm32_eth/dma/
packet_id.rs1#[cfg_attr(
7 feature = "ptp",
8 doc = "
9The main use is obtaining timestamps for frames using [`EthernetDMA::poll_timestamp`](crate::EthernetDMA::poll_timestamp)
10"
11)]
12#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Debug, PartialEq, Clone)]
14pub struct PacketId(pub u32);
15
16impl PacketId {
17 pub const INIT: Option<Self> = None;
19}
20
21impl From<u32> for PacketId {
22 fn from(value: u32) -> Self {
23 Self(value)
24 }
25}
26
27#[cfg(all(feature = "ptp", feature = "smoltcp-phy"))]
28impl From<smoltcp::phy::PacketMeta> for PacketId {
29 fn from(value: smoltcp::phy::PacketMeta) -> Self {
30 Self(value.id)
31 }
32}
33
34#[cfg(all(feature = "ptp", feature = "smoltcp-phy"))]
35impl From<PacketId> for smoltcp::phy::PacketMeta {
36 fn from(value: PacketId) -> Self {
37 let mut meta = smoltcp::phy::PacketMeta::default();
38 meta.id = value.0;
39 meta
40 }
41}