1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::CR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct REV_OUTR {
47 bits: bool,
48}
49impl REV_OUTR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct REV_INR {
68 bits: u8,
69}
70impl REV_INR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bits(&self) -> u8 {
74 self.bits
75 }
76}
77#[doc = r" Value of the field"]
78pub struct POLYSIZER {
79 bits: u8,
80}
81impl POLYSIZER {
82 #[doc = r" Value of the field as raw bits"]
83 #[inline]
84 pub fn bits(&self) -> u8 {
85 self.bits
86 }
87}
88#[doc = r" Proxy"]
89pub struct _REV_OUTW<'a> {
90 w: &'a mut W,
91}
92impl<'a> _REV_OUTW<'a> {
93 #[doc = r" Sets the field bit"]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r" Clears the field bit"]
98 pub fn clear_bit(self) -> &'a mut W {
99 self.bit(false)
100 }
101 #[doc = r" Writes raw bits to the field"]
102 #[inline]
103 pub fn bit(self, value: bool) -> &'a mut W {
104 const MASK: bool = true;
105 const OFFSET: u8 = 7;
106 self.w.bits &= !((MASK as u32) << OFFSET);
107 self.w.bits |= ((value & MASK) as u32) << OFFSET;
108 self.w
109 }
110}
111#[doc = r" Proxy"]
112pub struct _REV_INW<'a> {
113 w: &'a mut W,
114}
115impl<'a> _REV_INW<'a> {
116 #[doc = r" Writes raw bits to the field"]
117 #[inline]
118 pub unsafe fn bits(self, value: u8) -> &'a mut W {
119 const MASK: u8 = 3;
120 const OFFSET: u8 = 5;
121 self.w.bits &= !((MASK as u32) << OFFSET);
122 self.w.bits |= ((value & MASK) as u32) << OFFSET;
123 self.w
124 }
125}
126#[doc = r" Proxy"]
127pub struct _POLYSIZEW<'a> {
128 w: &'a mut W,
129}
130impl<'a> _POLYSIZEW<'a> {
131 #[doc = r" Writes raw bits to the field"]
132 #[inline]
133 pub unsafe fn bits(self, value: u8) -> &'a mut W {
134 const MASK: u8 = 3;
135 const OFFSET: u8 = 3;
136 self.w.bits &= !((MASK as u32) << OFFSET);
137 self.w.bits |= ((value & MASK) as u32) << OFFSET;
138 self.w
139 }
140}
141#[doc = "Values that can be written to the field `RESET`"]
142pub enum RESETW {
143 #[doc = "Resets the CRC calculation unit and sets the data register to 0xFFFF FFFF"]
144 RESET,
145}
146impl RESETW {
147 #[allow(missing_docs)]
148 #[doc(hidden)]
149 #[inline]
150 pub fn _bits(&self) -> bool {
151 match *self {
152 RESETW::RESET => true,
153 }
154 }
155}
156#[doc = r" Proxy"]
157pub struct _RESETW<'a> {
158 w: &'a mut W,
159}
160impl<'a> _RESETW<'a> {
161 #[doc = r" Writes `variant` to the field"]
162 #[inline]
163 pub fn variant(self, variant: RESETW) -> &'a mut W {
164 {
165 self.bit(variant._bits())
166 }
167 }
168 #[doc = "Resets the CRC calculation unit and sets the data register to 0xFFFF FFFF"]
169 #[inline]
170 pub fn reset(self) -> &'a mut W {
171 self.variant(RESETW::RESET)
172 }
173 #[doc = r" Sets the field bit"]
174 pub fn set_bit(self) -> &'a mut W {
175 self.bit(true)
176 }
177 #[doc = r" Clears the field bit"]
178 pub fn clear_bit(self) -> &'a mut W {
179 self.bit(false)
180 }
181 #[doc = r" Writes raw bits to the field"]
182 #[inline]
183 pub fn bit(self, value: bool) -> &'a mut W {
184 const MASK: bool = true;
185 const OFFSET: u8 = 0;
186 self.w.bits &= !((MASK as u32) << OFFSET);
187 self.w.bits |= ((value & MASK) as u32) << OFFSET;
188 self.w
189 }
190}
191impl R {
192 #[doc = r" Value of the register as raw bits"]
193 #[inline]
194 pub fn bits(&self) -> u32 {
195 self.bits
196 }
197 #[doc = "Bit 7 - Reverse output data"]
198 #[inline]
199 pub fn rev_out(&self) -> REV_OUTR {
200 let bits = {
201 const MASK: bool = true;
202 const OFFSET: u8 = 7;
203 ((self.bits >> OFFSET) & MASK as u32) != 0
204 };
205 REV_OUTR { bits }
206 }
207 #[doc = "Bits 5:6 - Reverse input data"]
208 #[inline]
209 pub fn rev_in(&self) -> REV_INR {
210 let bits = {
211 const MASK: u8 = 3;
212 const OFFSET: u8 = 5;
213 ((self.bits >> OFFSET) & MASK as u32) as u8
214 };
215 REV_INR { bits }
216 }
217 #[doc = "Bits 3:4 - Polynomial size"]
218 #[inline]
219 pub fn polysize(&self) -> POLYSIZER {
220 let bits = {
221 const MASK: u8 = 3;
222 const OFFSET: u8 = 3;
223 ((self.bits >> OFFSET) & MASK as u32) as u8
224 };
225 POLYSIZER { bits }
226 }
227}
228impl W {
229 #[doc = r" Reset value of the register"]
230 #[inline]
231 pub fn reset_value() -> W {
232 W { bits: 0 }
233 }
234 #[doc = r" Writes raw bits to the register"]
235 #[inline]
236 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
237 self.bits = bits;
238 self
239 }
240 #[doc = "Bit 7 - Reverse output data"]
241 #[inline]
242 pub fn rev_out(&mut self) -> _REV_OUTW {
243 _REV_OUTW { w: self }
244 }
245 #[doc = "Bits 5:6 - Reverse input data"]
246 #[inline]
247 pub fn rev_in(&mut self) -> _REV_INW {
248 _REV_INW { w: self }
249 }
250 #[doc = "Bits 3:4 - Polynomial size"]
251 #[inline]
252 pub fn polysize(&mut self) -> _POLYSIZEW {
253 _POLYSIZEW { w: self }
254 }
255 #[doc = "Bit 0 - RESET bit"]
256 #[inline]
257 pub fn reset(&mut self) -> _RESETW {
258 _RESETW { w: self }
259 }
260}