nrf52811_pac/radio/
dfectrl1.rs

1#[doc = "Register `DFECTRL1` reader"]
2pub struct R(crate::R<DFECTRL1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DFECTRL1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DFECTRL1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DFECTRL1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DFECTRL1` writer"]
17pub struct W(crate::W<DFECTRL1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DFECTRL1_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<DFECTRL1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DFECTRL1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `NUMBEROF8US` reader - Length of the AoA/AoD procedure in number of 8 us units"]
38pub type NUMBEROF8US_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `NUMBEROF8US` writer - Length of the AoA/AoD procedure in number of 8 us units"]
40pub type NUMBEROF8US_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DFECTRL1_SPEC, u8, u8, 6, O>;
41#[doc = "Field `DFEINEXTENSION` reader - Add CTE extension and do antenna switching/sampling in this extension"]
42pub type DFEINEXTENSION_R = crate::BitReader<DFEINEXTENSION_A>;
43#[doc = "Add CTE extension and do antenna switching/sampling in this extension\n\nValue on reset: 1"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45pub enum DFEINEXTENSION_A {
46    #[doc = "1: AoA/AoD procedure triggered at end of CRC"]
47    CRC = 1,
48    #[doc = "0: Antenna switching/sampling is done in the packet payload"]
49    PAYLOAD = 0,
50}
51impl From<DFEINEXTENSION_A> for bool {
52    #[inline(always)]
53    fn from(variant: DFEINEXTENSION_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl DFEINEXTENSION_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> DFEINEXTENSION_A {
61        match self.bits {
62            true => DFEINEXTENSION_A::CRC,
63            false => DFEINEXTENSION_A::PAYLOAD,
64        }
65    }
66    #[doc = "Checks if the value of the field is `CRC`"]
67    #[inline(always)]
68    pub fn is_crc(&self) -> bool {
69        *self == DFEINEXTENSION_A::CRC
70    }
71    #[doc = "Checks if the value of the field is `PAYLOAD`"]
72    #[inline(always)]
73    pub fn is_payload(&self) -> bool {
74        *self == DFEINEXTENSION_A::PAYLOAD
75    }
76}
77#[doc = "Field `DFEINEXTENSION` writer - Add CTE extension and do antenna switching/sampling in this extension"]
78pub type DFEINEXTENSION_W<'a, const O: u8> =
79    crate::BitWriter<'a, u32, DFECTRL1_SPEC, DFEINEXTENSION_A, O>;
80impl<'a, const O: u8> DFEINEXTENSION_W<'a, O> {
81    #[doc = "AoA/AoD procedure triggered at end of CRC"]
82    #[inline(always)]
83    pub fn crc(self) -> &'a mut W {
84        self.variant(DFEINEXTENSION_A::CRC)
85    }
86    #[doc = "Antenna switching/sampling is done in the packet payload"]
87    #[inline(always)]
88    pub fn payload(self) -> &'a mut W {
89        self.variant(DFEINEXTENSION_A::PAYLOAD)
90    }
91}
92#[doc = "Field `TSWITCHSPACING` reader - Interval between every time the antenna is changed in the SWITCHING state"]
93pub type TSWITCHSPACING_R = crate::FieldReader<u8, TSWITCHSPACING_A>;
94#[doc = "Interval between every time the antenna is changed in the SWITCHING state\n\nValue on reset: 2"]
95#[derive(Clone, Copy, Debug, PartialEq)]
96#[repr(u8)]
97pub enum TSWITCHSPACING_A {
98    #[doc = "1: 4us"]
99    _4US = 1,
100    #[doc = "2: 2us"]
101    _2US = 2,
102    #[doc = "3: 1us"]
103    _1US = 3,
104}
105impl From<TSWITCHSPACING_A> for u8 {
106    #[inline(always)]
107    fn from(variant: TSWITCHSPACING_A) -> Self {
108        variant as _
109    }
110}
111impl TSWITCHSPACING_R {
112    #[doc = "Get enumerated values variant"]
113    #[inline(always)]
114    pub fn variant(&self) -> Option<TSWITCHSPACING_A> {
115        match self.bits {
116            1 => Some(TSWITCHSPACING_A::_4US),
117            2 => Some(TSWITCHSPACING_A::_2US),
118            3 => Some(TSWITCHSPACING_A::_1US),
119            _ => None,
120        }
121    }
122    #[doc = "Checks if the value of the field is `_4US`"]
123    #[inline(always)]
124    pub fn is_4us(&self) -> bool {
125        *self == TSWITCHSPACING_A::_4US
126    }
127    #[doc = "Checks if the value of the field is `_2US`"]
128    #[inline(always)]
129    pub fn is_2us(&self) -> bool {
130        *self == TSWITCHSPACING_A::_2US
131    }
132    #[doc = "Checks if the value of the field is `_1US`"]
133    #[inline(always)]
134    pub fn is_1us(&self) -> bool {
135        *self == TSWITCHSPACING_A::_1US
136    }
137}
138#[doc = "Field `TSWITCHSPACING` writer - Interval between every time the antenna is changed in the SWITCHING state"]
139pub type TSWITCHSPACING_W<'a, const O: u8> =
140    crate::FieldWriter<'a, u32, DFECTRL1_SPEC, u8, TSWITCHSPACING_A, 3, O>;
141impl<'a, const O: u8> TSWITCHSPACING_W<'a, O> {
142    #[doc = "4us"]
143    #[inline(always)]
144    pub fn _4us(self) -> &'a mut W {
145        self.variant(TSWITCHSPACING_A::_4US)
146    }
147    #[doc = "2us"]
148    #[inline(always)]
149    pub fn _2us(self) -> &'a mut W {
150        self.variant(TSWITCHSPACING_A::_2US)
151    }
152    #[doc = "1us"]
153    #[inline(always)]
154    pub fn _1us(self) -> &'a mut W {
155        self.variant(TSWITCHSPACING_A::_1US)
156    }
157}
158#[doc = "Field `TSAMPLESPACINGREF` reader - Interval between samples in the REFERENCE period"]
159pub type TSAMPLESPACINGREF_R = crate::FieldReader<u8, TSAMPLESPACINGREF_A>;
160#[doc = "Interval between samples in the REFERENCE period\n\nValue on reset: 3"]
161#[derive(Clone, Copy, Debug, PartialEq)]
162#[repr(u8)]
163pub enum TSAMPLESPACINGREF_A {
164    #[doc = "1: 4us"]
165    _4US = 1,
166    #[doc = "2: 2us"]
167    _2US = 2,
168    #[doc = "3: 1us"]
169    _1US = 3,
170    #[doc = "4: 0.5us"]
171    _500NS = 4,
172    #[doc = "5: 0.25us"]
173    _250NS = 5,
174    #[doc = "6: 0.125us"]
175    _125NS = 6,
176}
177impl From<TSAMPLESPACINGREF_A> for u8 {
178    #[inline(always)]
179    fn from(variant: TSAMPLESPACINGREF_A) -> Self {
180        variant as _
181    }
182}
183impl TSAMPLESPACINGREF_R {
184    #[doc = "Get enumerated values variant"]
185    #[inline(always)]
186    pub fn variant(&self) -> Option<TSAMPLESPACINGREF_A> {
187        match self.bits {
188            1 => Some(TSAMPLESPACINGREF_A::_4US),
189            2 => Some(TSAMPLESPACINGREF_A::_2US),
190            3 => Some(TSAMPLESPACINGREF_A::_1US),
191            4 => Some(TSAMPLESPACINGREF_A::_500NS),
192            5 => Some(TSAMPLESPACINGREF_A::_250NS),
193            6 => Some(TSAMPLESPACINGREF_A::_125NS),
194            _ => None,
195        }
196    }
197    #[doc = "Checks if the value of the field is `_4US`"]
198    #[inline(always)]
199    pub fn is_4us(&self) -> bool {
200        *self == TSAMPLESPACINGREF_A::_4US
201    }
202    #[doc = "Checks if the value of the field is `_2US`"]
203    #[inline(always)]
204    pub fn is_2us(&self) -> bool {
205        *self == TSAMPLESPACINGREF_A::_2US
206    }
207    #[doc = "Checks if the value of the field is `_1US`"]
208    #[inline(always)]
209    pub fn is_1us(&self) -> bool {
210        *self == TSAMPLESPACINGREF_A::_1US
211    }
212    #[doc = "Checks if the value of the field is `_500NS`"]
213    #[inline(always)]
214    pub fn is_500ns(&self) -> bool {
215        *self == TSAMPLESPACINGREF_A::_500NS
216    }
217    #[doc = "Checks if the value of the field is `_250NS`"]
218    #[inline(always)]
219    pub fn is_250ns(&self) -> bool {
220        *self == TSAMPLESPACINGREF_A::_250NS
221    }
222    #[doc = "Checks if the value of the field is `_125NS`"]
223    #[inline(always)]
224    pub fn is_125ns(&self) -> bool {
225        *self == TSAMPLESPACINGREF_A::_125NS
226    }
227}
228#[doc = "Field `TSAMPLESPACINGREF` writer - Interval between samples in the REFERENCE period"]
229pub type TSAMPLESPACINGREF_W<'a, const O: u8> =
230    crate::FieldWriter<'a, u32, DFECTRL1_SPEC, u8, TSAMPLESPACINGREF_A, 3, O>;
231impl<'a, const O: u8> TSAMPLESPACINGREF_W<'a, O> {
232    #[doc = "4us"]
233    #[inline(always)]
234    pub fn _4us(self) -> &'a mut W {
235        self.variant(TSAMPLESPACINGREF_A::_4US)
236    }
237    #[doc = "2us"]
238    #[inline(always)]
239    pub fn _2us(self) -> &'a mut W {
240        self.variant(TSAMPLESPACINGREF_A::_2US)
241    }
242    #[doc = "1us"]
243    #[inline(always)]
244    pub fn _1us(self) -> &'a mut W {
245        self.variant(TSAMPLESPACINGREF_A::_1US)
246    }
247    #[doc = "0.5us"]
248    #[inline(always)]
249    pub fn _500ns(self) -> &'a mut W {
250        self.variant(TSAMPLESPACINGREF_A::_500NS)
251    }
252    #[doc = "0.25us"]
253    #[inline(always)]
254    pub fn _250ns(self) -> &'a mut W {
255        self.variant(TSAMPLESPACINGREF_A::_250NS)
256    }
257    #[doc = "0.125us"]
258    #[inline(always)]
259    pub fn _125ns(self) -> &'a mut W {
260        self.variant(TSAMPLESPACINGREF_A::_125NS)
261    }
262}
263#[doc = "Field `SAMPLETYPE` reader - Whether to sample I/Q or magnitude/phase"]
264pub type SAMPLETYPE_R = crate::BitReader<SAMPLETYPE_A>;
265#[doc = "Whether to sample I/Q or magnitude/phase\n\nValue on reset: 0"]
266#[derive(Clone, Copy, Debug, PartialEq)]
267pub enum SAMPLETYPE_A {
268    #[doc = "0: Complex samples in I and Q"]
269    IQ = 0,
270    #[doc = "1: Complex samples as magnitude and phase"]
271    MAG_PHASE = 1,
272}
273impl From<SAMPLETYPE_A> for bool {
274    #[inline(always)]
275    fn from(variant: SAMPLETYPE_A) -> Self {
276        variant as u8 != 0
277    }
278}
279impl SAMPLETYPE_R {
280    #[doc = "Get enumerated values variant"]
281    #[inline(always)]
282    pub fn variant(&self) -> SAMPLETYPE_A {
283        match self.bits {
284            false => SAMPLETYPE_A::IQ,
285            true => SAMPLETYPE_A::MAG_PHASE,
286        }
287    }
288    #[doc = "Checks if the value of the field is `IQ`"]
289    #[inline(always)]
290    pub fn is_iq(&self) -> bool {
291        *self == SAMPLETYPE_A::IQ
292    }
293    #[doc = "Checks if the value of the field is `MAG_PHASE`"]
294    #[inline(always)]
295    pub fn is_mag_phase(&self) -> bool {
296        *self == SAMPLETYPE_A::MAG_PHASE
297    }
298}
299#[doc = "Field `SAMPLETYPE` writer - Whether to sample I/Q or magnitude/phase"]
300pub type SAMPLETYPE_W<'a, const O: u8> = crate::BitWriter<'a, u32, DFECTRL1_SPEC, SAMPLETYPE_A, O>;
301impl<'a, const O: u8> SAMPLETYPE_W<'a, O> {
302    #[doc = "Complex samples in I and Q"]
303    #[inline(always)]
304    pub fn iq(self) -> &'a mut W {
305        self.variant(SAMPLETYPE_A::IQ)
306    }
307    #[doc = "Complex samples as magnitude and phase"]
308    #[inline(always)]
309    pub fn mag_phase(self) -> &'a mut W {
310        self.variant(SAMPLETYPE_A::MAG_PHASE)
311    }
312}
313#[doc = "Field `TSAMPLESPACING` reader - Interval between samples in the SWITCHING period when CTEINLINECTRLEN is 0"]
314pub type TSAMPLESPACING_R = crate::FieldReader<u8, TSAMPLESPACING_A>;
315#[doc = "Interval between samples in the SWITCHING period when CTEINLINECTRLEN is 0\n\nValue on reset: 2"]
316#[derive(Clone, Copy, Debug, PartialEq)]
317#[repr(u8)]
318pub enum TSAMPLESPACING_A {
319    #[doc = "1: 4us"]
320    _4US = 1,
321    #[doc = "2: 2us"]
322    _2US = 2,
323    #[doc = "3: 1us"]
324    _1US = 3,
325    #[doc = "4: 0.5us"]
326    _500NS = 4,
327    #[doc = "5: 0.25us"]
328    _250NS = 5,
329    #[doc = "6: 0.125us"]
330    _125NS = 6,
331}
332impl From<TSAMPLESPACING_A> for u8 {
333    #[inline(always)]
334    fn from(variant: TSAMPLESPACING_A) -> Self {
335        variant as _
336    }
337}
338impl TSAMPLESPACING_R {
339    #[doc = "Get enumerated values variant"]
340    #[inline(always)]
341    pub fn variant(&self) -> Option<TSAMPLESPACING_A> {
342        match self.bits {
343            1 => Some(TSAMPLESPACING_A::_4US),
344            2 => Some(TSAMPLESPACING_A::_2US),
345            3 => Some(TSAMPLESPACING_A::_1US),
346            4 => Some(TSAMPLESPACING_A::_500NS),
347            5 => Some(TSAMPLESPACING_A::_250NS),
348            6 => Some(TSAMPLESPACING_A::_125NS),
349            _ => None,
350        }
351    }
352    #[doc = "Checks if the value of the field is `_4US`"]
353    #[inline(always)]
354    pub fn is_4us(&self) -> bool {
355        *self == TSAMPLESPACING_A::_4US
356    }
357    #[doc = "Checks if the value of the field is `_2US`"]
358    #[inline(always)]
359    pub fn is_2us(&self) -> bool {
360        *self == TSAMPLESPACING_A::_2US
361    }
362    #[doc = "Checks if the value of the field is `_1US`"]
363    #[inline(always)]
364    pub fn is_1us(&self) -> bool {
365        *self == TSAMPLESPACING_A::_1US
366    }
367    #[doc = "Checks if the value of the field is `_500NS`"]
368    #[inline(always)]
369    pub fn is_500ns(&self) -> bool {
370        *self == TSAMPLESPACING_A::_500NS
371    }
372    #[doc = "Checks if the value of the field is `_250NS`"]
373    #[inline(always)]
374    pub fn is_250ns(&self) -> bool {
375        *self == TSAMPLESPACING_A::_250NS
376    }
377    #[doc = "Checks if the value of the field is `_125NS`"]
378    #[inline(always)]
379    pub fn is_125ns(&self) -> bool {
380        *self == TSAMPLESPACING_A::_125NS
381    }
382}
383#[doc = "Field `TSAMPLESPACING` writer - Interval between samples in the SWITCHING period when CTEINLINECTRLEN is 0"]
384pub type TSAMPLESPACING_W<'a, const O: u8> =
385    crate::FieldWriter<'a, u32, DFECTRL1_SPEC, u8, TSAMPLESPACING_A, 3, O>;
386impl<'a, const O: u8> TSAMPLESPACING_W<'a, O> {
387    #[doc = "4us"]
388    #[inline(always)]
389    pub fn _4us(self) -> &'a mut W {
390        self.variant(TSAMPLESPACING_A::_4US)
391    }
392    #[doc = "2us"]
393    #[inline(always)]
394    pub fn _2us(self) -> &'a mut W {
395        self.variant(TSAMPLESPACING_A::_2US)
396    }
397    #[doc = "1us"]
398    #[inline(always)]
399    pub fn _1us(self) -> &'a mut W {
400        self.variant(TSAMPLESPACING_A::_1US)
401    }
402    #[doc = "0.5us"]
403    #[inline(always)]
404    pub fn _500ns(self) -> &'a mut W {
405        self.variant(TSAMPLESPACING_A::_500NS)
406    }
407    #[doc = "0.25us"]
408    #[inline(always)]
409    pub fn _250ns(self) -> &'a mut W {
410        self.variant(TSAMPLESPACING_A::_250NS)
411    }
412    #[doc = "0.125us"]
413    #[inline(always)]
414    pub fn _125ns(self) -> &'a mut W {
415        self.variant(TSAMPLESPACING_A::_125NS)
416    }
417}
418#[doc = "Field `AGCBACKOFFGAIN` reader - Gain will be lowered by the specified number of gain steps at the start of CTE"]
419pub type AGCBACKOFFGAIN_R = crate::FieldReader<u8, u8>;
420#[doc = "Field `AGCBACKOFFGAIN` writer - Gain will be lowered by the specified number of gain steps at the start of CTE"]
421pub type AGCBACKOFFGAIN_W<'a, const O: u8> =
422    crate::FieldWriter<'a, u32, DFECTRL1_SPEC, u8, u8, 4, O>;
423impl R {
424    #[doc = "Bits 0:5 - Length of the AoA/AoD procedure in number of 8 us units"]
425    #[inline(always)]
426    pub fn numberof8us(&self) -> NUMBEROF8US_R {
427        NUMBEROF8US_R::new((self.bits & 0x3f) as u8)
428    }
429    #[doc = "Bit 7 - Add CTE extension and do antenna switching/sampling in this extension"]
430    #[inline(always)]
431    pub fn dfeinextension(&self) -> DFEINEXTENSION_R {
432        DFEINEXTENSION_R::new(((self.bits >> 7) & 1) != 0)
433    }
434    #[doc = "Bits 8:10 - Interval between every time the antenna is changed in the SWITCHING state"]
435    #[inline(always)]
436    pub fn tswitchspacing(&self) -> TSWITCHSPACING_R {
437        TSWITCHSPACING_R::new(((self.bits >> 8) & 7) as u8)
438    }
439    #[doc = "Bits 12:14 - Interval between samples in the REFERENCE period"]
440    #[inline(always)]
441    pub fn tsamplespacingref(&self) -> TSAMPLESPACINGREF_R {
442        TSAMPLESPACINGREF_R::new(((self.bits >> 12) & 7) as u8)
443    }
444    #[doc = "Bit 15 - Whether to sample I/Q or magnitude/phase"]
445    #[inline(always)]
446    pub fn sampletype(&self) -> SAMPLETYPE_R {
447        SAMPLETYPE_R::new(((self.bits >> 15) & 1) != 0)
448    }
449    #[doc = "Bits 16:18 - Interval between samples in the SWITCHING period when CTEINLINECTRLEN is 0"]
450    #[inline(always)]
451    pub fn tsamplespacing(&self) -> TSAMPLESPACING_R {
452        TSAMPLESPACING_R::new(((self.bits >> 16) & 7) as u8)
453    }
454    #[doc = "Bits 24:27 - Gain will be lowered by the specified number of gain steps at the start of CTE"]
455    #[inline(always)]
456    pub fn agcbackoffgain(&self) -> AGCBACKOFFGAIN_R {
457        AGCBACKOFFGAIN_R::new(((self.bits >> 24) & 0x0f) as u8)
458    }
459}
460impl W {
461    #[doc = "Bits 0:5 - Length of the AoA/AoD procedure in number of 8 us units"]
462    #[inline(always)]
463    pub fn numberof8us(&mut self) -> NUMBEROF8US_W<0> {
464        NUMBEROF8US_W::new(self)
465    }
466    #[doc = "Bit 7 - Add CTE extension and do antenna switching/sampling in this extension"]
467    #[inline(always)]
468    pub fn dfeinextension(&mut self) -> DFEINEXTENSION_W<7> {
469        DFEINEXTENSION_W::new(self)
470    }
471    #[doc = "Bits 8:10 - Interval between every time the antenna is changed in the SWITCHING state"]
472    #[inline(always)]
473    pub fn tswitchspacing(&mut self) -> TSWITCHSPACING_W<8> {
474        TSWITCHSPACING_W::new(self)
475    }
476    #[doc = "Bits 12:14 - Interval between samples in the REFERENCE period"]
477    #[inline(always)]
478    pub fn tsamplespacingref(&mut self) -> TSAMPLESPACINGREF_W<12> {
479        TSAMPLESPACINGREF_W::new(self)
480    }
481    #[doc = "Bit 15 - Whether to sample I/Q or magnitude/phase"]
482    #[inline(always)]
483    pub fn sampletype(&mut self) -> SAMPLETYPE_W<15> {
484        SAMPLETYPE_W::new(self)
485    }
486    #[doc = "Bits 16:18 - Interval between samples in the SWITCHING period when CTEINLINECTRLEN is 0"]
487    #[inline(always)]
488    pub fn tsamplespacing(&mut self) -> TSAMPLESPACING_W<16> {
489        TSAMPLESPACING_W::new(self)
490    }
491    #[doc = "Bits 24:27 - Gain will be lowered by the specified number of gain steps at the start of CTE"]
492    #[inline(always)]
493    pub fn agcbackoffgain(&mut self) -> AGCBACKOFFGAIN_W<24> {
494        AGCBACKOFFGAIN_W::new(self)
495    }
496    #[doc = "Writes raw bits to the register."]
497    #[inline(always)]
498    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
499        self.0.bits(bits);
500        self
501    }
502}
503#[doc = "Various configuration for Direction finding\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 [dfectrl1](index.html) module"]
504pub struct DFECTRL1_SPEC;
505impl crate::RegisterSpec for DFECTRL1_SPEC {
506    type Ux = u32;
507}
508#[doc = "`read()` method returns [dfectrl1::R](R) reader structure"]
509impl crate::Readable for DFECTRL1_SPEC {
510    type Reader = R;
511}
512#[doc = "`write(|w| ..)` method takes [dfectrl1::W](W) writer structure"]
513impl crate::Writable for DFECTRL1_SPEC {
514    type Writer = W;
515}
516#[doc = "`reset()` method sets DFECTRL1 to value 0x0002_3282"]
517impl crate::Resettable for DFECTRL1_SPEC {
518    #[inline(always)]
519    fn reset_value() -> Self::Ux {
520        0x0002_3282
521    }
522}