nrf52840_pac/nfct/
sensres.rs

1#[doc = "Register `SENSRES` reader"]
2pub struct R(crate::R<SENSRES_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SENSRES_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SENSRES_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SENSRES_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SENSRES` writer"]
17pub struct W(crate::W<SENSRES_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SENSRES_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<SENSRES_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SENSRES_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `BITFRAMESDD` reader - Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
38pub type BITFRAMESDD_R = crate::FieldReader<u8, BITFRAMESDD_A>;
39#[doc = "Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum BITFRAMESDD_A {
43    #[doc = "0: SDD pattern 00000"]
44    SDD00000 = 0,
45    #[doc = "1: SDD pattern 00001"]
46    SDD00001 = 1,
47    #[doc = "2: SDD pattern 00010"]
48    SDD00010 = 2,
49    #[doc = "4: SDD pattern 00100"]
50    SDD00100 = 4,
51    #[doc = "8: SDD pattern 01000"]
52    SDD01000 = 8,
53    #[doc = "16: SDD pattern 10000"]
54    SDD10000 = 16,
55}
56impl From<BITFRAMESDD_A> for u8 {
57    #[inline(always)]
58    fn from(variant: BITFRAMESDD_A) -> Self {
59        variant as _
60    }
61}
62impl BITFRAMESDD_R {
63    #[doc = "Get enumerated values variant"]
64    #[inline(always)]
65    pub fn variant(&self) -> Option<BITFRAMESDD_A> {
66        match self.bits {
67            0 => Some(BITFRAMESDD_A::SDD00000),
68            1 => Some(BITFRAMESDD_A::SDD00001),
69            2 => Some(BITFRAMESDD_A::SDD00010),
70            4 => Some(BITFRAMESDD_A::SDD00100),
71            8 => Some(BITFRAMESDD_A::SDD01000),
72            16 => Some(BITFRAMESDD_A::SDD10000),
73            _ => None,
74        }
75    }
76    #[doc = "Checks if the value of the field is `SDD00000`"]
77    #[inline(always)]
78    pub fn is_sdd00000(&self) -> bool {
79        *self == BITFRAMESDD_A::SDD00000
80    }
81    #[doc = "Checks if the value of the field is `SDD00001`"]
82    #[inline(always)]
83    pub fn is_sdd00001(&self) -> bool {
84        *self == BITFRAMESDD_A::SDD00001
85    }
86    #[doc = "Checks if the value of the field is `SDD00010`"]
87    #[inline(always)]
88    pub fn is_sdd00010(&self) -> bool {
89        *self == BITFRAMESDD_A::SDD00010
90    }
91    #[doc = "Checks if the value of the field is `SDD00100`"]
92    #[inline(always)]
93    pub fn is_sdd00100(&self) -> bool {
94        *self == BITFRAMESDD_A::SDD00100
95    }
96    #[doc = "Checks if the value of the field is `SDD01000`"]
97    #[inline(always)]
98    pub fn is_sdd01000(&self) -> bool {
99        *self == BITFRAMESDD_A::SDD01000
100    }
101    #[doc = "Checks if the value of the field is `SDD10000`"]
102    #[inline(always)]
103    pub fn is_sdd10000(&self) -> bool {
104        *self == BITFRAMESDD_A::SDD10000
105    }
106}
107#[doc = "Field `BITFRAMESDD` writer - Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
108pub type BITFRAMESDD_W<'a, const O: u8> =
109    crate::FieldWriter<'a, u32, SENSRES_SPEC, u8, BITFRAMESDD_A, 5, O>;
110impl<'a, const O: u8> BITFRAMESDD_W<'a, O> {
111    #[doc = "SDD pattern 00000"]
112    #[inline(always)]
113    pub fn sdd00000(self) -> &'a mut W {
114        self.variant(BITFRAMESDD_A::SDD00000)
115    }
116    #[doc = "SDD pattern 00001"]
117    #[inline(always)]
118    pub fn sdd00001(self) -> &'a mut W {
119        self.variant(BITFRAMESDD_A::SDD00001)
120    }
121    #[doc = "SDD pattern 00010"]
122    #[inline(always)]
123    pub fn sdd00010(self) -> &'a mut W {
124        self.variant(BITFRAMESDD_A::SDD00010)
125    }
126    #[doc = "SDD pattern 00100"]
127    #[inline(always)]
128    pub fn sdd00100(self) -> &'a mut W {
129        self.variant(BITFRAMESDD_A::SDD00100)
130    }
131    #[doc = "SDD pattern 01000"]
132    #[inline(always)]
133    pub fn sdd01000(self) -> &'a mut W {
134        self.variant(BITFRAMESDD_A::SDD01000)
135    }
136    #[doc = "SDD pattern 10000"]
137    #[inline(always)]
138    pub fn sdd10000(self) -> &'a mut W {
139        self.variant(BITFRAMESDD_A::SDD10000)
140    }
141}
142#[doc = "Field `RFU5` reader - Reserved for future use. Shall be 0."]
143pub type RFU5_R = crate::BitReader<bool>;
144#[doc = "Field `RFU5` writer - Reserved for future use. Shall be 0."]
145pub type RFU5_W<'a, const O: u8> = crate::BitWriter<'a, u32, SENSRES_SPEC, bool, O>;
146#[doc = "Field `NFCIDSIZE` reader - NFCID1 size. This value is used by the auto collision resolution engine."]
147pub type NFCIDSIZE_R = crate::FieldReader<u8, NFCIDSIZE_A>;
148#[doc = "NFCID1 size. This value is used by the auto collision resolution engine.\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq)]
150#[repr(u8)]
151pub enum NFCIDSIZE_A {
152    #[doc = "0: NFCID1 size: single (4 bytes)"]
153    NFCID1SINGLE = 0,
154    #[doc = "1: NFCID1 size: double (7 bytes)"]
155    NFCID1DOUBLE = 1,
156    #[doc = "2: NFCID1 size: triple (10 bytes)"]
157    NFCID1TRIPLE = 2,
158}
159impl From<NFCIDSIZE_A> for u8 {
160    #[inline(always)]
161    fn from(variant: NFCIDSIZE_A) -> Self {
162        variant as _
163    }
164}
165impl NFCIDSIZE_R {
166    #[doc = "Get enumerated values variant"]
167    #[inline(always)]
168    pub fn variant(&self) -> Option<NFCIDSIZE_A> {
169        match self.bits {
170            0 => Some(NFCIDSIZE_A::NFCID1SINGLE),
171            1 => Some(NFCIDSIZE_A::NFCID1DOUBLE),
172            2 => Some(NFCIDSIZE_A::NFCID1TRIPLE),
173            _ => None,
174        }
175    }
176    #[doc = "Checks if the value of the field is `NFCID1SINGLE`"]
177    #[inline(always)]
178    pub fn is_nfcid1single(&self) -> bool {
179        *self == NFCIDSIZE_A::NFCID1SINGLE
180    }
181    #[doc = "Checks if the value of the field is `NFCID1DOUBLE`"]
182    #[inline(always)]
183    pub fn is_nfcid1double(&self) -> bool {
184        *self == NFCIDSIZE_A::NFCID1DOUBLE
185    }
186    #[doc = "Checks if the value of the field is `NFCID1TRIPLE`"]
187    #[inline(always)]
188    pub fn is_nfcid1triple(&self) -> bool {
189        *self == NFCIDSIZE_A::NFCID1TRIPLE
190    }
191}
192#[doc = "Field `NFCIDSIZE` writer - NFCID1 size. This value is used by the auto collision resolution engine."]
193pub type NFCIDSIZE_W<'a, const O: u8> =
194    crate::FieldWriter<'a, u32, SENSRES_SPEC, u8, NFCIDSIZE_A, 2, O>;
195impl<'a, const O: u8> NFCIDSIZE_W<'a, O> {
196    #[doc = "NFCID1 size: single (4 bytes)"]
197    #[inline(always)]
198    pub fn nfcid1single(self) -> &'a mut W {
199        self.variant(NFCIDSIZE_A::NFCID1SINGLE)
200    }
201    #[doc = "NFCID1 size: double (7 bytes)"]
202    #[inline(always)]
203    pub fn nfcid1double(self) -> &'a mut W {
204        self.variant(NFCIDSIZE_A::NFCID1DOUBLE)
205    }
206    #[doc = "NFCID1 size: triple (10 bytes)"]
207    #[inline(always)]
208    pub fn nfcid1triple(self) -> &'a mut W {
209        self.variant(NFCIDSIZE_A::NFCID1TRIPLE)
210    }
211}
212#[doc = "Field `PLATFCONFIG` reader - Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
213pub type PLATFCONFIG_R = crate::FieldReader<u8, u8>;
214#[doc = "Field `PLATFCONFIG` writer - Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
215pub type PLATFCONFIG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SENSRES_SPEC, u8, u8, 4, O>;
216#[doc = "Field `RFU74` reader - Reserved for future use. Shall be 0."]
217pub type RFU74_R = crate::FieldReader<u8, u8>;
218#[doc = "Field `RFU74` writer - Reserved for future use. Shall be 0."]
219pub type RFU74_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SENSRES_SPEC, u8, u8, 4, O>;
220impl R {
221    #[doc = "Bits 0:4 - Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
222    #[inline(always)]
223    pub fn bitframesdd(&self) -> BITFRAMESDD_R {
224        BITFRAMESDD_R::new((self.bits & 0x1f) as u8)
225    }
226    #[doc = "Bit 5 - Reserved for future use. Shall be 0."]
227    #[inline(always)]
228    pub fn rfu5(&self) -> RFU5_R {
229        RFU5_R::new(((self.bits >> 5) & 1) != 0)
230    }
231    #[doc = "Bits 6:7 - NFCID1 size. This value is used by the auto collision resolution engine."]
232    #[inline(always)]
233    pub fn nfcidsize(&self) -> NFCIDSIZE_R {
234        NFCIDSIZE_R::new(((self.bits >> 6) & 3) as u8)
235    }
236    #[doc = "Bits 8:11 - Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
237    #[inline(always)]
238    pub fn platfconfig(&self) -> PLATFCONFIG_R {
239        PLATFCONFIG_R::new(((self.bits >> 8) & 0x0f) as u8)
240    }
241    #[doc = "Bits 12:15 - Reserved for future use. Shall be 0."]
242    #[inline(always)]
243    pub fn rfu74(&self) -> RFU74_R {
244        RFU74_R::new(((self.bits >> 12) & 0x0f) as u8)
245    }
246}
247impl W {
248    #[doc = "Bits 0:4 - Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
249    #[inline(always)]
250    pub fn bitframesdd(&mut self) -> BITFRAMESDD_W<0> {
251        BITFRAMESDD_W::new(self)
252    }
253    #[doc = "Bit 5 - Reserved for future use. Shall be 0."]
254    #[inline(always)]
255    pub fn rfu5(&mut self) -> RFU5_W<5> {
256        RFU5_W::new(self)
257    }
258    #[doc = "Bits 6:7 - NFCID1 size. This value is used by the auto collision resolution engine."]
259    #[inline(always)]
260    pub fn nfcidsize(&mut self) -> NFCIDSIZE_W<6> {
261        NFCIDSIZE_W::new(self)
262    }
263    #[doc = "Bits 8:11 - Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
264    #[inline(always)]
265    pub fn platfconfig(&mut self) -> PLATFCONFIG_W<8> {
266        PLATFCONFIG_W::new(self)
267    }
268    #[doc = "Bits 12:15 - Reserved for future use. Shall be 0."]
269    #[inline(always)]
270    pub fn rfu74(&mut self) -> RFU74_W<12> {
271        RFU74_W::new(self)
272    }
273    #[doc = "Writes raw bits to the register."]
274    #[inline(always)]
275    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
276        self.0.bits(bits);
277        self
278    }
279}
280#[doc = "NFC-A SENS_RES auto-response settings\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 [sensres](index.html) module"]
281pub struct SENSRES_SPEC;
282impl crate::RegisterSpec for SENSRES_SPEC {
283    type Ux = u32;
284}
285#[doc = "`read()` method returns [sensres::R](R) reader structure"]
286impl crate::Readable for SENSRES_SPEC {
287    type Reader = R;
288}
289#[doc = "`write(|w| ..)` method takes [sensres::W](W) writer structure"]
290impl crate::Writable for SENSRES_SPEC {
291    type Writer = W;
292}
293#[doc = "`reset()` method sets SENSRES to value 0x01"]
294impl crate::Resettable for SENSRES_SPEC {
295    #[inline(always)]
296    fn reset_value() -> Self::Ux {
297        0x01
298    }
299}