nrf52832_pac/nfct/
selres.rs

1#[doc = "Register `SELRES` reader"]
2pub struct R(crate::R<SELRES_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SELRES_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SELRES_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SELRES_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SELRES` writer"]
17pub struct W(crate::W<SELRES_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SELRES_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<SELRES_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SELRES_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RFU10` reader - Reserved for future use. Shall be 0."]
38pub type RFU10_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `RFU10` writer - Reserved for future use. Shall be 0."]
40pub type RFU10_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SELRES_SPEC, u8, u8, 2, O>;
41#[doc = "Field `CASCADE` reader - Cascade bit (controlled by hardware, write has no effect)"]
42pub type CASCADE_R = crate::BitReader<CASCADE_A>;
43#[doc = "Cascade bit (controlled by hardware, write has no effect)\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45pub enum CASCADE_A {
46    #[doc = "0: NFCID1 complete"]
47    COMPLETE = 0,
48    #[doc = "1: NFCID1 not complete"]
49    NOT_COMPLETE = 1,
50}
51impl From<CASCADE_A> for bool {
52    #[inline(always)]
53    fn from(variant: CASCADE_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl CASCADE_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> CASCADE_A {
61        match self.bits {
62            false => CASCADE_A::COMPLETE,
63            true => CASCADE_A::NOT_COMPLETE,
64        }
65    }
66    #[doc = "Checks if the value of the field is `COMPLETE`"]
67    #[inline(always)]
68    pub fn is_complete(&self) -> bool {
69        *self == CASCADE_A::COMPLETE
70    }
71    #[doc = "Checks if the value of the field is `NOT_COMPLETE`"]
72    #[inline(always)]
73    pub fn is_not_complete(&self) -> bool {
74        *self == CASCADE_A::NOT_COMPLETE
75    }
76}
77#[doc = "Field `CASCADE` writer - Cascade bit (controlled by hardware, write has no effect)"]
78pub type CASCADE_W<'a, const O: u8> = crate::BitWriter<'a, u32, SELRES_SPEC, CASCADE_A, O>;
79impl<'a, const O: u8> CASCADE_W<'a, O> {
80    #[doc = "NFCID1 complete"]
81    #[inline(always)]
82    pub fn complete(self) -> &'a mut W {
83        self.variant(CASCADE_A::COMPLETE)
84    }
85    #[doc = "NFCID1 not complete"]
86    #[inline(always)]
87    pub fn not_complete(self) -> &'a mut W {
88        self.variant(CASCADE_A::NOT_COMPLETE)
89    }
90}
91#[doc = "Field `RFU43` reader - Reserved for future use. Shall be 0."]
92pub type RFU43_R = crate::FieldReader<u8, u8>;
93#[doc = "Field `RFU43` writer - Reserved for future use. Shall be 0."]
94pub type RFU43_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SELRES_SPEC, u8, u8, 2, O>;
95#[doc = "Field `PROTOCOL` reader - Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
96pub type PROTOCOL_R = crate::FieldReader<u8, u8>;
97#[doc = "Field `PROTOCOL` writer - Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
98pub type PROTOCOL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SELRES_SPEC, u8, u8, 2, O>;
99#[doc = "Field `RFU7` reader - Reserved for future use. Shall be 0."]
100pub type RFU7_R = crate::BitReader<bool>;
101#[doc = "Field `RFU7` writer - Reserved for future use. Shall be 0."]
102pub type RFU7_W<'a, const O: u8> = crate::BitWriter<'a, u32, SELRES_SPEC, bool, O>;
103impl R {
104    #[doc = "Bits 0:1 - Reserved for future use. Shall be 0."]
105    #[inline(always)]
106    pub fn rfu10(&self) -> RFU10_R {
107        RFU10_R::new((self.bits & 3) as u8)
108    }
109    #[doc = "Bit 2 - Cascade bit (controlled by hardware, write has no effect)"]
110    #[inline(always)]
111    pub fn cascade(&self) -> CASCADE_R {
112        CASCADE_R::new(((self.bits >> 2) & 1) != 0)
113    }
114    #[doc = "Bits 3:4 - Reserved for future use. Shall be 0."]
115    #[inline(always)]
116    pub fn rfu43(&self) -> RFU43_R {
117        RFU43_R::new(((self.bits >> 3) & 3) as u8)
118    }
119    #[doc = "Bits 5:6 - Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
120    #[inline(always)]
121    pub fn protocol(&self) -> PROTOCOL_R {
122        PROTOCOL_R::new(((self.bits >> 5) & 3) as u8)
123    }
124    #[doc = "Bit 7 - Reserved for future use. Shall be 0."]
125    #[inline(always)]
126    pub fn rfu7(&self) -> RFU7_R {
127        RFU7_R::new(((self.bits >> 7) & 1) != 0)
128    }
129}
130impl W {
131    #[doc = "Bits 0:1 - Reserved for future use. Shall be 0."]
132    #[inline(always)]
133    pub fn rfu10(&mut self) -> RFU10_W<0> {
134        RFU10_W::new(self)
135    }
136    #[doc = "Bit 2 - Cascade bit (controlled by hardware, write has no effect)"]
137    #[inline(always)]
138    pub fn cascade(&mut self) -> CASCADE_W<2> {
139        CASCADE_W::new(self)
140    }
141    #[doc = "Bits 3:4 - Reserved for future use. Shall be 0."]
142    #[inline(always)]
143    pub fn rfu43(&mut self) -> RFU43_W<3> {
144        RFU43_W::new(self)
145    }
146    #[doc = "Bits 5:6 - Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification"]
147    #[inline(always)]
148    pub fn protocol(&mut self) -> PROTOCOL_W<5> {
149        PROTOCOL_W::new(self)
150    }
151    #[doc = "Bit 7 - Reserved for future use. Shall be 0."]
152    #[inline(always)]
153    pub fn rfu7(&mut self) -> RFU7_W<7> {
154        RFU7_W::new(self)
155    }
156    #[doc = "Writes raw bits to the register."]
157    #[inline(always)]
158    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
159        self.0.bits(bits);
160        self
161    }
162}
163#[doc = "NFC-A SEL_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 [selres](index.html) module"]
164pub struct SELRES_SPEC;
165impl crate::RegisterSpec for SELRES_SPEC {
166    type Ux = u32;
167}
168#[doc = "`read()` method returns [selres::R](R) reader structure"]
169impl crate::Readable for SELRES_SPEC {
170    type Reader = R;
171}
172#[doc = "`write(|w| ..)` method takes [selres::W](W) writer structure"]
173impl crate::Writable for SELRES_SPEC {
174    type Writer = W;
175}
176#[doc = "`reset()` method sets SELRES to value 0"]
177impl crate::Resettable for SELRES_SPEC {
178    #[inline(always)]
179    fn reset_value() -> Self::Ux {
180        0
181    }
182}