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::CTAR_SLAVE {
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 = "Possible values of the field `CPHA`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum CPHAR {
48 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
49 _0,
50 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
51 _1,
52}
53impl CPHAR {
54 #[doc = r" Returns `true` if the bit is clear (0)"]
55 #[inline]
56 pub fn bit_is_clear(&self) -> bool {
57 !self.bit()
58 }
59 #[doc = r" Returns `true` if the bit is set (1)"]
60 #[inline]
61 pub fn bit_is_set(&self) -> bool {
62 self.bit()
63 }
64 #[doc = r" Value of the field as raw bits"]
65 #[inline]
66 pub fn bit(&self) -> bool {
67 match *self {
68 CPHAR::_0 => false,
69 CPHAR::_1 => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> CPHAR {
76 match value {
77 false => CPHAR::_0,
78 true => CPHAR::_1,
79 }
80 }
81 #[doc = "Checks if the value of the field is `_0`"]
82 #[inline]
83 pub fn is_0(&self) -> bool {
84 *self == CPHAR::_0
85 }
86 #[doc = "Checks if the value of the field is `_1`"]
87 #[inline]
88 pub fn is_1(&self) -> bool {
89 *self == CPHAR::_1
90 }
91}
92#[doc = "Possible values of the field `CPOL`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum CPOLR {
95 #[doc = "The inactive state value of SCK is low."]
96 _0,
97 #[doc = "The inactive state value of SCK is high."]
98 _1,
99}
100impl CPOLR {
101 #[doc = r" Returns `true` if the bit is clear (0)"]
102 #[inline]
103 pub fn bit_is_clear(&self) -> bool {
104 !self.bit()
105 }
106 #[doc = r" Returns `true` if the bit is set (1)"]
107 #[inline]
108 pub fn bit_is_set(&self) -> bool {
109 self.bit()
110 }
111 #[doc = r" Value of the field as raw bits"]
112 #[inline]
113 pub fn bit(&self) -> bool {
114 match *self {
115 CPOLR::_0 => false,
116 CPOLR::_1 => true,
117 }
118 }
119 #[allow(missing_docs)]
120 #[doc(hidden)]
121 #[inline]
122 pub fn _from(value: bool) -> CPOLR {
123 match value {
124 false => CPOLR::_0,
125 true => CPOLR::_1,
126 }
127 }
128 #[doc = "Checks if the value of the field is `_0`"]
129 #[inline]
130 pub fn is_0(&self) -> bool {
131 *self == CPOLR::_0
132 }
133 #[doc = "Checks if the value of the field is `_1`"]
134 #[inline]
135 pub fn is_1(&self) -> bool {
136 *self == CPOLR::_1
137 }
138}
139#[doc = r" Value of the field"]
140pub struct FMSZR {
141 bits: u8,
142}
143impl FMSZR {
144 #[doc = r" Value of the field as raw bits"]
145 #[inline]
146 pub fn bits(&self) -> u8 {
147 self.bits
148 }
149}
150#[doc = "Values that can be written to the field `CPHA`"]
151pub enum CPHAW {
152 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
153 _0,
154 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
155 _1,
156}
157impl CPHAW {
158 #[allow(missing_docs)]
159 #[doc(hidden)]
160 #[inline]
161 pub fn _bits(&self) -> bool {
162 match *self {
163 CPHAW::_0 => false,
164 CPHAW::_1 => true,
165 }
166 }
167}
168#[doc = r" Proxy"]
169pub struct _CPHAW<'a> {
170 w: &'a mut W,
171}
172impl<'a> _CPHAW<'a> {
173 #[doc = r" Writes `variant` to the field"]
174 #[inline]
175 pub fn variant(self, variant: CPHAW) -> &'a mut W {
176 {
177 self.bit(variant._bits())
178 }
179 }
180 #[doc = "Data is captured on the leading edge of SCK and changed on the following edge."]
181 #[inline]
182 pub fn _0(self) -> &'a mut W {
183 self.variant(CPHAW::_0)
184 }
185 #[doc = "Data is changed on the leading edge of SCK and captured on the following edge."]
186 #[inline]
187 pub fn _1(self) -> &'a mut W {
188 self.variant(CPHAW::_1)
189 }
190 #[doc = r" Sets the field bit"]
191 pub fn set_bit(self) -> &'a mut W {
192 self.bit(true)
193 }
194 #[doc = r" Clears the field bit"]
195 pub fn clear_bit(self) -> &'a mut W {
196 self.bit(false)
197 }
198 #[doc = r" Writes raw bits to the field"]
199 #[inline]
200 pub fn bit(self, value: bool) -> &'a mut W {
201 const MASK: bool = true;
202 const OFFSET: u8 = 25;
203 self.w.bits &= !((MASK as u32) << OFFSET);
204 self.w.bits |= ((value & MASK) as u32) << OFFSET;
205 self.w
206 }
207}
208#[doc = "Values that can be written to the field `CPOL`"]
209pub enum CPOLW {
210 #[doc = "The inactive state value of SCK is low."]
211 _0,
212 #[doc = "The inactive state value of SCK is high."]
213 _1,
214}
215impl CPOLW {
216 #[allow(missing_docs)]
217 #[doc(hidden)]
218 #[inline]
219 pub fn _bits(&self) -> bool {
220 match *self {
221 CPOLW::_0 => false,
222 CPOLW::_1 => true,
223 }
224 }
225}
226#[doc = r" Proxy"]
227pub struct _CPOLW<'a> {
228 w: &'a mut W,
229}
230impl<'a> _CPOLW<'a> {
231 #[doc = r" Writes `variant` to the field"]
232 #[inline]
233 pub fn variant(self, variant: CPOLW) -> &'a mut W {
234 {
235 self.bit(variant._bits())
236 }
237 }
238 #[doc = "The inactive state value of SCK is low."]
239 #[inline]
240 pub fn _0(self) -> &'a mut W {
241 self.variant(CPOLW::_0)
242 }
243 #[doc = "The inactive state value of SCK is high."]
244 #[inline]
245 pub fn _1(self) -> &'a mut W {
246 self.variant(CPOLW::_1)
247 }
248 #[doc = r" Sets the field bit"]
249 pub fn set_bit(self) -> &'a mut W {
250 self.bit(true)
251 }
252 #[doc = r" Clears the field bit"]
253 pub fn clear_bit(self) -> &'a mut W {
254 self.bit(false)
255 }
256 #[doc = r" Writes raw bits to the field"]
257 #[inline]
258 pub fn bit(self, value: bool) -> &'a mut W {
259 const MASK: bool = true;
260 const OFFSET: u8 = 26;
261 self.w.bits &= !((MASK as u32) << OFFSET);
262 self.w.bits |= ((value & MASK) as u32) << OFFSET;
263 self.w
264 }
265}
266#[doc = r" Proxy"]
267pub struct _FMSZW<'a> {
268 w: &'a mut W,
269}
270impl<'a> _FMSZW<'a> {
271 #[doc = r" Writes raw bits to the field"]
272 #[inline]
273 pub unsafe fn bits(self, value: u8) -> &'a mut W {
274 const MASK: u8 = 15;
275 const OFFSET: u8 = 27;
276 self.w.bits &= !((MASK as u32) << OFFSET);
277 self.w.bits |= ((value & MASK) as u32) << OFFSET;
278 self.w
279 }
280}
281impl R {
282 #[doc = r" Value of the register as raw bits"]
283 #[inline]
284 pub fn bits(&self) -> u32 {
285 self.bits
286 }
287 #[doc = "Bit 25 - Clock Phase"]
288 #[inline]
289 pub fn cpha(&self) -> CPHAR {
290 CPHAR::_from({
291 const MASK: bool = true;
292 const OFFSET: u8 = 25;
293 ((self.bits >> OFFSET) & MASK as u32) != 0
294 })
295 }
296 #[doc = "Bit 26 - Clock Polarity"]
297 #[inline]
298 pub fn cpol(&self) -> CPOLR {
299 CPOLR::_from({
300 const MASK: bool = true;
301 const OFFSET: u8 = 26;
302 ((self.bits >> OFFSET) & MASK as u32) != 0
303 })
304 }
305 #[doc = "Bits 27:30 - Frame Size"]
306 #[inline]
307 pub fn fmsz(&self) -> FMSZR {
308 let bits = {
309 const MASK: u8 = 15;
310 const OFFSET: u8 = 27;
311 ((self.bits >> OFFSET) & MASK as u32) as u8
312 };
313 FMSZR { bits }
314 }
315}
316impl W {
317 #[doc = r" Reset value of the register"]
318 #[inline]
319 pub fn reset_value() -> W {
320 W { bits: 2013265920 }
321 }
322 #[doc = r" Writes raw bits to the register"]
323 #[inline]
324 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
325 self.bits = bits;
326 self
327 }
328 #[doc = "Bit 25 - Clock Phase"]
329 #[inline]
330 pub fn cpha(&mut self) -> _CPHAW {
331 _CPHAW { w: self }
332 }
333 #[doc = "Bit 26 - Clock Polarity"]
334 #[inline]
335 pub fn cpol(&mut self) -> _CPOLW {
336 _CPOLW { w: self }
337 }
338 #[doc = "Bits 27:30 - Frame Size"]
339 #[inline]
340 pub fn fmsz(&mut self) -> _FMSZW {
341 _FMSZW { w: self }
342 }
343}