1#[doc = "Register `SHIFTCFG[%s]` reader"]
2pub type R = crate::R<ShiftcfgSpec>;
3#[doc = "Register `SHIFTCFG[%s]` writer"]
4pub type W = crate::W<ShiftcfgSpec>;
5#[doc = "Shifter Start\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Sstart {
10 #[doc = "0: Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
11 Value00 = 0,
12 #[doc = "1: Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
13 Value01 = 1,
14 #[doc = "2: Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
15 Value10 = 2,
16 #[doc = "3: Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
17 Value11 = 3,
18}
19impl From<Sstart> for u8 {
20 #[inline(always)]
21 fn from(variant: Sstart) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for Sstart {
26 type Ux = u8;
27}
28impl crate::IsEnum for Sstart {}
29#[doc = "Field `SSTART` reader - Shifter Start"]
30pub type SstartR = crate::FieldReader<Sstart>;
31impl SstartR {
32 #[doc = "Get enumerated values variant"]
33 #[inline(always)]
34 pub const fn variant(&self) -> Sstart {
35 match self.bits {
36 0 => Sstart::Value00,
37 1 => Sstart::Value01,
38 2 => Sstart::Value10,
39 3 => Sstart::Value11,
40 _ => unreachable!(),
41 }
42 }
43 #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
44 #[inline(always)]
45 pub fn is_value00(&self) -> bool {
46 *self == Sstart::Value00
47 }
48 #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
49 #[inline(always)]
50 pub fn is_value01(&self) -> bool {
51 *self == Sstart::Value01
52 }
53 #[doc = "Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
54 #[inline(always)]
55 pub fn is_value10(&self) -> bool {
56 *self == Sstart::Value10
57 }
58 #[doc = "Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
59 #[inline(always)]
60 pub fn is_value11(&self) -> bool {
61 *self == Sstart::Value11
62 }
63}
64#[doc = "Field `SSTART` writer - Shifter Start"]
65pub type SstartW<'a, REG> = crate::FieldWriter<'a, REG, 2, Sstart, crate::Safe>;
66impl<'a, REG> SstartW<'a, REG>
67where
68 REG: crate::Writable + crate::RegisterSpec,
69 REG::Ux: From<u8>,
70{
71 #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on enable"]
72 #[inline(always)]
73 pub fn value00(self) -> &'a mut crate::W<REG> {
74 self.variant(Sstart::Value00)
75 }
76 #[doc = "Start bit disabled for Transmitter, Receiver, and Match Store modes; Transmitter mode loads data on first shift"]
77 #[inline(always)]
78 pub fn value01(self) -> &'a mut crate::W<REG> {
79 self.variant(Sstart::Value01)
80 }
81 #[doc = "Transmitter mode outputs start bit value 0 before loading data on first shift; if start bit is not 0, Receiver and Match Store modes set error flag"]
82 #[inline(always)]
83 pub fn value10(self) -> &'a mut crate::W<REG> {
84 self.variant(Sstart::Value10)
85 }
86 #[doc = "Transmitter mode outputs start bit value 1 before loading data on first shift; if start bit is not 1, Receiver and Match Store modes set error flag"]
87 #[inline(always)]
88 pub fn value11(self) -> &'a mut crate::W<REG> {
89 self.variant(Sstart::Value11)
90 }
91}
92#[doc = "Shifter Stop\n\nValue on reset: 0"]
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum Sstop {
97 #[doc = "0: Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
98 Value00 = 0,
99 #[doc = "1: Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
100 Value01 = 1,
101 #[doc = "2: Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
102 Value10 = 2,
103 #[doc = "3: Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
104 Value11 = 3,
105}
106impl From<Sstop> for u8 {
107 #[inline(always)]
108 fn from(variant: Sstop) -> Self {
109 variant as _
110 }
111}
112impl crate::FieldSpec for Sstop {
113 type Ux = u8;
114}
115impl crate::IsEnum for Sstop {}
116#[doc = "Field `SSTOP` reader - Shifter Stop"]
117pub type SstopR = crate::FieldReader<Sstop>;
118impl SstopR {
119 #[doc = "Get enumerated values variant"]
120 #[inline(always)]
121 pub const fn variant(&self) -> Sstop {
122 match self.bits {
123 0 => Sstop::Value00,
124 1 => Sstop::Value01,
125 2 => Sstop::Value10,
126 3 => Sstop::Value11,
127 _ => unreachable!(),
128 }
129 }
130 #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
131 #[inline(always)]
132 pub fn is_value00(&self) -> bool {
133 *self == Sstop::Value00
134 }
135 #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
136 #[inline(always)]
137 pub fn is_value01(&self) -> bool {
138 *self == Sstop::Value01
139 }
140 #[doc = "Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
141 #[inline(always)]
142 pub fn is_value10(&self) -> bool {
143 *self == Sstop::Value10
144 }
145 #[doc = "Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
146 #[inline(always)]
147 pub fn is_value11(&self) -> bool {
148 *self == Sstop::Value11
149 }
150}
151#[doc = "Field `SSTOP` writer - Shifter Stop"]
152pub type SstopW<'a, REG> = crate::FieldWriter<'a, REG, 2, Sstop, crate::Safe>;
153impl<'a, REG> SstopW<'a, REG>
154where
155 REG: crate::Writable + crate::RegisterSpec,
156 REG::Ux: From<u8>,
157{
158 #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes"]
159 #[inline(always)]
160 pub fn value00(self) -> &'a mut crate::W<REG> {
161 self.variant(Sstop::Value00)
162 }
163 #[doc = "Stop bit disabled for Transmitter, Receiver, and Match Store modes; when timer is in stop condition, Receiver and Match Store modes store receive data on the configured shift edge"]
164 #[inline(always)]
165 pub fn value01(self) -> &'a mut crate::W<REG> {
166 self.variant(Sstop::Value01)
167 }
168 #[doc = "Transmitter mode outputs stop bit value 0 in Match Store mode; if stop bit is not 0, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
169 #[inline(always)]
170 pub fn value10(self) -> &'a mut crate::W<REG> {
171 self.variant(Sstop::Value10)
172 }
173 #[doc = "Transmitter mode outputs stop bit value 1 in Match Store mode; if stop bit is not 1, Receiver and Match Store modes set error flag (when timer is in stop condition, these modes also store receive data on the configured shift edge)"]
174 #[inline(always)]
175 pub fn value11(self) -> &'a mut crate::W<REG> {
176 self.variant(Sstop::Value11)
177 }
178}
179#[doc = "Input Source\n\nValue on reset: 0"]
180#[cfg_attr(feature = "defmt", derive(defmt::Format))]
181#[derive(Clone, Copy, Debug, PartialEq, Eq)]
182pub enum Insrc {
183 #[doc = "0: Pin"]
184 Pin = 0,
185 #[doc = "1: Shifter n+1 output"]
186 ShifterNplus1 = 1,
187}
188impl From<Insrc> for bool {
189 #[inline(always)]
190 fn from(variant: Insrc) -> Self {
191 variant as u8 != 0
192 }
193}
194#[doc = "Field `INSRC` reader - Input Source"]
195pub type InsrcR = crate::BitReader<Insrc>;
196impl InsrcR {
197 #[doc = "Get enumerated values variant"]
198 #[inline(always)]
199 pub const fn variant(&self) -> Insrc {
200 match self.bits {
201 false => Insrc::Pin,
202 true => Insrc::ShifterNplus1,
203 }
204 }
205 #[doc = "Pin"]
206 #[inline(always)]
207 pub fn is_pin(&self) -> bool {
208 *self == Insrc::Pin
209 }
210 #[doc = "Shifter n+1 output"]
211 #[inline(always)]
212 pub fn is_shifter_nplus1(&self) -> bool {
213 *self == Insrc::ShifterNplus1
214 }
215}
216#[doc = "Field `INSRC` writer - Input Source"]
217pub type InsrcW<'a, REG> = crate::BitWriter<'a, REG, Insrc>;
218impl<'a, REG> InsrcW<'a, REG>
219where
220 REG: crate::Writable + crate::RegisterSpec,
221{
222 #[doc = "Pin"]
223 #[inline(always)]
224 pub fn pin(self) -> &'a mut crate::W<REG> {
225 self.variant(Insrc::Pin)
226 }
227 #[doc = "Shifter n+1 output"]
228 #[inline(always)]
229 pub fn shifter_nplus1(self) -> &'a mut crate::W<REG> {
230 self.variant(Insrc::ShifterNplus1)
231 }
232}
233#[doc = "Late Store\n\nValue on reset: 0"]
234#[cfg_attr(feature = "defmt", derive(defmt::Format))]
235#[derive(Clone, Copy, Debug, PartialEq, Eq)]
236pub enum Latst {
237 #[doc = "0: Store the pre-shift register state"]
238 Preshift = 0,
239 #[doc = "1: Store the post-shift register state"]
240 Postshift = 1,
241}
242impl From<Latst> for bool {
243 #[inline(always)]
244 fn from(variant: Latst) -> Self {
245 variant as u8 != 0
246 }
247}
248#[doc = "Field `LATST` reader - Late Store"]
249pub type LatstR = crate::BitReader<Latst>;
250impl LatstR {
251 #[doc = "Get enumerated values variant"]
252 #[inline(always)]
253 pub const fn variant(&self) -> Latst {
254 match self.bits {
255 false => Latst::Preshift,
256 true => Latst::Postshift,
257 }
258 }
259 #[doc = "Store the pre-shift register state"]
260 #[inline(always)]
261 pub fn is_preshift(&self) -> bool {
262 *self == Latst::Preshift
263 }
264 #[doc = "Store the post-shift register state"]
265 #[inline(always)]
266 pub fn is_postshift(&self) -> bool {
267 *self == Latst::Postshift
268 }
269}
270#[doc = "Field `LATST` writer - Late Store"]
271pub type LatstW<'a, REG> = crate::BitWriter<'a, REG, Latst>;
272impl<'a, REG> LatstW<'a, REG>
273where
274 REG: crate::Writable + crate::RegisterSpec,
275{
276 #[doc = "Store the pre-shift register state"]
277 #[inline(always)]
278 pub fn preshift(self) -> &'a mut crate::W<REG> {
279 self.variant(Latst::Preshift)
280 }
281 #[doc = "Store the post-shift register state"]
282 #[inline(always)]
283 pub fn postshift(self) -> &'a mut crate::W<REG> {
284 self.variant(Latst::Postshift)
285 }
286}
287#[doc = "Shifter Size\n\nValue on reset: 0"]
288#[cfg_attr(feature = "defmt", derive(defmt::Format))]
289#[derive(Clone, Copy, Debug, PartialEq, Eq)]
290pub enum Ssize {
291 #[doc = "0: 32-bit"]
292 Width32 = 0,
293 #[doc = "1: 24-bit"]
294 Width24 = 1,
295}
296impl From<Ssize> for bool {
297 #[inline(always)]
298 fn from(variant: Ssize) -> Self {
299 variant as u8 != 0
300 }
301}
302#[doc = "Field `SSIZE` reader - Shifter Size"]
303pub type SsizeR = crate::BitReader<Ssize>;
304impl SsizeR {
305 #[doc = "Get enumerated values variant"]
306 #[inline(always)]
307 pub const fn variant(&self) -> Ssize {
308 match self.bits {
309 false => Ssize::Width32,
310 true => Ssize::Width24,
311 }
312 }
313 #[doc = "32-bit"]
314 #[inline(always)]
315 pub fn is_width32(&self) -> bool {
316 *self == Ssize::Width32
317 }
318 #[doc = "24-bit"]
319 #[inline(always)]
320 pub fn is_width24(&self) -> bool {
321 *self == Ssize::Width24
322 }
323}
324#[doc = "Field `SSIZE` writer - Shifter Size"]
325pub type SsizeW<'a, REG> = crate::BitWriter<'a, REG, Ssize>;
326impl<'a, REG> SsizeW<'a, REG>
327where
328 REG: crate::Writable + crate::RegisterSpec,
329{
330 #[doc = "32-bit"]
331 #[inline(always)]
332 pub fn width32(self) -> &'a mut crate::W<REG> {
333 self.variant(Ssize::Width32)
334 }
335 #[doc = "24-bit"]
336 #[inline(always)]
337 pub fn width24(self) -> &'a mut crate::W<REG> {
338 self.variant(Ssize::Width24)
339 }
340}
341#[doc = "Field `PWIDTH` reader - Parallel Width"]
342pub type PwidthR = crate::FieldReader;
343#[doc = "Field `PWIDTH` writer - Parallel Width"]
344pub type PwidthW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
345impl R {
346 #[doc = "Bits 0:1 - Shifter Start"]
347 #[inline(always)]
348 pub fn sstart(&self) -> SstartR {
349 SstartR::new((self.bits & 3) as u8)
350 }
351 #[doc = "Bits 4:5 - Shifter Stop"]
352 #[inline(always)]
353 pub fn sstop(&self) -> SstopR {
354 SstopR::new(((self.bits >> 4) & 3) as u8)
355 }
356 #[doc = "Bit 8 - Input Source"]
357 #[inline(always)]
358 pub fn insrc(&self) -> InsrcR {
359 InsrcR::new(((self.bits >> 8) & 1) != 0)
360 }
361 #[doc = "Bit 9 - Late Store"]
362 #[inline(always)]
363 pub fn latst(&self) -> LatstR {
364 LatstR::new(((self.bits >> 9) & 1) != 0)
365 }
366 #[doc = "Bit 12 - Shifter Size"]
367 #[inline(always)]
368 pub fn ssize(&self) -> SsizeR {
369 SsizeR::new(((self.bits >> 12) & 1) != 0)
370 }
371 #[doc = "Bits 16:20 - Parallel Width"]
372 #[inline(always)]
373 pub fn pwidth(&self) -> PwidthR {
374 PwidthR::new(((self.bits >> 16) & 0x1f) as u8)
375 }
376}
377#[cfg(feature = "debug")]
378impl core::fmt::Debug for R {
379 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
380 f.debug_struct("SHIFTCFG")
381 .field("sstart", &self.sstart())
382 .field("sstop", &self.sstop())
383 .field("insrc", &self.insrc())
384 .field("latst", &self.latst())
385 .field("ssize", &self.ssize())
386 .field("pwidth", &self.pwidth())
387 .finish()
388 }
389}
390impl W {
391 #[doc = "Bits 0:1 - Shifter Start"]
392 #[inline(always)]
393 pub fn sstart(&mut self) -> SstartW<'_, ShiftcfgSpec> {
394 SstartW::new(self, 0)
395 }
396 #[doc = "Bits 4:5 - Shifter Stop"]
397 #[inline(always)]
398 pub fn sstop(&mut self) -> SstopW<'_, ShiftcfgSpec> {
399 SstopW::new(self, 4)
400 }
401 #[doc = "Bit 8 - Input Source"]
402 #[inline(always)]
403 pub fn insrc(&mut self) -> InsrcW<'_, ShiftcfgSpec> {
404 InsrcW::new(self, 8)
405 }
406 #[doc = "Bit 9 - Late Store"]
407 #[inline(always)]
408 pub fn latst(&mut self) -> LatstW<'_, ShiftcfgSpec> {
409 LatstW::new(self, 9)
410 }
411 #[doc = "Bit 12 - Shifter Size"]
412 #[inline(always)]
413 pub fn ssize(&mut self) -> SsizeW<'_, ShiftcfgSpec> {
414 SsizeW::new(self, 12)
415 }
416 #[doc = "Bits 16:20 - Parallel Width"]
417 #[inline(always)]
418 pub fn pwidth(&mut self) -> PwidthW<'_, ShiftcfgSpec> {
419 PwidthW::new(self, 16)
420 }
421}
422#[doc = "Shifter Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`shiftcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`shiftcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
423pub struct ShiftcfgSpec;
424impl crate::RegisterSpec for ShiftcfgSpec {
425 type Ux = u32;
426}
427#[doc = "`read()` method returns [`shiftcfg::R`](R) reader structure"]
428impl crate::Readable for ShiftcfgSpec {}
429#[doc = "`write(|w| ..)` method takes [`shiftcfg::W`](W) writer structure"]
430impl crate::Writable for ShiftcfgSpec {
431 type Safety = crate::Unsafe;
432}
433#[doc = "`reset()` method sets SHIFTCFG[%s] to value 0"]
434impl crate::Resettable for ShiftcfgSpec {}