1pub struct R(crate::R<CR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR2_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type CCPC_R = crate::BitReader<bool>;
39pub type CCPC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
41pub type CCUS_R = crate::BitReader<CCUS_A>;
43#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47pub enum CCUS_A {
48 Bit = 0,
50 BitOrEdge = 1,
52}
53impl From<CCUS_A> for bool {
54 #[inline(always)]
55 fn from(variant: CCUS_A) -> Self {
56 variant as u8 != 0
57 }
58}
59impl CCUS_R {
60 #[inline(always)]
62 pub fn variant(&self) -> CCUS_A {
63 match self.bits {
64 false => CCUS_A::Bit,
65 true => CCUS_A::BitOrEdge,
66 }
67 }
68 #[inline(always)]
70 pub fn is_bit_(&self) -> bool {
71 *self == CCUS_A::Bit
72 }
73 #[inline(always)]
75 pub fn is_bit_or_edge(&self) -> bool {
76 *self == CCUS_A::BitOrEdge
77 }
78}
79pub type CCUS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, CCUS_A, O>;
81impl<'a, const O: u8> CCUS_W<'a, O> {
82 #[inline(always)]
84 pub fn bit_(self) -> &'a mut W {
85 self.variant(CCUS_A::Bit)
86 }
87 #[inline(always)]
89 pub fn bit_or_edge(self) -> &'a mut W {
90 self.variant(CCUS_A::BitOrEdge)
91 }
92}
93pub type MMS_R = crate::FieldReader<u8, MMS_A>;
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99#[repr(u8)]
100pub enum MMS_A {
101 Reset = 0,
103 Enable = 1,
105 Update = 2,
107 ComparePulse = 3,
109 CompareOc1 = 4,
111 CompareOc2 = 5,
113 CompareOc3 = 6,
115 CompareOc4 = 7,
117}
118impl From<MMS_A> for u8 {
119 #[inline(always)]
120 fn from(variant: MMS_A) -> Self {
121 variant as _
122 }
123}
124impl MMS_R {
125 #[inline(always)]
127 pub fn variant(&self) -> MMS_A {
128 match self.bits {
129 0 => MMS_A::Reset,
130 1 => MMS_A::Enable,
131 2 => MMS_A::Update,
132 3 => MMS_A::ComparePulse,
133 4 => MMS_A::CompareOc1,
134 5 => MMS_A::CompareOc2,
135 6 => MMS_A::CompareOc3,
136 7 => MMS_A::CompareOc4,
137 _ => unreachable!(),
138 }
139 }
140 #[inline(always)]
142 pub fn is_reset(&self) -> bool {
143 *self == MMS_A::Reset
144 }
145 #[inline(always)]
147 pub fn is_enable(&self) -> bool {
148 *self == MMS_A::Enable
149 }
150 #[inline(always)]
152 pub fn is_update(&self) -> bool {
153 *self == MMS_A::Update
154 }
155 #[inline(always)]
157 pub fn is_compare_pulse(&self) -> bool {
158 *self == MMS_A::ComparePulse
159 }
160 #[inline(always)]
162 pub fn is_compare_oc1(&self) -> bool {
163 *self == MMS_A::CompareOc1
164 }
165 #[inline(always)]
167 pub fn is_compare_oc2(&self) -> bool {
168 *self == MMS_A::CompareOc2
169 }
170 #[inline(always)]
172 pub fn is_compare_oc3(&self) -> bool {
173 *self == MMS_A::CompareOc3
174 }
175 #[inline(always)]
177 pub fn is_compare_oc4(&self) -> bool {
178 *self == MMS_A::CompareOc4
179 }
180}
181pub type MMS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CR2_SPEC, u8, MMS_A, 3, O>;
183impl<'a, const O: u8> MMS_W<'a, O> {
184 #[inline(always)]
186 pub fn reset(self) -> &'a mut W {
187 self.variant(MMS_A::Reset)
188 }
189 #[inline(always)]
191 pub fn enable(self) -> &'a mut W {
192 self.variant(MMS_A::Enable)
193 }
194 #[inline(always)]
196 pub fn update(self) -> &'a mut W {
197 self.variant(MMS_A::Update)
198 }
199 #[inline(always)]
201 pub fn compare_pulse(self) -> &'a mut W {
202 self.variant(MMS_A::ComparePulse)
203 }
204 #[inline(always)]
206 pub fn compare_oc1(self) -> &'a mut W {
207 self.variant(MMS_A::CompareOc1)
208 }
209 #[inline(always)]
211 pub fn compare_oc2(self) -> &'a mut W {
212 self.variant(MMS_A::CompareOc2)
213 }
214 #[inline(always)]
216 pub fn compare_oc3(self) -> &'a mut W {
217 self.variant(MMS_A::CompareOc3)
218 }
219 #[inline(always)]
221 pub fn compare_oc4(self) -> &'a mut W {
222 self.variant(MMS_A::CompareOc4)
223 }
224}
225pub type TI1S_R = crate::BitReader<TI1S_A>;
227#[derive(Clone, Copy, Debug, PartialEq, Eq)]
231pub enum TI1S_A {
232 Normal = 0,
234 Xor = 1,
236}
237impl From<TI1S_A> for bool {
238 #[inline(always)]
239 fn from(variant: TI1S_A) -> Self {
240 variant as u8 != 0
241 }
242}
243impl TI1S_R {
244 #[inline(always)]
246 pub fn variant(&self) -> TI1S_A {
247 match self.bits {
248 false => TI1S_A::Normal,
249 true => TI1S_A::Xor,
250 }
251 }
252 #[inline(always)]
254 pub fn is_normal(&self) -> bool {
255 *self == TI1S_A::Normal
256 }
257 #[inline(always)]
259 pub fn is_xor(&self) -> bool {
260 *self == TI1S_A::Xor
261 }
262}
263pub type TI1S_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, TI1S_A, O>;
265impl<'a, const O: u8> TI1S_W<'a, O> {
266 #[inline(always)]
268 pub fn normal(self) -> &'a mut W {
269 self.variant(TI1S_A::Normal)
270 }
271 #[inline(always)]
273 pub fn xor(self) -> &'a mut W {
274 self.variant(TI1S_A::Xor)
275 }
276}
277pub type OIS1_R = crate::BitReader<bool>;
279pub type OIS1_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
281pub type OIS1N_R = crate::BitReader<bool>;
283pub type OIS1N_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
285pub type OIS2_R = crate::BitReader<bool>;
287pub type OIS2_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
289pub type OIS2N_R = crate::BitReader<bool>;
291pub type OIS2N_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
293pub type OIS3_R = crate::BitReader<bool>;
295pub type OIS3_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
297pub type OIS3N_R = crate::BitReader<bool>;
299pub type OIS3N_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
301pub type OIS4_R = crate::BitReader<bool>;
303pub type OIS4_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, bool, O>;
305impl R {
306 #[inline(always)]
308 pub fn ccpc(&self) -> CCPC_R {
309 CCPC_R::new((self.bits & 1) != 0)
310 }
311 #[inline(always)]
313 pub fn ccus(&self) -> CCUS_R {
314 CCUS_R::new(((self.bits >> 2) & 1) != 0)
315 }
316 #[inline(always)]
318 pub fn mms(&self) -> MMS_R {
319 MMS_R::new(((self.bits >> 4) & 7) as u8)
320 }
321 #[inline(always)]
323 pub fn ti1s(&self) -> TI1S_R {
324 TI1S_R::new(((self.bits >> 7) & 1) != 0)
325 }
326 #[inline(always)]
328 pub fn ois1(&self) -> OIS1_R {
329 OIS1_R::new(((self.bits >> 8) & 1) != 0)
330 }
331 #[inline(always)]
333 pub fn ois1n(&self) -> OIS1N_R {
334 OIS1N_R::new(((self.bits >> 9) & 1) != 0)
335 }
336 #[inline(always)]
338 pub fn ois2(&self) -> OIS2_R {
339 OIS2_R::new(((self.bits >> 10) & 1) != 0)
340 }
341 #[inline(always)]
343 pub fn ois2n(&self) -> OIS2N_R {
344 OIS2N_R::new(((self.bits >> 11) & 1) != 0)
345 }
346 #[inline(always)]
348 pub fn ois3(&self) -> OIS3_R {
349 OIS3_R::new(((self.bits >> 12) & 1) != 0)
350 }
351 #[inline(always)]
353 pub fn ois3n(&self) -> OIS3N_R {
354 OIS3N_R::new(((self.bits >> 13) & 1) != 0)
355 }
356 #[inline(always)]
358 pub fn ois4(&self) -> OIS4_R {
359 OIS4_R::new(((self.bits >> 14) & 1) != 0)
360 }
361}
362impl W {
363 #[inline(always)]
365 #[must_use]
366 pub fn ccpc(&mut self) -> CCPC_W<0> {
367 CCPC_W::new(self)
368 }
369 #[inline(always)]
371 #[must_use]
372 pub fn ccus(&mut self) -> CCUS_W<2> {
373 CCUS_W::new(self)
374 }
375 #[inline(always)]
377 #[must_use]
378 pub fn mms(&mut self) -> MMS_W<4> {
379 MMS_W::new(self)
380 }
381 #[inline(always)]
383 #[must_use]
384 pub fn ti1s(&mut self) -> TI1S_W<7> {
385 TI1S_W::new(self)
386 }
387 #[inline(always)]
389 #[must_use]
390 pub fn ois1(&mut self) -> OIS1_W<8> {
391 OIS1_W::new(self)
392 }
393 #[inline(always)]
395 #[must_use]
396 pub fn ois1n(&mut self) -> OIS1N_W<9> {
397 OIS1N_W::new(self)
398 }
399 #[inline(always)]
401 #[must_use]
402 pub fn ois2(&mut self) -> OIS2_W<10> {
403 OIS2_W::new(self)
404 }
405 #[inline(always)]
407 #[must_use]
408 pub fn ois2n(&mut self) -> OIS2N_W<11> {
409 OIS2N_W::new(self)
410 }
411 #[inline(always)]
413 #[must_use]
414 pub fn ois3(&mut self) -> OIS3_W<12> {
415 OIS3_W::new(self)
416 }
417 #[inline(always)]
419 #[must_use]
420 pub fn ois3n(&mut self) -> OIS3N_W<13> {
421 OIS3N_W::new(self)
422 }
423 #[inline(always)]
425 #[must_use]
426 pub fn ois4(&mut self) -> OIS4_W<14> {
427 OIS4_W::new(self)
428 }
429 #[inline(always)]
431 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
432 self.0.bits(bits);
433 self
434 }
435}
436pub struct CR2_SPEC;
442impl crate::RegisterSpec for CR2_SPEC {
443 type Ux = u32;
444}
445impl crate::Readable for CR2_SPEC {
447 type Reader = R;
448}
449impl crate::Writable for CR2_SPEC {
451 type Writer = W;
452 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
453 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
454}
455impl crate::Resettable for CR2_SPEC {
457 const RESET_VALUE: Self::Ux = 0;
458}