1#[doc = "Reader of register CR2"]
2pub type R = crate::R<u32, super::CR2>;
3#[doc = "Writer for register CR2"]
4pub type W = crate::W<u32, super::CR2>;
5#[doc = "Register CR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR2 {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `PECBYTE`"]
14pub type PECBYTE_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `PECBYTE`"]
16pub struct PECBYTE_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> PECBYTE_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !(0x01 << 26)) | (((value as u32) & 0x01) << 26);
34 self.w
35 }
36}
37#[doc = "Reader of field `AUTOEND`"]
38pub type AUTOEND_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `AUTOEND`"]
40pub struct AUTOEND_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> AUTOEND_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25);
58 self.w
59 }
60}
61#[doc = "Reader of field `RELOAD`"]
62pub type RELOAD_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `RELOAD`"]
64pub struct RELOAD_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> RELOAD_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24);
82 self.w
83 }
84}
85#[doc = "Reader of field `NBYTES`"]
86pub type NBYTES_R = crate::R<u8, u8>;
87#[doc = "Write proxy for field `NBYTES`"]
88pub struct NBYTES_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> NBYTES_W<'a> {
92 #[doc = r"Writes raw bits to the field"]
93 #[inline(always)]
94 pub unsafe fn bits(self, value: u8) -> &'a mut W {
95 self.w.bits = (self.w.bits & !(0xff << 16)) | (((value as u32) & 0xff) << 16);
96 self.w
97 }
98}
99#[doc = "Reader of field `NACK`"]
100pub type NACK_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `NACK`"]
102pub struct NACK_W<'a> {
103 w: &'a mut W,
104}
105impl<'a> NACK_W<'a> {
106 #[doc = r"Sets the field bit"]
107 #[inline(always)]
108 pub fn set_bit(self) -> &'a mut W {
109 self.bit(true)
110 }
111 #[doc = r"Clears the field bit"]
112 #[inline(always)]
113 pub fn clear_bit(self) -> &'a mut W {
114 self.bit(false)
115 }
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub fn bit(self, value: bool) -> &'a mut W {
119 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
120 self.w
121 }
122}
123#[doc = "Reader of field `STOP`"]
124pub type STOP_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `STOP`"]
126pub struct STOP_W<'a> {
127 w: &'a mut W,
128}
129impl<'a> STOP_W<'a> {
130 #[doc = r"Sets the field bit"]
131 #[inline(always)]
132 pub fn set_bit(self) -> &'a mut W {
133 self.bit(true)
134 }
135 #[doc = r"Clears the field bit"]
136 #[inline(always)]
137 pub fn clear_bit(self) -> &'a mut W {
138 self.bit(false)
139 }
140 #[doc = r"Writes raw bits to the field"]
141 #[inline(always)]
142 pub fn bit(self, value: bool) -> &'a mut W {
143 self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
144 self.w
145 }
146}
147#[doc = "Reader of field `START`"]
148pub type START_R = crate::R<bool, bool>;
149#[doc = "Write proxy for field `START`"]
150pub struct START_W<'a> {
151 w: &'a mut W,
152}
153impl<'a> START_W<'a> {
154 #[doc = r"Sets the field bit"]
155 #[inline(always)]
156 pub fn set_bit(self) -> &'a mut W {
157 self.bit(true)
158 }
159 #[doc = r"Clears the field bit"]
160 #[inline(always)]
161 pub fn clear_bit(self) -> &'a mut W {
162 self.bit(false)
163 }
164 #[doc = r"Writes raw bits to the field"]
165 #[inline(always)]
166 pub fn bit(self, value: bool) -> &'a mut W {
167 self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
168 self.w
169 }
170}
171#[doc = "Reader of field `HEAD10R`"]
172pub type HEAD10R_R = crate::R<bool, bool>;
173#[doc = "Write proxy for field `HEAD10R`"]
174pub struct HEAD10R_W<'a> {
175 w: &'a mut W,
176}
177impl<'a> HEAD10R_W<'a> {
178 #[doc = r"Sets the field bit"]
179 #[inline(always)]
180 pub fn set_bit(self) -> &'a mut W {
181 self.bit(true)
182 }
183 #[doc = r"Clears the field bit"]
184 #[inline(always)]
185 pub fn clear_bit(self) -> &'a mut W {
186 self.bit(false)
187 }
188 #[doc = r"Writes raw bits to the field"]
189 #[inline(always)]
190 pub fn bit(self, value: bool) -> &'a mut W {
191 self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
192 self.w
193 }
194}
195#[doc = "Reader of field `ADD10`"]
196pub type ADD10_R = crate::R<bool, bool>;
197#[doc = "Write proxy for field `ADD10`"]
198pub struct ADD10_W<'a> {
199 w: &'a mut W,
200}
201impl<'a> ADD10_W<'a> {
202 #[doc = r"Sets the field bit"]
203 #[inline(always)]
204 pub fn set_bit(self) -> &'a mut W {
205 self.bit(true)
206 }
207 #[doc = r"Clears the field bit"]
208 #[inline(always)]
209 pub fn clear_bit(self) -> &'a mut W {
210 self.bit(false)
211 }
212 #[doc = r"Writes raw bits to the field"]
213 #[inline(always)]
214 pub fn bit(self, value: bool) -> &'a mut W {
215 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
216 self.w
217 }
218}
219#[doc = "Reader of field `RD_WRN`"]
220pub type RD_WRN_R = crate::R<bool, bool>;
221#[doc = "Write proxy for field `RD_WRN`"]
222pub struct RD_WRN_W<'a> {
223 w: &'a mut W,
224}
225impl<'a> RD_WRN_W<'a> {
226 #[doc = r"Sets the field bit"]
227 #[inline(always)]
228 pub fn set_bit(self) -> &'a mut W {
229 self.bit(true)
230 }
231 #[doc = r"Clears the field bit"]
232 #[inline(always)]
233 pub fn clear_bit(self) -> &'a mut W {
234 self.bit(false)
235 }
236 #[doc = r"Writes raw bits to the field"]
237 #[inline(always)]
238 pub fn bit(self, value: bool) -> &'a mut W {
239 self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
240 self.w
241 }
242}
243#[doc = "Reader of field `SADD`"]
244pub type SADD_R = crate::R<u16, u16>;
245#[doc = "Write proxy for field `SADD`"]
246pub struct SADD_W<'a> {
247 w: &'a mut W,
248}
249impl<'a> SADD_W<'a> {
250 #[doc = r"Writes raw bits to the field"]
251 #[inline(always)]
252 pub unsafe fn bits(self, value: u16) -> &'a mut W {
253 self.w.bits = (self.w.bits & !0x03ff) | ((value as u32) & 0x03ff);
254 self.w
255 }
256}
257impl R {
258 #[doc = "Bit 26 - Packet error checking byte"]
259 #[inline(always)]
260 pub fn pecbyte(&self) -> PECBYTE_R {
261 PECBYTE_R::new(((self.bits >> 26) & 0x01) != 0)
262 }
263 #[doc = "Bit 25 - Automatic end mode (master mode)"]
264 #[inline(always)]
265 pub fn autoend(&self) -> AUTOEND_R {
266 AUTOEND_R::new(((self.bits >> 25) & 0x01) != 0)
267 }
268 #[doc = "Bit 24 - NBYTES reload mode"]
269 #[inline(always)]
270 pub fn reload(&self) -> RELOAD_R {
271 RELOAD_R::new(((self.bits >> 24) & 0x01) != 0)
272 }
273 #[doc = "Bits 16:23 - Number of bytes"]
274 #[inline(always)]
275 pub fn nbytes(&self) -> NBYTES_R {
276 NBYTES_R::new(((self.bits >> 16) & 0xff) as u8)
277 }
278 #[doc = "Bit 15 - NACK generation (slave mode)"]
279 #[inline(always)]
280 pub fn nack(&self) -> NACK_R {
281 NACK_R::new(((self.bits >> 15) & 0x01) != 0)
282 }
283 #[doc = "Bit 14 - Stop generation (master mode)"]
284 #[inline(always)]
285 pub fn stop(&self) -> STOP_R {
286 STOP_R::new(((self.bits >> 14) & 0x01) != 0)
287 }
288 #[doc = "Bit 13 - Start generation"]
289 #[inline(always)]
290 pub fn start(&self) -> START_R {
291 START_R::new(((self.bits >> 13) & 0x01) != 0)
292 }
293 #[doc = "Bit 12 - 10-bit address header only read direction (master receiver mode)"]
294 #[inline(always)]
295 pub fn head10r(&self) -> HEAD10R_R {
296 HEAD10R_R::new(((self.bits >> 12) & 0x01) != 0)
297 }
298 #[doc = "Bit 11 - 10-bit addressing mode (master mode)"]
299 #[inline(always)]
300 pub fn add10(&self) -> ADD10_R {
301 ADD10_R::new(((self.bits >> 11) & 0x01) != 0)
302 }
303 #[doc = "Bit 10 - Transfer direction (master mode)"]
304 #[inline(always)]
305 pub fn rd_wrn(&self) -> RD_WRN_R {
306 RD_WRN_R::new(((self.bits >> 10) & 0x01) != 0)
307 }
308 #[doc = "Bits 0:9 - Slave address bit (master mode)"]
309 #[inline(always)]
310 pub fn sadd(&self) -> SADD_R {
311 SADD_R::new((self.bits & 0x03ff) as u16)
312 }
313}
314impl W {
315 #[doc = "Bit 26 - Packet error checking byte"]
316 #[inline(always)]
317 pub fn pecbyte(&mut self) -> PECBYTE_W {
318 PECBYTE_W { w: self }
319 }
320 #[doc = "Bit 25 - Automatic end mode (master mode)"]
321 #[inline(always)]
322 pub fn autoend(&mut self) -> AUTOEND_W {
323 AUTOEND_W { w: self }
324 }
325 #[doc = "Bit 24 - NBYTES reload mode"]
326 #[inline(always)]
327 pub fn reload(&mut self) -> RELOAD_W {
328 RELOAD_W { w: self }
329 }
330 #[doc = "Bits 16:23 - Number of bytes"]
331 #[inline(always)]
332 pub fn nbytes(&mut self) -> NBYTES_W {
333 NBYTES_W { w: self }
334 }
335 #[doc = "Bit 15 - NACK generation (slave mode)"]
336 #[inline(always)]
337 pub fn nack(&mut self) -> NACK_W {
338 NACK_W { w: self }
339 }
340 #[doc = "Bit 14 - Stop generation (master mode)"]
341 #[inline(always)]
342 pub fn stop(&mut self) -> STOP_W {
343 STOP_W { w: self }
344 }
345 #[doc = "Bit 13 - Start generation"]
346 #[inline(always)]
347 pub fn start(&mut self) -> START_W {
348 START_W { w: self }
349 }
350 #[doc = "Bit 12 - 10-bit address header only read direction (master receiver mode)"]
351 #[inline(always)]
352 pub fn head10r(&mut self) -> HEAD10R_W {
353 HEAD10R_W { w: self }
354 }
355 #[doc = "Bit 11 - 10-bit addressing mode (master mode)"]
356 #[inline(always)]
357 pub fn add10(&mut self) -> ADD10_W {
358 ADD10_W { w: self }
359 }
360 #[doc = "Bit 10 - Transfer direction (master mode)"]
361 #[inline(always)]
362 pub fn rd_wrn(&mut self) -> RD_WRN_W {
363 RD_WRN_W { w: self }
364 }
365 #[doc = "Bits 0:9 - Slave address bit (master mode)"]
366 #[inline(always)]
367 pub fn sadd(&mut self) -> SADD_W {
368 SADD_W { w: self }
369 }
370}