nrf52840_pac/nfct/txd/
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 is added to the frame"]
38pub type PARITY_R = crate::BitReader<PARITY_A>;
39#[doc = "Indicates if parity is added to the frame\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum PARITY_A {
42    #[doc = "0: Parity is not added to TX frames"]
43    NO_PARITY = 0,
44    #[doc = "1: Parity is added to TX 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 is added to the 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 added to TX 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 added to TX frames"]
82    #[inline(always)]
83    pub fn parity(self) -> &'a mut W {
84        self.variant(PARITY_A::PARITY)
85    }
86}
87#[doc = "Field `DISCARDMODE` reader - Discarding unused bits at start or end of a frame"]
88pub type DISCARDMODE_R = crate::BitReader<DISCARDMODE_A>;
89#[doc = "Discarding unused bits at start or end of a frame\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum DISCARDMODE_A {
92    #[doc = "0: Unused bits are discarded at end of frame (EoF)"]
93    DISCARD_END = 0,
94    #[doc = "1: Unused bits are discarded at start of frame (SoF)"]
95    DISCARD_START = 1,
96}
97impl From<DISCARDMODE_A> for bool {
98    #[inline(always)]
99    fn from(variant: DISCARDMODE_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl DISCARDMODE_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> DISCARDMODE_A {
107        match self.bits {
108            false => DISCARDMODE_A::DISCARD_END,
109            true => DISCARDMODE_A::DISCARD_START,
110        }
111    }
112    #[doc = "Checks if the value of the field is `DISCARD_END`"]
113    #[inline(always)]
114    pub fn is_discard_end(&self) -> bool {
115        *self == DISCARDMODE_A::DISCARD_END
116    }
117    #[doc = "Checks if the value of the field is `DISCARD_START`"]
118    #[inline(always)]
119    pub fn is_discard_start(&self) -> bool {
120        *self == DISCARDMODE_A::DISCARD_START
121    }
122}
123#[doc = "Field `DISCARDMODE` writer - Discarding unused bits at start or end of a frame"]
124pub type DISCARDMODE_W<'a, const O: u8> =
125    crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, DISCARDMODE_A, O>;
126impl<'a, const O: u8> DISCARDMODE_W<'a, O> {
127    #[doc = "Unused bits are discarded at end of frame (EoF)"]
128    #[inline(always)]
129    pub fn discard_end(self) -> &'a mut W {
130        self.variant(DISCARDMODE_A::DISCARD_END)
131    }
132    #[doc = "Unused bits are discarded at start of frame (SoF)"]
133    #[inline(always)]
134    pub fn discard_start(self) -> &'a mut W {
135        self.variant(DISCARDMODE_A::DISCARD_START)
136    }
137}
138#[doc = "Field `SOF` reader - Adding SoF or not in TX frames"]
139pub type SOF_R = crate::BitReader<SOF_A>;
140#[doc = "Adding SoF or not in TX frames\n\nValue on reset: 1"]
141#[derive(Clone, Copy, Debug, PartialEq)]
142pub enum SOF_A {
143    #[doc = "0: SoF symbol not added"]
144    NO_SO_F = 0,
145    #[doc = "1: SoF symbol added"]
146    SO_F = 1,
147}
148impl From<SOF_A> for bool {
149    #[inline(always)]
150    fn from(variant: SOF_A) -> Self {
151        variant as u8 != 0
152    }
153}
154impl SOF_R {
155    #[doc = "Get enumerated values variant"]
156    #[inline(always)]
157    pub fn variant(&self) -> SOF_A {
158        match self.bits {
159            false => SOF_A::NO_SO_F,
160            true => SOF_A::SO_F,
161        }
162    }
163    #[doc = "Checks if the value of the field is `NO_SO_F`"]
164    #[inline(always)]
165    pub fn is_no_so_f(&self) -> bool {
166        *self == SOF_A::NO_SO_F
167    }
168    #[doc = "Checks if the value of the field is `SO_F`"]
169    #[inline(always)]
170    pub fn is_so_f(&self) -> bool {
171        *self == SOF_A::SO_F
172    }
173}
174#[doc = "Field `SOF` writer - Adding SoF or not in TX frames"]
175pub type SOF_W<'a, const O: u8> = crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, SOF_A, O>;
176impl<'a, const O: u8> SOF_W<'a, O> {
177    #[doc = "SoF symbol not added"]
178    #[inline(always)]
179    pub fn no_so_f(self) -> &'a mut W {
180        self.variant(SOF_A::NO_SO_F)
181    }
182    #[doc = "SoF symbol added"]
183    #[inline(always)]
184    pub fn so_f(self) -> &'a mut W {
185        self.variant(SOF_A::SO_F)
186    }
187}
188#[doc = "Field `CRCMODETX` reader - CRC mode for outgoing frames"]
189pub type CRCMODETX_R = crate::BitReader<CRCMODETX_A>;
190#[doc = "CRC mode for outgoing frames\n\nValue on reset: 1"]
191#[derive(Clone, Copy, Debug, PartialEq)]
192pub enum CRCMODETX_A {
193    #[doc = "0: CRC is not added to the frame"]
194    NO_CRCTX = 0,
195    #[doc = "1: 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame"]
196    CRC16TX = 1,
197}
198impl From<CRCMODETX_A> for bool {
199    #[inline(always)]
200    fn from(variant: CRCMODETX_A) -> Self {
201        variant as u8 != 0
202    }
203}
204impl CRCMODETX_R {
205    #[doc = "Get enumerated values variant"]
206    #[inline(always)]
207    pub fn variant(&self) -> CRCMODETX_A {
208        match self.bits {
209            false => CRCMODETX_A::NO_CRCTX,
210            true => CRCMODETX_A::CRC16TX,
211        }
212    }
213    #[doc = "Checks if the value of the field is `NO_CRCTX`"]
214    #[inline(always)]
215    pub fn is_no_crctx(&self) -> bool {
216        *self == CRCMODETX_A::NO_CRCTX
217    }
218    #[doc = "Checks if the value of the field is `CRC16TX`"]
219    #[inline(always)]
220    pub fn is_crc16tx(&self) -> bool {
221        *self == CRCMODETX_A::CRC16TX
222    }
223}
224#[doc = "Field `CRCMODETX` writer - CRC mode for outgoing frames"]
225pub type CRCMODETX_W<'a, const O: u8> = crate::BitWriter<'a, u32, FRAMECONFIG_SPEC, CRCMODETX_A, O>;
226impl<'a, const O: u8> CRCMODETX_W<'a, O> {
227    #[doc = "CRC is not added to the frame"]
228    #[inline(always)]
229    pub fn no_crctx(self) -> &'a mut W {
230        self.variant(CRCMODETX_A::NO_CRCTX)
231    }
232    #[doc = "16 bit CRC added to the frame based on all the data read from RAM that is used in the frame"]
233    #[inline(always)]
234    pub fn crc16tx(self) -> &'a mut W {
235        self.variant(CRCMODETX_A::CRC16TX)
236    }
237}
238impl R {
239    #[doc = "Bit 0 - Indicates if parity is added to the frame"]
240    #[inline(always)]
241    pub fn parity(&self) -> PARITY_R {
242        PARITY_R::new((self.bits & 1) != 0)
243    }
244    #[doc = "Bit 1 - Discarding unused bits at start or end of a frame"]
245    #[inline(always)]
246    pub fn discardmode(&self) -> DISCARDMODE_R {
247        DISCARDMODE_R::new(((self.bits >> 1) & 1) != 0)
248    }
249    #[doc = "Bit 2 - Adding SoF or not in TX frames"]
250    #[inline(always)]
251    pub fn sof(&self) -> SOF_R {
252        SOF_R::new(((self.bits >> 2) & 1) != 0)
253    }
254    #[doc = "Bit 4 - CRC mode for outgoing frames"]
255    #[inline(always)]
256    pub fn crcmodetx(&self) -> CRCMODETX_R {
257        CRCMODETX_R::new(((self.bits >> 4) & 1) != 0)
258    }
259}
260impl W {
261    #[doc = "Bit 0 - Indicates if parity is added to the frame"]
262    #[inline(always)]
263    pub fn parity(&mut self) -> PARITY_W<0> {
264        PARITY_W::new(self)
265    }
266    #[doc = "Bit 1 - Discarding unused bits at start or end of a frame"]
267    #[inline(always)]
268    pub fn discardmode(&mut self) -> DISCARDMODE_W<1> {
269        DISCARDMODE_W::new(self)
270    }
271    #[doc = "Bit 2 - Adding SoF or not in TX frames"]
272    #[inline(always)]
273    pub fn sof(&mut self) -> SOF_W<2> {
274        SOF_W::new(self)
275    }
276    #[doc = "Bit 4 - CRC mode for outgoing frames"]
277    #[inline(always)]
278    pub fn crcmodetx(&mut self) -> CRCMODETX_W<4> {
279        CRCMODETX_W::new(self)
280    }
281    #[doc = "Writes raw bits to the register."]
282    #[inline(always)]
283    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
284        self.0.bits(bits);
285        self
286    }
287}
288#[doc = "Configuration of outgoing 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"]
289pub struct FRAMECONFIG_SPEC;
290impl crate::RegisterSpec for FRAMECONFIG_SPEC {
291    type Ux = u32;
292}
293#[doc = "`read()` method returns [frameconfig::R](R) reader structure"]
294impl crate::Readable for FRAMECONFIG_SPEC {
295    type Reader = R;
296}
297#[doc = "`write(|w| ..)` method takes [frameconfig::W](W) writer structure"]
298impl crate::Writable for FRAMECONFIG_SPEC {
299    type Writer = W;
300}
301#[doc = "`reset()` method sets FRAMECONFIG to value 0x17"]
302impl crate::Resettable for FRAMECONFIG_SPEC {
303    #[inline(always)]
304    fn reset_value() -> Self::Ux {
305        0x17
306    }
307}