nrf51_pac/radio/
crccnf.rs1#[doc = "Register `CRCCNF` reader"]
2pub struct R(crate::R<CRCCNF_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CRCCNF_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CRCCNF_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CRCCNF_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CRCCNF` writer"]
17pub struct W(crate::W<CRCCNF_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CRCCNF_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<CRCCNF_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CRCCNF_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LEN` reader - CRC length. Decision point: START task."]
38pub type LEN_R = crate::FieldReader<u8, LEN_A>;
39#[doc = "CRC length. Decision point: START task.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum LEN_A {
43 #[doc = "0: CRC calculation disabled."]
44 DISABLED = 0,
45 #[doc = "1: One byte long CRC."]
46 ONE = 1,
47 #[doc = "2: Two bytes long CRC."]
48 TWO = 2,
49 #[doc = "3: Three bytes long CRC."]
50 THREE = 3,
51}
52impl From<LEN_A> for u8 {
53 #[inline(always)]
54 fn from(variant: LEN_A) -> Self {
55 variant as _
56 }
57}
58impl LEN_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> LEN_A {
62 match self.bits {
63 0 => LEN_A::DISABLED,
64 1 => LEN_A::ONE,
65 2 => LEN_A::TWO,
66 3 => LEN_A::THREE,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `DISABLED`"]
71 #[inline(always)]
72 pub fn is_disabled(&self) -> bool {
73 *self == LEN_A::DISABLED
74 }
75 #[doc = "Checks if the value of the field is `ONE`"]
76 #[inline(always)]
77 pub fn is_one(&self) -> bool {
78 *self == LEN_A::ONE
79 }
80 #[doc = "Checks if the value of the field is `TWO`"]
81 #[inline(always)]
82 pub fn is_two(&self) -> bool {
83 *self == LEN_A::TWO
84 }
85 #[doc = "Checks if the value of the field is `THREE`"]
86 #[inline(always)]
87 pub fn is_three(&self) -> bool {
88 *self == LEN_A::THREE
89 }
90}
91#[doc = "Field `LEN` writer - CRC length. Decision point: START task."]
92pub type LEN_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CRCCNF_SPEC, u8, LEN_A, 2, O>;
93impl<'a, const O: u8> LEN_W<'a, O> {
94 #[doc = "CRC calculation disabled."]
95 #[inline(always)]
96 pub fn disabled(self) -> &'a mut W {
97 self.variant(LEN_A::DISABLED)
98 }
99 #[doc = "One byte long CRC."]
100 #[inline(always)]
101 pub fn one(self) -> &'a mut W {
102 self.variant(LEN_A::ONE)
103 }
104 #[doc = "Two bytes long CRC."]
105 #[inline(always)]
106 pub fn two(self) -> &'a mut W {
107 self.variant(LEN_A::TWO)
108 }
109 #[doc = "Three bytes long CRC."]
110 #[inline(always)]
111 pub fn three(self) -> &'a mut W {
112 self.variant(LEN_A::THREE)
113 }
114}
115#[doc = "Field `SKIPADDR` reader - Leave packet address field out of the CRC calculation. Decision point: START task."]
116pub type SKIPADDR_R = crate::BitReader<SKIPADDR_A>;
117#[doc = "Leave packet address field out of the CRC calculation. Decision point: START task.\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq)]
119pub enum SKIPADDR_A {
120 #[doc = "0: Include packet address in CRC calculation."]
121 INCLUDE = 0,
122 #[doc = "1: Packet address is skipped in CRC calculation. The CRC calculation will start at the first byte after the address."]
123 SKIP = 1,
124}
125impl From<SKIPADDR_A> for bool {
126 #[inline(always)]
127 fn from(variant: SKIPADDR_A) -> Self {
128 variant as u8 != 0
129 }
130}
131impl SKIPADDR_R {
132 #[doc = "Get enumerated values variant"]
133 #[inline(always)]
134 pub fn variant(&self) -> SKIPADDR_A {
135 match self.bits {
136 false => SKIPADDR_A::INCLUDE,
137 true => SKIPADDR_A::SKIP,
138 }
139 }
140 #[doc = "Checks if the value of the field is `INCLUDE`"]
141 #[inline(always)]
142 pub fn is_include(&self) -> bool {
143 *self == SKIPADDR_A::INCLUDE
144 }
145 #[doc = "Checks if the value of the field is `SKIP`"]
146 #[inline(always)]
147 pub fn is_skip(&self) -> bool {
148 *self == SKIPADDR_A::SKIP
149 }
150}
151#[doc = "Field `SKIPADDR` writer - Leave packet address field out of the CRC calculation. Decision point: START task."]
152pub type SKIPADDR_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRCCNF_SPEC, SKIPADDR_A, O>;
153impl<'a, const O: u8> SKIPADDR_W<'a, O> {
154 #[doc = "Include packet address in CRC calculation."]
155 #[inline(always)]
156 pub fn include(self) -> &'a mut W {
157 self.variant(SKIPADDR_A::INCLUDE)
158 }
159 #[doc = "Packet address is skipped in CRC calculation. The CRC calculation will start at the first byte after the address."]
160 #[inline(always)]
161 pub fn skip(self) -> &'a mut W {
162 self.variant(SKIPADDR_A::SKIP)
163 }
164}
165impl R {
166 #[doc = "Bits 0:1 - CRC length. Decision point: START task."]
167 #[inline(always)]
168 pub fn len(&self) -> LEN_R {
169 LEN_R::new((self.bits & 3) as u8)
170 }
171 #[doc = "Bit 8 - Leave packet address field out of the CRC calculation. Decision point: START task."]
172 #[inline(always)]
173 pub fn skipaddr(&self) -> SKIPADDR_R {
174 SKIPADDR_R::new(((self.bits >> 8) & 1) != 0)
175 }
176}
177impl W {
178 #[doc = "Bits 0:1 - CRC length. Decision point: START task."]
179 #[inline(always)]
180 pub fn len(&mut self) -> LEN_W<0> {
181 LEN_W::new(self)
182 }
183 #[doc = "Bit 8 - Leave packet address field out of the CRC calculation. Decision point: START task."]
184 #[inline(always)]
185 pub fn skipaddr(&mut self) -> SKIPADDR_W<8> {
186 SKIPADDR_W::new(self)
187 }
188 #[doc = "Writes raw bits to the register."]
189 #[inline(always)]
190 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
191 self.0.bits(bits);
192 self
193 }
194}
195#[doc = "CRC configuration.\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 [crccnf](index.html) module"]
196pub struct CRCCNF_SPEC;
197impl crate::RegisterSpec for CRCCNF_SPEC {
198 type Ux = u32;
199}
200#[doc = "`read()` method returns [crccnf::R](R) reader structure"]
201impl crate::Readable for CRCCNF_SPEC {
202 type Reader = R;
203}
204#[doc = "`write(|w| ..)` method takes [crccnf::W](W) writer structure"]
205impl crate::Writable for CRCCNF_SPEC {
206 type Writer = W;
207}
208#[doc = "`reset()` method sets CRCCNF to value 0"]
209impl crate::Resettable for CRCCNF_SPEC {
210 #[inline(always)]
211 fn reset_value() -> Self::Ux {
212 0
213 }
214}