nrf52840_pac/nfct/framestatus/
rx.rs

1#[doc = "Register `RX` reader"]
2pub struct R(crate::R<RX_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RX_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RX_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RX_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RX` writer"]
17pub struct W(crate::W<RX_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RX_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<RX_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RX_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CRCERROR` reader - No valid end of frame (EoF) detected"]
38pub type CRCERROR_R = crate::BitReader<CRCERROR_A>;
39#[doc = "No valid end of frame (EoF) detected\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum CRCERROR_A {
42    #[doc = "0: Valid CRC detected"]
43    CRCCORRECT = 0,
44    #[doc = "1: CRC received does not match local check"]
45    CRCERROR = 1,
46}
47impl From<CRCERROR_A> for bool {
48    #[inline(always)]
49    fn from(variant: CRCERROR_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CRCERROR_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CRCERROR_A {
57        match self.bits {
58            false => CRCERROR_A::CRCCORRECT,
59            true => CRCERROR_A::CRCERROR,
60        }
61    }
62    #[doc = "Checks if the value of the field is `CRCCORRECT`"]
63    #[inline(always)]
64    pub fn is_crccorrect(&self) -> bool {
65        *self == CRCERROR_A::CRCCORRECT
66    }
67    #[doc = "Checks if the value of the field is `CRCERROR`"]
68    #[inline(always)]
69    pub fn is_crcerror(&self) -> bool {
70        *self == CRCERROR_A::CRCERROR
71    }
72}
73#[doc = "Field `CRCERROR` writer - No valid end of frame (EoF) detected"]
74pub type CRCERROR_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, RX_SPEC, CRCERROR_A, O>;
75impl<'a, const O: u8> CRCERROR_W<'a, O> {
76    #[doc = "Valid CRC detected"]
77    #[inline(always)]
78    pub fn crccorrect(self) -> &'a mut W {
79        self.variant(CRCERROR_A::CRCCORRECT)
80    }
81    #[doc = "CRC received does not match local check"]
82    #[inline(always)]
83    pub fn crcerror(self) -> &'a mut W {
84        self.variant(CRCERROR_A::CRCERROR)
85    }
86}
87#[doc = "Field `PARITYSTATUS` reader - Parity status of received frame"]
88pub type PARITYSTATUS_R = crate::BitReader<PARITYSTATUS_A>;
89#[doc = "Parity status of received frame\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum PARITYSTATUS_A {
92    #[doc = "0: Frame received with parity OK"]
93    PARITY_OK = 0,
94    #[doc = "1: Frame received with parity error"]
95    PARITY_ERROR = 1,
96}
97impl From<PARITYSTATUS_A> for bool {
98    #[inline(always)]
99    fn from(variant: PARITYSTATUS_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl PARITYSTATUS_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> PARITYSTATUS_A {
107        match self.bits {
108            false => PARITYSTATUS_A::PARITY_OK,
109            true => PARITYSTATUS_A::PARITY_ERROR,
110        }
111    }
112    #[doc = "Checks if the value of the field is `PARITY_OK`"]
113    #[inline(always)]
114    pub fn is_parity_ok(&self) -> bool {
115        *self == PARITYSTATUS_A::PARITY_OK
116    }
117    #[doc = "Checks if the value of the field is `PARITY_ERROR`"]
118    #[inline(always)]
119    pub fn is_parity_error(&self) -> bool {
120        *self == PARITYSTATUS_A::PARITY_ERROR
121    }
122}
123#[doc = "Field `PARITYSTATUS` writer - Parity status of received frame"]
124pub type PARITYSTATUS_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, RX_SPEC, PARITYSTATUS_A, O>;
125impl<'a, const O: u8> PARITYSTATUS_W<'a, O> {
126    #[doc = "Frame received with parity OK"]
127    #[inline(always)]
128    pub fn parity_ok(self) -> &'a mut W {
129        self.variant(PARITYSTATUS_A::PARITY_OK)
130    }
131    #[doc = "Frame received with parity error"]
132    #[inline(always)]
133    pub fn parity_error(self) -> &'a mut W {
134        self.variant(PARITYSTATUS_A::PARITY_ERROR)
135    }
136}
137#[doc = "Field `OVERRUN` reader - Overrun detected"]
138pub type OVERRUN_R = crate::BitReader<OVERRUN_A>;
139#[doc = "Overrun detected\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum OVERRUN_A {
142    #[doc = "0: No overrun detected"]
143    NO_OVERRUN = 0,
144    #[doc = "1: Overrun error"]
145    OVERRUN = 1,
146}
147impl From<OVERRUN_A> for bool {
148    #[inline(always)]
149    fn from(variant: OVERRUN_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl OVERRUN_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> OVERRUN_A {
157        match self.bits {
158            false => OVERRUN_A::NO_OVERRUN,
159            true => OVERRUN_A::OVERRUN,
160        }
161    }
162    #[doc = "Checks if the value of the field is `NO_OVERRUN`"]
163    #[inline(always)]
164    pub fn is_no_overrun(&self) -> bool {
165        *self == OVERRUN_A::NO_OVERRUN
166    }
167    #[doc = "Checks if the value of the field is `OVERRUN`"]
168    #[inline(always)]
169    pub fn is_overrun(&self) -> bool {
170        *self == OVERRUN_A::OVERRUN
171    }
172}
173#[doc = "Field `OVERRUN` writer - Overrun detected"]
174pub type OVERRUN_W<'a, const O: u8> = crate::BitWriter1C<'a, u32, RX_SPEC, OVERRUN_A, O>;
175impl<'a, const O: u8> OVERRUN_W<'a, O> {
176    #[doc = "No overrun detected"]
177    #[inline(always)]
178    pub fn no_overrun(self) -> &'a mut W {
179        self.variant(OVERRUN_A::NO_OVERRUN)
180    }
181    #[doc = "Overrun error"]
182    #[inline(always)]
183    pub fn overrun(self) -> &'a mut W {
184        self.variant(OVERRUN_A::OVERRUN)
185    }
186}
187impl R {
188    #[doc = "Bit 0 - No valid end of frame (EoF) detected"]
189    #[inline(always)]
190    pub fn crcerror(&self) -> CRCERROR_R {
191        CRCERROR_R::new((self.bits & 1) != 0)
192    }
193    #[doc = "Bit 2 - Parity status of received frame"]
194    #[inline(always)]
195    pub fn paritystatus(&self) -> PARITYSTATUS_R {
196        PARITYSTATUS_R::new(((self.bits >> 2) & 1) != 0)
197    }
198    #[doc = "Bit 3 - Overrun detected"]
199    #[inline(always)]
200    pub fn overrun(&self) -> OVERRUN_R {
201        OVERRUN_R::new(((self.bits >> 3) & 1) != 0)
202    }
203}
204impl W {
205    #[doc = "Bit 0 - No valid end of frame (EoF) detected"]
206    #[inline(always)]
207    pub fn crcerror(&mut self) -> CRCERROR_W<0> {
208        CRCERROR_W::new(self)
209    }
210    #[doc = "Bit 2 - Parity status of received frame"]
211    #[inline(always)]
212    pub fn paritystatus(&mut self) -> PARITYSTATUS_W<2> {
213        PARITYSTATUS_W::new(self)
214    }
215    #[doc = "Bit 3 - Overrun detected"]
216    #[inline(always)]
217    pub fn overrun(&mut self) -> OVERRUN_W<3> {
218        OVERRUN_W::new(self)
219    }
220    #[doc = "Writes raw bits to the register."]
221    #[inline(always)]
222    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223        self.0.bits(bits);
224        self
225    }
226}
227#[doc = "Result of last incoming frame\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 [rx](index.html) module"]
228pub struct RX_SPEC;
229impl crate::RegisterSpec for RX_SPEC {
230    type Ux = u32;
231}
232#[doc = "`read()` method returns [rx::R](R) reader structure"]
233impl crate::Readable for RX_SPEC {
234    type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [rx::W](W) writer structure"]
237impl crate::Writable for RX_SPEC {
238    type Writer = W;
239}
240#[doc = "`reset()` method sets RX to value 0"]
241impl crate::Resettable for RX_SPEC {
242    #[inline(always)]
243    fn reset_value() -> Self::Ux {
244        0
245    }
246}