k66/crc/
data.rs

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::DATA {
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 LLR {
47    bits: u8,
48}
49impl LLR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct LUR {
58    bits: u8,
59}
60impl LUR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bits(&self) -> u8 {
64        self.bits
65    }
66}
67#[doc = r" Value of the field"]
68pub struct HLR {
69    bits: u8,
70}
71impl HLR {
72    #[doc = r" Value of the field as raw bits"]
73    #[inline]
74    pub fn bits(&self) -> u8 {
75        self.bits
76    }
77}
78#[doc = r" Value of the field"]
79pub struct HUR {
80    bits: u8,
81}
82impl HUR {
83    #[doc = r" Value of the field as raw bits"]
84    #[inline]
85    pub fn bits(&self) -> u8 {
86        self.bits
87    }
88}
89#[doc = r" Proxy"]
90pub struct _LLW<'a> {
91    w: &'a mut W,
92}
93impl<'a> _LLW<'a> {
94    #[doc = r" Writes raw bits to the field"]
95    #[inline]
96    pub unsafe fn bits(self, value: u8) -> &'a mut W {
97        const MASK: u8 = 255;
98        const OFFSET: u8 = 0;
99        self.w.bits &= !((MASK as u32) << OFFSET);
100        self.w.bits |= ((value & MASK) as u32) << OFFSET;
101        self.w
102    }
103}
104#[doc = r" Proxy"]
105pub struct _LUW<'a> {
106    w: &'a mut W,
107}
108impl<'a> _LUW<'a> {
109    #[doc = r" Writes raw bits to the field"]
110    #[inline]
111    pub unsafe fn bits(self, value: u8) -> &'a mut W {
112        const MASK: u8 = 255;
113        const OFFSET: u8 = 8;
114        self.w.bits &= !((MASK as u32) << OFFSET);
115        self.w.bits |= ((value & MASK) as u32) << OFFSET;
116        self.w
117    }
118}
119#[doc = r" Proxy"]
120pub struct _HLW<'a> {
121    w: &'a mut W,
122}
123impl<'a> _HLW<'a> {
124    #[doc = r" Writes raw bits to the field"]
125    #[inline]
126    pub unsafe fn bits(self, value: u8) -> &'a mut W {
127        const MASK: u8 = 255;
128        const OFFSET: u8 = 16;
129        self.w.bits &= !((MASK as u32) << OFFSET);
130        self.w.bits |= ((value & MASK) as u32) << OFFSET;
131        self.w
132    }
133}
134#[doc = r" Proxy"]
135pub struct _HUW<'a> {
136    w: &'a mut W,
137}
138impl<'a> _HUW<'a> {
139    #[doc = r" Writes raw bits to the field"]
140    #[inline]
141    pub unsafe fn bits(self, value: u8) -> &'a mut W {
142        const MASK: u8 = 255;
143        const OFFSET: u8 = 24;
144        self.w.bits &= !((MASK as u32) << OFFSET);
145        self.w.bits |= ((value & MASK) as u32) << OFFSET;
146        self.w
147    }
148}
149impl R {
150    #[doc = r" Value of the register as raw bits"]
151    #[inline]
152    pub fn bits(&self) -> u32 {
153        self.bits
154    }
155    #[doc = "Bits 0:7 - CRC Low Lower Byte"]
156    #[inline]
157    pub fn ll(&self) -> LLR {
158        let bits = {
159            const MASK: u8 = 255;
160            const OFFSET: u8 = 0;
161            ((self.bits >> OFFSET) & MASK as u32) as u8
162        };
163        LLR { bits }
164    }
165    #[doc = "Bits 8:15 - CRC Low Upper Byte"]
166    #[inline]
167    pub fn lu(&self) -> LUR {
168        let bits = {
169            const MASK: u8 = 255;
170            const OFFSET: u8 = 8;
171            ((self.bits >> OFFSET) & MASK as u32) as u8
172        };
173        LUR { bits }
174    }
175    #[doc = "Bits 16:23 - CRC High Lower Byte"]
176    #[inline]
177    pub fn hl(&self) -> HLR {
178        let bits = {
179            const MASK: u8 = 255;
180            const OFFSET: u8 = 16;
181            ((self.bits >> OFFSET) & MASK as u32) as u8
182        };
183        HLR { bits }
184    }
185    #[doc = "Bits 24:31 - CRC High Upper Byte"]
186    #[inline]
187    pub fn hu(&self) -> HUR {
188        let bits = {
189            const MASK: u8 = 255;
190            const OFFSET: u8 = 24;
191            ((self.bits >> OFFSET) & MASK as u32) as u8
192        };
193        HUR { bits }
194    }
195}
196impl W {
197    #[doc = r" Reset value of the register"]
198    #[inline]
199    pub fn reset_value() -> W {
200        W { bits: 4294967295 }
201    }
202    #[doc = r" Writes raw bits to the register"]
203    #[inline]
204    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
205        self.bits = bits;
206        self
207    }
208    #[doc = "Bits 0:7 - CRC Low Lower Byte"]
209    #[inline]
210    pub fn ll(&mut self) -> _LLW {
211        _LLW { w: self }
212    }
213    #[doc = "Bits 8:15 - CRC Low Upper Byte"]
214    #[inline]
215    pub fn lu(&mut self) -> _LUW {
216        _LUW { w: self }
217    }
218    #[doc = "Bits 16:23 - CRC High Lower Byte"]
219    #[inline]
220    pub fn hl(&mut self) -> _HLW {
221        _HLW { w: self }
222    }
223    #[doc = "Bits 24:31 - CRC High Upper Byte"]
224    #[inline]
225    pub fn hu(&mut self) -> _HUW {
226        _HUW { w: self }
227    }
228}