nrf52840_pac/nfct/rxd/
frameconfig.rs

1#[doc = "Register `FRAMECONFIG` reader"]
2pub struct R(crate::R<FRAMECONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<FRAMECONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<FRAMECONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<FRAMECONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `FRAMECONFIG` writer"]
17pub struct W(crate::W<FRAMECONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<FRAMECONFIG_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<FRAMECONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<FRAMECONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PARITY` reader - Indicates if parity expected in RX frame"]
38pub type PARITY_R = crate::BitReader<PARITY_A>;
39#[doc = "Indicates if parity expected in RX frame\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum PARITY_A {
42    #[doc = "0: Parity is not expected in RX frames"]
43    NO_PARITY = 0,
44    #[doc = "1: Parity is expected in RX frames"]
45    PARITY = 1,
46}
47impl From<PARITY_A> for bool {
48    #[inline(always)]
49    fn from(variant: PARITY_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl PARITY_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> PARITY_A {
57        match self.bits {
58            false => PARITY_A::NO_PARITY,
59            true => PARITY_A::PARITY,
60        }
61    }
62    #[doc = "Checks if the value of the field is `NO_PARITY`"]
63    #[inline(always)]
64    pub fn is_no_parity(&self) -> bool {
65        *self == PARITY_A::NO_PARITY
66    }
67    #[doc = "Checks if the value of the field is `PARITY`"]
68    #[inline(always)]
69    pub fn is_parity(&self) -> bool {
70        *self == PARITY_A::PARITY
71    }
72}
73#[doc = "Field `PARITY` writer - Indicates if parity expected in RX frame"]
74pub type PARITY_W<'a, const O: u8> = crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, PARITY_A, O>;
75impl<'a, const O: u8> PARITY_W<'a, O> {
76    #[doc = "Parity is not expected in RX frames"]
77    #[inline(always)]
78    pub fn no_parity(self) -> &'a mut W {
79        self.variant(PARITY_A::NO_PARITY)
80    }
81    #[doc = "Parity is expected in RX frames"]
82    #[inline(always)]
83    pub fn parity(self) -> &'a mut W {
84        self.variant(PARITY_A::PARITY)
85    }
86}
87#[doc = "Field `SOF` reader - SoF expected or not in RX frames"]
88pub type SOF_R = crate::BitReader<SOF_A>;
89#[doc = "SoF expected or not in RX frames\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum SOF_A {
92    #[doc = "0: SoF symbol is not expected in RX frames"]
93    NO_SO_F = 0,
94    #[doc = "1: SoF symbol is expected in RX frames"]
95    SO_F = 1,
96}
97impl From<SOF_A> for bool {
98    #[inline(always)]
99    fn from(variant: SOF_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl SOF_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> SOF_A {
107        match self.bits {
108            false => SOF_A::NO_SO_F,
109            true => SOF_A::SO_F,
110        }
111    }
112    #[doc = "Checks if the value of the field is `NO_SO_F`"]
113    #[inline(always)]
114    pub fn is_no_so_f(&self) -> bool {
115        *self == SOF_A::NO_SO_F
116    }
117    #[doc = "Checks if the value of the field is `SO_F`"]
118    #[inline(always)]
119    pub fn is_so_f(&self) -> bool {
120        *self == SOF_A::SO_F
121    }
122}
123#[doc = "Field `SOF` writer - SoF expected or not in RX frames"]
124pub type SOF_W<'a, const O: u8> = crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, SOF_A, O>;
125impl<'a, const O: u8> SOF_W<'a, O> {
126    #[doc = "SoF symbol is not expected in RX frames"]
127    #[inline(always)]
128    pub fn no_so_f(self) -> &'a mut W {
129        self.variant(SOF_A::NO_SO_F)
130    }
131    #[doc = "SoF symbol is expected in RX frames"]
132    #[inline(always)]
133    pub fn so_f(self) -> &'a mut W {
134        self.variant(SOF_A::SO_F)
135    }
136}
137#[doc = "Field `CRCMODERX` reader - CRC mode for incoming frames"]
138pub type CRCMODERX_R = crate::BitReader<CRCMODERX_A>;
139#[doc = "CRC mode for incoming frames\n\nValue on reset: 1"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum CRCMODERX_A {
142    #[doc = "0: CRC is not expected in RX frames"]
143    NO_CRCRX = 0,
144    #[doc = "1: Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated"]
145    CRC16RX = 1,
146}
147impl From<CRCMODERX_A> for bool {
148    #[inline(always)]
149    fn from(variant: CRCMODERX_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl CRCMODERX_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> CRCMODERX_A {
157        match self.bits {
158            false => CRCMODERX_A::NO_CRCRX,
159            true => CRCMODERX_A::CRC16RX,
160        }
161    }
162    #[doc = "Checks if the value of the field is `NO_CRCRX`"]
163    #[inline(always)]
164    pub fn is_no_crcrx(&self) -> bool {
165        *self == CRCMODERX_A::NO_CRCRX
166    }
167    #[doc = "Checks if the value of the field is `CRC16RX`"]
168    #[inline(always)]
169    pub fn is_crc16rx(&self) -> bool {
170        *self == CRCMODERX_A::CRC16RX
171    }
172}
173#[doc = "Field `CRCMODERX` writer - CRC mode for incoming frames"]
174pub type CRCMODERX_W<'a, const O: u8> = crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, CRCMODERX_A, O>;
175impl<'a, const O: u8> CRCMODERX_W<'a, O> {
176    #[doc = "CRC is not expected in RX frames"]
177    #[inline(always)]
178    pub fn no_crcrx(self) -> &'a mut W {
179        self.variant(CRCMODERX_A::NO_CRCRX)
180    }
181    #[doc = "Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated"]
182    #[inline(always)]
183    pub fn crc16rx(self) -> &'a mut W {
184        self.variant(CRCMODERX_A::CRC16RX)
185    }
186}
187impl R {
188    #[doc = "Bit 0 - Indicates if parity expected in RX frame"]
189    #[inline(always)]
190    pub fn parity(&self) -> PARITY_R {
191        PARITY_R::new((self.bits & 1) != 0)
192    }
193    #[doc = "Bit 2 - SoF expected or not in RX frames"]
194    #[inline(always)]
195    pub fn sof(&self) -> SOF_R {
196        SOF_R::new(((self.bits >> 2) & 1) != 0)
197    }
198    #[doc = "Bit 4 - CRC mode for incoming frames"]
199    #[inline(always)]
200    pub fn crcmoderx(&self) -> CRCMODERX_R {
201        CRCMODERX_R::new(((self.bits >> 4) & 1) != 0)
202    }
203}
204impl W {
205    #[doc = "Bit 0 - Indicates if parity expected in RX frame"]
206    #[inline(always)]
207    pub fn parity(&mut self) -> PARITY_W<0> {
208        PARITY_W::new(self)
209    }
210    #[doc = "Bit 2 - SoF expected or not in RX frames"]
211    #[inline(always)]
212    pub fn sof(&mut self) -> SOF_W<2> {
213        SOF_W::new(self)
214    }
215    #[doc = "Bit 4 - CRC mode for incoming frames"]
216    #[inline(always)]
217    pub fn crcmoderx(&mut self) -> CRCMODERX_W<4> {
218        CRCMODERX_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 = "Configuration of incoming frames\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 [frameconfig](index.html) module"]
228pub struct FRAMECONFIG_SPEC;
229impl crate::RegisterSpec for FRAMECONFIG_SPEC {
230    type Ux = u32;
231}
232#[doc = "`read()` method returns [frameconfig::R](R) reader structure"]
233impl crate::Readable for FRAMECONFIG_SPEC {
234    type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [frameconfig::W](W) writer structure"]
237impl crate::Writable for FRAMECONFIG_SPEC {
238    type Writer = W;
239}
240#[doc = "`reset()` method sets FRAMECONFIG to value 0x15"]
241impl crate::Resettable for FRAMECONFIG_SPEC {
242    #[inline(always)]
243    fn reset_value() -> Self::Ux {
244        0x15
245    }
246}