nrf52832_pac/radio/
pcnf0.rs1#[doc = "Register `PCNF0` reader"]
2pub struct R(crate::R<PCNF0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PCNF0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PCNF0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PCNF0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PCNF0` writer"]
17pub struct W(crate::W<PCNF0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PCNF0_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<PCNF0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PCNF0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LFLEN` reader - Length on air of LENGTH field in number of bits."]
38pub type LFLEN_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `LFLEN` writer - Length on air of LENGTH field in number of bits."]
40pub type LFLEN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PCNF0_SPEC, u8, u8, 4, O>;
41#[doc = "Field `S0LEN` reader - Length on air of S0 field in number of bytes."]
42pub type S0LEN_R = crate::BitReader<bool>;
43#[doc = "Field `S0LEN` writer - Length on air of S0 field in number of bytes."]
44pub type S0LEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCNF0_SPEC, bool, O>;
45#[doc = "Field `S1LEN` reader - Length on air of S1 field in number of bits."]
46pub type S1LEN_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `S1LEN` writer - Length on air of S1 field in number of bits."]
48pub type S1LEN_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PCNF0_SPEC, u8, u8, 4, O>;
49#[doc = "Field `S1INCL` reader - Include or exclude S1 field in RAM"]
50pub type S1INCL_R = crate::BitReader<S1INCL_A>;
51#[doc = "Include or exclude S1 field in RAM\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq)]
53pub enum S1INCL_A {
54 #[doc = "0: Include S1 field in RAM only if S1LEN > 0"]
55 AUTOMATIC = 0,
56 #[doc = "1: Always include S1 field in RAM independent of S1LEN"]
57 INCLUDE = 1,
58}
59impl From<S1INCL_A> for bool {
60 #[inline(always)]
61 fn from(variant: S1INCL_A) -> Self {
62 variant as u8 != 0
63 }
64}
65impl S1INCL_R {
66 #[doc = "Get enumerated values variant"]
67 #[inline(always)]
68 pub fn variant(&self) -> S1INCL_A {
69 match self.bits {
70 false => S1INCL_A::AUTOMATIC,
71 true => S1INCL_A::INCLUDE,
72 }
73 }
74 #[doc = "Checks if the value of the field is `AUTOMATIC`"]
75 #[inline(always)]
76 pub fn is_automatic(&self) -> bool {
77 *self == S1INCL_A::AUTOMATIC
78 }
79 #[doc = "Checks if the value of the field is `INCLUDE`"]
80 #[inline(always)]
81 pub fn is_include(&self) -> bool {
82 *self == S1INCL_A::INCLUDE
83 }
84}
85#[doc = "Field `S1INCL` writer - Include or exclude S1 field in RAM"]
86pub type S1INCL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCNF0_SPEC, S1INCL_A, O>;
87impl<'a, const O: u8> S1INCL_W<'a, O> {
88 #[doc = "Include S1 field in RAM only if S1LEN > 0"]
89 #[inline(always)]
90 pub fn automatic(self) -> &'a mut W {
91 self.variant(S1INCL_A::AUTOMATIC)
92 }
93 #[doc = "Always include S1 field in RAM independent of S1LEN"]
94 #[inline(always)]
95 pub fn include(self) -> &'a mut W {
96 self.variant(S1INCL_A::INCLUDE)
97 }
98}
99#[doc = "Field `PLEN` reader - Length of preamble on air. Decision point: TASKS_START task"]
100pub type PLEN_R = crate::BitReader<PLEN_A>;
101#[doc = "Length of preamble on air. Decision point: TASKS_START task\n\nValue on reset: 0"]
102#[derive(Clone, Copy, Debug, PartialEq)]
103pub enum PLEN_A {
104 #[doc = "0: 8-bit preamble"]
105 _8BIT = 0,
106 #[doc = "1: 16-bit preamble"]
107 _16BIT = 1,
108}
109impl From<PLEN_A> for bool {
110 #[inline(always)]
111 fn from(variant: PLEN_A) -> Self {
112 variant as u8 != 0
113 }
114}
115impl PLEN_R {
116 #[doc = "Get enumerated values variant"]
117 #[inline(always)]
118 pub fn variant(&self) -> PLEN_A {
119 match self.bits {
120 false => PLEN_A::_8BIT,
121 true => PLEN_A::_16BIT,
122 }
123 }
124 #[doc = "Checks if the value of the field is `_8BIT`"]
125 #[inline(always)]
126 pub fn is_8bit(&self) -> bool {
127 *self == PLEN_A::_8BIT
128 }
129 #[doc = "Checks if the value of the field is `_16BIT`"]
130 #[inline(always)]
131 pub fn is_16bit(&self) -> bool {
132 *self == PLEN_A::_16BIT
133 }
134}
135#[doc = "Field `PLEN` writer - Length of preamble on air. Decision point: TASKS_START task"]
136pub type PLEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, PCNF0_SPEC, PLEN_A, O>;
137impl<'a, const O: u8> PLEN_W<'a, O> {
138 #[doc = "8-bit preamble"]
139 #[inline(always)]
140 pub fn _8bit(self) -> &'a mut W {
141 self.variant(PLEN_A::_8BIT)
142 }
143 #[doc = "16-bit preamble"]
144 #[inline(always)]
145 pub fn _16bit(self) -> &'a mut W {
146 self.variant(PLEN_A::_16BIT)
147 }
148}
149impl R {
150 #[doc = "Bits 0:3 - Length on air of LENGTH field in number of bits."]
151 #[inline(always)]
152 pub fn lflen(&self) -> LFLEN_R {
153 LFLEN_R::new((self.bits & 0x0f) as u8)
154 }
155 #[doc = "Bit 8 - Length on air of S0 field in number of bytes."]
156 #[inline(always)]
157 pub fn s0len(&self) -> S0LEN_R {
158 S0LEN_R::new(((self.bits >> 8) & 1) != 0)
159 }
160 #[doc = "Bits 16:19 - Length on air of S1 field in number of bits."]
161 #[inline(always)]
162 pub fn s1len(&self) -> S1LEN_R {
163 S1LEN_R::new(((self.bits >> 16) & 0x0f) as u8)
164 }
165 #[doc = "Bit 20 - Include or exclude S1 field in RAM"]
166 #[inline(always)]
167 pub fn s1incl(&self) -> S1INCL_R {
168 S1INCL_R::new(((self.bits >> 20) & 1) != 0)
169 }
170 #[doc = "Bit 24 - Length of preamble on air. Decision point: TASKS_START task"]
171 #[inline(always)]
172 pub fn plen(&self) -> PLEN_R {
173 PLEN_R::new(((self.bits >> 24) & 1) != 0)
174 }
175}
176impl W {
177 #[doc = "Bits 0:3 - Length on air of LENGTH field in number of bits."]
178 #[inline(always)]
179 pub fn lflen(&mut self) -> LFLEN_W<0> {
180 LFLEN_W::new(self)
181 }
182 #[doc = "Bit 8 - Length on air of S0 field in number of bytes."]
183 #[inline(always)]
184 pub fn s0len(&mut self) -> S0LEN_W<8> {
185 S0LEN_W::new(self)
186 }
187 #[doc = "Bits 16:19 - Length on air of S1 field in number of bits."]
188 #[inline(always)]
189 pub fn s1len(&mut self) -> S1LEN_W<16> {
190 S1LEN_W::new(self)
191 }
192 #[doc = "Bit 20 - Include or exclude S1 field in RAM"]
193 #[inline(always)]
194 pub fn s1incl(&mut self) -> S1INCL_W<20> {
195 S1INCL_W::new(self)
196 }
197 #[doc = "Bit 24 - Length of preamble on air. Decision point: TASKS_START task"]
198 #[inline(always)]
199 pub fn plen(&mut self) -> PLEN_W<24> {
200 PLEN_W::new(self)
201 }
202 #[doc = "Writes raw bits to the register."]
203 #[inline(always)]
204 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
205 self.0.bits(bits);
206 self
207 }
208}
209#[doc = "Packet configuration register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pcnf0](index.html) module"]
210pub struct PCNF0_SPEC;
211impl crate::RegisterSpec for PCNF0_SPEC {
212 type Ux = u32;
213}
214#[doc = "`read()` method returns [pcnf0::R](R) reader structure"]
215impl crate::Readable for PCNF0_SPEC {
216 type Reader = R;
217}
218#[doc = "`write(|w| ..)` method takes [pcnf0::W](W) writer structure"]
219impl crate::Writable for PCNF0_SPEC {
220 type Writer = W;
221}
222#[doc = "`reset()` method sets PCNF0 to value 0"]
223impl crate::Resettable for PCNF0_SPEC {
224 #[inline(always)]
225 fn reset_value() -> Self::Ux {
226 0
227 }
228}