esp32/wifi/
plcp1.rs

1#[doc = "Register `PLCP1%s` reader"]
2pub type R = crate::R<PLCP1_SPEC>;
3#[doc = "Register `PLCP1%s` writer"]
4pub type W = crate::W<PLCP1_SPEC>;
5#[doc = "Field `LEN` reader - Length of packet (in bytes)"]
6pub type LEN_R = crate::FieldReader<u16>;
7#[doc = "Field `LEN` writer - Length of packet (in bytes)"]
8pub type LEN_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
9#[doc = "Field `RATE` reader - Packet rate (see wifi_phy_rate_t)"]
10pub type RATE_R = crate::FieldReader;
11#[doc = "Field `RATE` writer - Packet rate (see wifi_phy_rate_t)"]
12pub type RATE_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13#[doc = "Field `KEY_SLOT_ID` reader - Key slot to use for encryption"]
14pub type KEY_SLOT_ID_R = crate::FieldReader;
15#[doc = "Field `KEY_SLOT_ID` writer - Key slot to use for encryption"]
16pub type KEY_SLOT_ID_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
17#[doc = "Field `IS_80211_N` reader - Bit indicating if this is 802.11n"]
18pub type IS_80211_N_R = crate::BitReader;
19#[doc = "Field `IS_80211_N` writer - Bit indicating if this is 802.11n"]
20pub type IS_80211_N_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `BANDWIDTH` reader - Zero indicates 20MHz and one indicates 40MHz"]
22pub type BANDWIDTH_R = crate::BitReader;
23#[doc = "Field `BANDWIDTH` writer - Zero indicates 20MHz and one indicates 40MHz"]
24pub type BANDWIDTH_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `INTERFACE_ID` reader - ID of the interface this transmission is from"]
26pub type INTERFACE_ID_R = crate::FieldReader;
27#[doc = "Field `INTERFACE_ID` writer - ID of the interface this transmission is from"]
28pub type INTERFACE_ID_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29impl R {
30    #[doc = "Bits 0:11 - Length of packet (in bytes)"]
31    #[inline(always)]
32    pub fn len(&self) -> LEN_R {
33        LEN_R::new((self.bits & 0x0fff) as u16)
34    }
35    #[doc = "Bits 12:16 - Packet rate (see wifi_phy_rate_t)"]
36    #[inline(always)]
37    pub fn rate(&self) -> RATE_R {
38        RATE_R::new(((self.bits >> 12) & 0x1f) as u8)
39    }
40    #[doc = "Bits 17:21 - Key slot to use for encryption"]
41    #[inline(always)]
42    pub fn key_slot_id(&self) -> KEY_SLOT_ID_R {
43        KEY_SLOT_ID_R::new(((self.bits >> 17) & 0x1f) as u8)
44    }
45    #[doc = "Bit 25 - Bit indicating if this is 802.11n"]
46    #[inline(always)]
47    pub fn is_80211_n(&self) -> IS_80211_N_R {
48        IS_80211_N_R::new(((self.bits >> 25) & 1) != 0)
49    }
50    #[doc = "Bit 28 - Zero indicates 20MHz and one indicates 40MHz"]
51    #[inline(always)]
52    pub fn bandwidth(&self) -> BANDWIDTH_R {
53        BANDWIDTH_R::new(((self.bits >> 28) & 1) != 0)
54    }
55    #[doc = "Bits 30:31 - ID of the interface this transmission is from"]
56    #[inline(always)]
57    pub fn interface_id(&self) -> INTERFACE_ID_R {
58        INTERFACE_ID_R::new(((self.bits >> 30) & 3) as u8)
59    }
60}
61#[cfg(feature = "impl-register-debug")]
62impl core::fmt::Debug for R {
63    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64        f.debug_struct("PLCP1")
65            .field("len", &self.len())
66            .field("rate", &self.rate())
67            .field("key_slot_id", &self.key_slot_id())
68            .field("is_80211_n", &self.is_80211_n())
69            .field("bandwidth", &self.bandwidth())
70            .field("interface_id", &self.interface_id())
71            .finish()
72    }
73}
74impl W {
75    #[doc = "Bits 0:11 - Length of packet (in bytes)"]
76    #[inline(always)]
77    pub fn len(&mut self) -> LEN_W<PLCP1_SPEC> {
78        LEN_W::new(self, 0)
79    }
80    #[doc = "Bits 12:16 - Packet rate (see wifi_phy_rate_t)"]
81    #[inline(always)]
82    pub fn rate(&mut self) -> RATE_W<PLCP1_SPEC> {
83        RATE_W::new(self, 12)
84    }
85    #[doc = "Bits 17:21 - Key slot to use for encryption"]
86    #[inline(always)]
87    pub fn key_slot_id(&mut self) -> KEY_SLOT_ID_W<PLCP1_SPEC> {
88        KEY_SLOT_ID_W::new(self, 17)
89    }
90    #[doc = "Bit 25 - Bit indicating if this is 802.11n"]
91    #[inline(always)]
92    pub fn is_80211_n(&mut self) -> IS_80211_N_W<PLCP1_SPEC> {
93        IS_80211_N_W::new(self, 25)
94    }
95    #[doc = "Bit 28 - Zero indicates 20MHz and one indicates 40MHz"]
96    #[inline(always)]
97    pub fn bandwidth(&mut self) -> BANDWIDTH_W<PLCP1_SPEC> {
98        BANDWIDTH_W::new(self, 28)
99    }
100    #[doc = "Bits 30:31 - ID of the interface this transmission is from"]
101    #[inline(always)]
102    pub fn interface_id(&mut self) -> INTERFACE_ID_W<PLCP1_SPEC> {
103        INTERFACE_ID_W::new(self, 30)
104    }
105}
106#[doc = "PLCP1\n\nYou can [`read`](crate::Reg::read) this register and get [`plcp1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`plcp1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct PLCP1_SPEC;
108impl crate::RegisterSpec for PLCP1_SPEC {
109    type Ux = u32;
110}
111#[doc = "`read()` method returns [`plcp1::R`](R) reader structure"]
112impl crate::Readable for PLCP1_SPEC {}
113#[doc = "`write(|w| ..)` method takes [`plcp1::W`](W) writer structure"]
114impl crate::Writable for PLCP1_SPEC {
115    type Safety = crate::Unsafe;
116}
117#[doc = "`reset()` method sets PLCP1%s to value 0"]
118impl crate::Resettable for PLCP1_SPEC {}