1#[doc = "Register `SHIFTCTL[%s]` reader"]
2pub type R = crate::R<ShiftctlSpec>;
3#[doc = "Register `SHIFTCTL[%s]` writer"]
4pub type W = crate::W<ShiftctlSpec>;
5#[doc = "Shifter Mode\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 Smod {
10 #[doc = "0: Disable"]
11 Disable = 0,
12 #[doc = "1: Receive mode; capture the current shifter content into SHIFTBUF on expiration of the timer"]
13 Receive = 1,
14 #[doc = "2: Transmit mode; load SHIFTBUF contents into the shifter on expiration of the timer"]
15 Transmit = 2,
16 #[doc = "4: Match Store mode; shifter data is compared to SHIFTBUF content on expiration of the timer"]
17 Matchstore = 4,
18 #[doc = "5: Match Continuous mode; shifter data is continuously compared to SHIFTBUF contents"]
19 Matchcont = 5,
20 #[doc = "6: State mode; SHIFTBUF contents store programmable state attributes"]
21 State = 6,
22 #[doc = "7: Logic mode; SHIFTBUF contents implement programmable logic lookup table"]
23 Logic = 7,
24}
25impl From<Smod> for u8 {
26 #[inline(always)]
27 fn from(variant: Smod) -> Self {
28 variant as _
29 }
30}
31impl crate::FieldSpec for Smod {
32 type Ux = u8;
33}
34impl crate::IsEnum for Smod {}
35#[doc = "Field `SMOD` reader - Shifter Mode"]
36pub type SmodR = crate::FieldReader<Smod>;
37impl SmodR {
38 #[doc = "Get enumerated values variant"]
39 #[inline(always)]
40 pub const fn variant(&self) -> Option<Smod> {
41 match self.bits {
42 0 => Some(Smod::Disable),
43 1 => Some(Smod::Receive),
44 2 => Some(Smod::Transmit),
45 4 => Some(Smod::Matchstore),
46 5 => Some(Smod::Matchcont),
47 6 => Some(Smod::State),
48 7 => Some(Smod::Logic),
49 _ => None,
50 }
51 }
52 #[doc = "Disable"]
53 #[inline(always)]
54 pub fn is_disable(&self) -> bool {
55 *self == Smod::Disable
56 }
57 #[doc = "Receive mode; capture the current shifter content into SHIFTBUF on expiration of the timer"]
58 #[inline(always)]
59 pub fn is_receive(&self) -> bool {
60 *self == Smod::Receive
61 }
62 #[doc = "Transmit mode; load SHIFTBUF contents into the shifter on expiration of the timer"]
63 #[inline(always)]
64 pub fn is_transmit(&self) -> bool {
65 *self == Smod::Transmit
66 }
67 #[doc = "Match Store mode; shifter data is compared to SHIFTBUF content on expiration of the timer"]
68 #[inline(always)]
69 pub fn is_matchstore(&self) -> bool {
70 *self == Smod::Matchstore
71 }
72 #[doc = "Match Continuous mode; shifter data is continuously compared to SHIFTBUF contents"]
73 #[inline(always)]
74 pub fn is_matchcont(&self) -> bool {
75 *self == Smod::Matchcont
76 }
77 #[doc = "State mode; SHIFTBUF contents store programmable state attributes"]
78 #[inline(always)]
79 pub fn is_state(&self) -> bool {
80 *self == Smod::State
81 }
82 #[doc = "Logic mode; SHIFTBUF contents implement programmable logic lookup table"]
83 #[inline(always)]
84 pub fn is_logic(&self) -> bool {
85 *self == Smod::Logic
86 }
87}
88#[doc = "Field `SMOD` writer - Shifter Mode"]
89pub type SmodW<'a, REG> = crate::FieldWriter<'a, REG, 3, Smod>;
90impl<'a, REG> SmodW<'a, REG>
91where
92 REG: crate::Writable + crate::RegisterSpec,
93 REG::Ux: From<u8>,
94{
95 #[doc = "Disable"]
96 #[inline(always)]
97 pub fn disable(self) -> &'a mut crate::W<REG> {
98 self.variant(Smod::Disable)
99 }
100 #[doc = "Receive mode; capture the current shifter content into SHIFTBUF on expiration of the timer"]
101 #[inline(always)]
102 pub fn receive(self) -> &'a mut crate::W<REG> {
103 self.variant(Smod::Receive)
104 }
105 #[doc = "Transmit mode; load SHIFTBUF contents into the shifter on expiration of the timer"]
106 #[inline(always)]
107 pub fn transmit(self) -> &'a mut crate::W<REG> {
108 self.variant(Smod::Transmit)
109 }
110 #[doc = "Match Store mode; shifter data is compared to SHIFTBUF content on expiration of the timer"]
111 #[inline(always)]
112 pub fn matchstore(self) -> &'a mut crate::W<REG> {
113 self.variant(Smod::Matchstore)
114 }
115 #[doc = "Match Continuous mode; shifter data is continuously compared to SHIFTBUF contents"]
116 #[inline(always)]
117 pub fn matchcont(self) -> &'a mut crate::W<REG> {
118 self.variant(Smod::Matchcont)
119 }
120 #[doc = "State mode; SHIFTBUF contents store programmable state attributes"]
121 #[inline(always)]
122 pub fn state(self) -> &'a mut crate::W<REG> {
123 self.variant(Smod::State)
124 }
125 #[doc = "Logic mode; SHIFTBUF contents implement programmable logic lookup table"]
126 #[inline(always)]
127 pub fn logic(self) -> &'a mut crate::W<REG> {
128 self.variant(Smod::Logic)
129 }
130}
131#[doc = "Shifter Pin Polarity\n\nValue on reset: 0"]
132#[cfg_attr(feature = "defmt", derive(defmt::Format))]
133#[derive(Clone, Copy, Debug, PartialEq, Eq)]
134pub enum Pinpol {
135 #[doc = "0: Active high"]
136 ActiveHigh = 0,
137 #[doc = "1: Active low"]
138 ActiveLow = 1,
139}
140impl From<Pinpol> for bool {
141 #[inline(always)]
142 fn from(variant: Pinpol) -> Self {
143 variant as u8 != 0
144 }
145}
146#[doc = "Field `PINPOL` reader - Shifter Pin Polarity"]
147pub type PinpolR = crate::BitReader<Pinpol>;
148impl PinpolR {
149 #[doc = "Get enumerated values variant"]
150 #[inline(always)]
151 pub const fn variant(&self) -> Pinpol {
152 match self.bits {
153 false => Pinpol::ActiveHigh,
154 true => Pinpol::ActiveLow,
155 }
156 }
157 #[doc = "Active high"]
158 #[inline(always)]
159 pub fn is_active_high(&self) -> bool {
160 *self == Pinpol::ActiveHigh
161 }
162 #[doc = "Active low"]
163 #[inline(always)]
164 pub fn is_active_low(&self) -> bool {
165 *self == Pinpol::ActiveLow
166 }
167}
168#[doc = "Field `PINPOL` writer - Shifter Pin Polarity"]
169pub type PinpolW<'a, REG> = crate::BitWriter<'a, REG, Pinpol>;
170impl<'a, REG> PinpolW<'a, REG>
171where
172 REG: crate::Writable + crate::RegisterSpec,
173{
174 #[doc = "Active high"]
175 #[inline(always)]
176 pub fn active_high(self) -> &'a mut crate::W<REG> {
177 self.variant(Pinpol::ActiveHigh)
178 }
179 #[doc = "Active low"]
180 #[inline(always)]
181 pub fn active_low(self) -> &'a mut crate::W<REG> {
182 self.variant(Pinpol::ActiveLow)
183 }
184}
185#[doc = "Field `PINSEL` reader - Shifter Pin Select"]
186pub type PinselR = crate::FieldReader;
187#[doc = "Field `PINSEL` writer - Shifter Pin Select"]
188pub type PinselW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
189#[doc = "Shifter Pin Configuration\n\nValue on reset: 0"]
190#[cfg_attr(feature = "defmt", derive(defmt::Format))]
191#[derive(Clone, Copy, Debug, PartialEq, Eq)]
192#[repr(u8)]
193pub enum Pincfg {
194 #[doc = "0: Shifter pin output disabled"]
195 Disable = 0,
196 #[doc = "1: Shifter pin open-drain or bidirectional output enable"]
197 OpendBidirouten = 1,
198 #[doc = "2: Shifter pin bidirectional output data"]
199 BidirOutdata = 2,
200 #[doc = "3: Shifter pin output"]
201 Output = 3,
202}
203impl From<Pincfg> for u8 {
204 #[inline(always)]
205 fn from(variant: Pincfg) -> Self {
206 variant as _
207 }
208}
209impl crate::FieldSpec for Pincfg {
210 type Ux = u8;
211}
212impl crate::IsEnum for Pincfg {}
213#[doc = "Field `PINCFG` reader - Shifter Pin Configuration"]
214pub type PincfgR = crate::FieldReader<Pincfg>;
215impl PincfgR {
216 #[doc = "Get enumerated values variant"]
217 #[inline(always)]
218 pub const fn variant(&self) -> Pincfg {
219 match self.bits {
220 0 => Pincfg::Disable,
221 1 => Pincfg::OpendBidirouten,
222 2 => Pincfg::BidirOutdata,
223 3 => Pincfg::Output,
224 _ => unreachable!(),
225 }
226 }
227 #[doc = "Shifter pin output disabled"]
228 #[inline(always)]
229 pub fn is_disable(&self) -> bool {
230 *self == Pincfg::Disable
231 }
232 #[doc = "Shifter pin open-drain or bidirectional output enable"]
233 #[inline(always)]
234 pub fn is_opend_bidirouten(&self) -> bool {
235 *self == Pincfg::OpendBidirouten
236 }
237 #[doc = "Shifter pin bidirectional output data"]
238 #[inline(always)]
239 pub fn is_bidir_outdata(&self) -> bool {
240 *self == Pincfg::BidirOutdata
241 }
242 #[doc = "Shifter pin output"]
243 #[inline(always)]
244 pub fn is_output(&self) -> bool {
245 *self == Pincfg::Output
246 }
247}
248#[doc = "Field `PINCFG` writer - Shifter Pin Configuration"]
249pub type PincfgW<'a, REG> = crate::FieldWriter<'a, REG, 2, Pincfg, crate::Safe>;
250impl<'a, REG> PincfgW<'a, REG>
251where
252 REG: crate::Writable + crate::RegisterSpec,
253 REG::Ux: From<u8>,
254{
255 #[doc = "Shifter pin output disabled"]
256 #[inline(always)]
257 pub fn disable(self) -> &'a mut crate::W<REG> {
258 self.variant(Pincfg::Disable)
259 }
260 #[doc = "Shifter pin open-drain or bidirectional output enable"]
261 #[inline(always)]
262 pub fn opend_bidirouten(self) -> &'a mut crate::W<REG> {
263 self.variant(Pincfg::OpendBidirouten)
264 }
265 #[doc = "Shifter pin bidirectional output data"]
266 #[inline(always)]
267 pub fn bidir_outdata(self) -> &'a mut crate::W<REG> {
268 self.variant(Pincfg::BidirOutdata)
269 }
270 #[doc = "Shifter pin output"]
271 #[inline(always)]
272 pub fn output(self) -> &'a mut crate::W<REG> {
273 self.variant(Pincfg::Output)
274 }
275}
276#[doc = "Timer Polarity\n\nValue on reset: 0"]
277#[cfg_attr(feature = "defmt", derive(defmt::Format))]
278#[derive(Clone, Copy, Debug, PartialEq, Eq)]
279pub enum Timpol {
280 #[doc = "0: Positive edge"]
281 Posedge = 0,
282 #[doc = "1: Negative edge"]
283 Negedge = 1,
284}
285impl From<Timpol> for bool {
286 #[inline(always)]
287 fn from(variant: Timpol) -> Self {
288 variant as u8 != 0
289 }
290}
291#[doc = "Field `TIMPOL` reader - Timer Polarity"]
292pub type TimpolR = crate::BitReader<Timpol>;
293impl TimpolR {
294 #[doc = "Get enumerated values variant"]
295 #[inline(always)]
296 pub const fn variant(&self) -> Timpol {
297 match self.bits {
298 false => Timpol::Posedge,
299 true => Timpol::Negedge,
300 }
301 }
302 #[doc = "Positive edge"]
303 #[inline(always)]
304 pub fn is_posedge(&self) -> bool {
305 *self == Timpol::Posedge
306 }
307 #[doc = "Negative edge"]
308 #[inline(always)]
309 pub fn is_negedge(&self) -> bool {
310 *self == Timpol::Negedge
311 }
312}
313#[doc = "Field `TIMPOL` writer - Timer Polarity"]
314pub type TimpolW<'a, REG> = crate::BitWriter<'a, REG, Timpol>;
315impl<'a, REG> TimpolW<'a, REG>
316where
317 REG: crate::Writable + crate::RegisterSpec,
318{
319 #[doc = "Positive edge"]
320 #[inline(always)]
321 pub fn posedge(self) -> &'a mut crate::W<REG> {
322 self.variant(Timpol::Posedge)
323 }
324 #[doc = "Negative edge"]
325 #[inline(always)]
326 pub fn negedge(self) -> &'a mut crate::W<REG> {
327 self.variant(Timpol::Negedge)
328 }
329}
330#[doc = "Field `TIMSEL` reader - Timer Select"]
331pub type TimselR = crate::FieldReader;
332#[doc = "Field `TIMSEL` writer - Timer Select"]
333pub type TimselW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
334impl R {
335 #[doc = "Bits 0:2 - Shifter Mode"]
336 #[inline(always)]
337 pub fn smod(&self) -> SmodR {
338 SmodR::new((self.bits & 7) as u8)
339 }
340 #[doc = "Bit 7 - Shifter Pin Polarity"]
341 #[inline(always)]
342 pub fn pinpol(&self) -> PinpolR {
343 PinpolR::new(((self.bits >> 7) & 1) != 0)
344 }
345 #[doc = "Bits 8:12 - Shifter Pin Select"]
346 #[inline(always)]
347 pub fn pinsel(&self) -> PinselR {
348 PinselR::new(((self.bits >> 8) & 0x1f) as u8)
349 }
350 #[doc = "Bits 16:17 - Shifter Pin Configuration"]
351 #[inline(always)]
352 pub fn pincfg(&self) -> PincfgR {
353 PincfgR::new(((self.bits >> 16) & 3) as u8)
354 }
355 #[doc = "Bit 23 - Timer Polarity"]
356 #[inline(always)]
357 pub fn timpol(&self) -> TimpolR {
358 TimpolR::new(((self.bits >> 23) & 1) != 0)
359 }
360 #[doc = "Bits 24:25 - Timer Select"]
361 #[inline(always)]
362 pub fn timsel(&self) -> TimselR {
363 TimselR::new(((self.bits >> 24) & 3) as u8)
364 }
365}
366#[cfg(feature = "debug")]
367impl core::fmt::Debug for R {
368 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
369 f.debug_struct("SHIFTCTL")
370 .field("smod", &self.smod())
371 .field("pinpol", &self.pinpol())
372 .field("pinsel", &self.pinsel())
373 .field("pincfg", &self.pincfg())
374 .field("timpol", &self.timpol())
375 .field("timsel", &self.timsel())
376 .finish()
377 }
378}
379impl W {
380 #[doc = "Bits 0:2 - Shifter Mode"]
381 #[inline(always)]
382 pub fn smod(&mut self) -> SmodW<'_, ShiftctlSpec> {
383 SmodW::new(self, 0)
384 }
385 #[doc = "Bit 7 - Shifter Pin Polarity"]
386 #[inline(always)]
387 pub fn pinpol(&mut self) -> PinpolW<'_, ShiftctlSpec> {
388 PinpolW::new(self, 7)
389 }
390 #[doc = "Bits 8:12 - Shifter Pin Select"]
391 #[inline(always)]
392 pub fn pinsel(&mut self) -> PinselW<'_, ShiftctlSpec> {
393 PinselW::new(self, 8)
394 }
395 #[doc = "Bits 16:17 - Shifter Pin Configuration"]
396 #[inline(always)]
397 pub fn pincfg(&mut self) -> PincfgW<'_, ShiftctlSpec> {
398 PincfgW::new(self, 16)
399 }
400 #[doc = "Bit 23 - Timer Polarity"]
401 #[inline(always)]
402 pub fn timpol(&mut self) -> TimpolW<'_, ShiftctlSpec> {
403 TimpolW::new(self, 23)
404 }
405 #[doc = "Bits 24:25 - Timer Select"]
406 #[inline(always)]
407 pub fn timsel(&mut self) -> TimselW<'_, ShiftctlSpec> {
408 TimselW::new(self, 24)
409 }
410}
411#[doc = "Shifter Control\n\nYou can [`read`](crate::Reg::read) this register and get [`shiftctl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`shiftctl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
412pub struct ShiftctlSpec;
413impl crate::RegisterSpec for ShiftctlSpec {
414 type Ux = u32;
415}
416#[doc = "`read()` method returns [`shiftctl::R`](R) reader structure"]
417impl crate::Readable for ShiftctlSpec {}
418#[doc = "`write(|w| ..)` method takes [`shiftctl::W`](W) writer structure"]
419impl crate::Writable for ShiftctlSpec {
420 type Safety = crate::Unsafe;
421}
422#[doc = "`reset()` method sets SHIFTCTL[%s] to value 0"]
423impl crate::Resettable for ShiftctlSpec {}