xmc4100/ccu40/
ecrd.rs

1#[doc = "Register `ECRD` reader"]
2pub type R = crate::R<ECRD_SPEC>;
3#[doc = "Field `CAPV` reader - Timer Capture Value"]
4pub type CAPV_R = crate::FieldReader<u16>;
5#[doc = "Field `FPCV` reader - Prescaler Capture value"]
6pub type FPCV_R = crate::FieldReader;
7#[doc = "Slice pointer\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum SPTR_A {
11    #[doc = "0: CC40"]
12    VALUE1 = 0,
13    #[doc = "1: CC41"]
14    VALUE2 = 1,
15    #[doc = "2: CC42"]
16    VALUE3 = 2,
17    #[doc = "3: CC43"]
18    VALUE4 = 3,
19}
20impl From<SPTR_A> for u8 {
21    #[inline(always)]
22    fn from(variant: SPTR_A) -> Self {
23        variant as _
24    }
25}
26impl crate::FieldSpec for SPTR_A {
27    type Ux = u8;
28}
29impl crate::IsEnum for SPTR_A {}
30#[doc = "Field `SPTR` reader - Slice pointer"]
31pub type SPTR_R = crate::FieldReader<SPTR_A>;
32impl SPTR_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub const fn variant(&self) -> SPTR_A {
36        match self.bits {
37            0 => SPTR_A::VALUE1,
38            1 => SPTR_A::VALUE2,
39            2 => SPTR_A::VALUE3,
40            3 => SPTR_A::VALUE4,
41            _ => unreachable!(),
42        }
43    }
44    #[doc = "CC40"]
45    #[inline(always)]
46    pub fn is_value1(&self) -> bool {
47        *self == SPTR_A::VALUE1
48    }
49    #[doc = "CC41"]
50    #[inline(always)]
51    pub fn is_value2(&self) -> bool {
52        *self == SPTR_A::VALUE2
53    }
54    #[doc = "CC42"]
55    #[inline(always)]
56    pub fn is_value3(&self) -> bool {
57        *self == SPTR_A::VALUE3
58    }
59    #[doc = "CC43"]
60    #[inline(always)]
61    pub fn is_value4(&self) -> bool {
62        *self == SPTR_A::VALUE4
63    }
64}
65#[doc = "Capture register pointer\n\nValue on reset: 0"]
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
67#[repr(u8)]
68pub enum VPTR_A {
69    #[doc = "0: Capture register 0"]
70    VALUE1 = 0,
71    #[doc = "1: Capture register 1"]
72    VALUE2 = 1,
73    #[doc = "2: Capture register 2"]
74    VALUE3 = 2,
75    #[doc = "3: Capture register 3"]
76    VALUE4 = 3,
77}
78impl From<VPTR_A> for u8 {
79    #[inline(always)]
80    fn from(variant: VPTR_A) -> Self {
81        variant as _
82    }
83}
84impl crate::FieldSpec for VPTR_A {
85    type Ux = u8;
86}
87impl crate::IsEnum for VPTR_A {}
88#[doc = "Field `VPTR` reader - Capture register pointer"]
89pub type VPTR_R = crate::FieldReader<VPTR_A>;
90impl VPTR_R {
91    #[doc = "Get enumerated values variant"]
92    #[inline(always)]
93    pub const fn variant(&self) -> VPTR_A {
94        match self.bits {
95            0 => VPTR_A::VALUE1,
96            1 => VPTR_A::VALUE2,
97            2 => VPTR_A::VALUE3,
98            3 => VPTR_A::VALUE4,
99            _ => unreachable!(),
100        }
101    }
102    #[doc = "Capture register 0"]
103    #[inline(always)]
104    pub fn is_value1(&self) -> bool {
105        *self == VPTR_A::VALUE1
106    }
107    #[doc = "Capture register 1"]
108    #[inline(always)]
109    pub fn is_value2(&self) -> bool {
110        *self == VPTR_A::VALUE2
111    }
112    #[doc = "Capture register 2"]
113    #[inline(always)]
114    pub fn is_value3(&self) -> bool {
115        *self == VPTR_A::VALUE3
116    }
117    #[doc = "Capture register 3"]
118    #[inline(always)]
119    pub fn is_value4(&self) -> bool {
120        *self == VPTR_A::VALUE4
121    }
122}
123#[doc = "Full Flag\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum FFL_A {
126    #[doc = "0: No new value was captured into this register"]
127    VALUE1 = 0,
128    #[doc = "1: A new value has been captured into this register"]
129    VALUE2 = 1,
130}
131impl From<FFL_A> for bool {
132    #[inline(always)]
133    fn from(variant: FFL_A) -> Self {
134        variant as u8 != 0
135    }
136}
137#[doc = "Field `FFL` reader - Full Flag"]
138pub type FFL_R = crate::BitReader<FFL_A>;
139impl FFL_R {
140    #[doc = "Get enumerated values variant"]
141    #[inline(always)]
142    pub const fn variant(&self) -> FFL_A {
143        match self.bits {
144            false => FFL_A::VALUE1,
145            true => FFL_A::VALUE2,
146        }
147    }
148    #[doc = "No new value was captured into this register"]
149    #[inline(always)]
150    pub fn is_value1(&self) -> bool {
151        *self == FFL_A::VALUE1
152    }
153    #[doc = "A new value has been captured into this register"]
154    #[inline(always)]
155    pub fn is_value2(&self) -> bool {
156        *self == FFL_A::VALUE2
157    }
158}
159impl R {
160    #[doc = "Bits 0:15 - Timer Capture Value"]
161    #[inline(always)]
162    pub fn capv(&self) -> CAPV_R {
163        CAPV_R::new((self.bits & 0xffff) as u16)
164    }
165    #[doc = "Bits 16:19 - Prescaler Capture value"]
166    #[inline(always)]
167    pub fn fpcv(&self) -> FPCV_R {
168        FPCV_R::new(((self.bits >> 16) & 0x0f) as u8)
169    }
170    #[doc = "Bits 20:21 - Slice pointer"]
171    #[inline(always)]
172    pub fn sptr(&self) -> SPTR_R {
173        SPTR_R::new(((self.bits >> 20) & 3) as u8)
174    }
175    #[doc = "Bits 22:23 - Capture register pointer"]
176    #[inline(always)]
177    pub fn vptr(&self) -> VPTR_R {
178        VPTR_R::new(((self.bits >> 22) & 3) as u8)
179    }
180    #[doc = "Bit 24 - Full Flag"]
181    #[inline(always)]
182    pub fn ffl(&self) -> FFL_R {
183        FFL_R::new(((self.bits >> 24) & 1) != 0)
184    }
185}
186#[doc = "Extended Capture Mode Read\n\nYou can [`read`](crate::Reg::read) this register and get [`ecrd::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\n<div class=\"warning\">One or more dependent resources other than the current register are immediately affected by a read operation.</div>"]
187pub struct ECRD_SPEC;
188impl crate::RegisterSpec for ECRD_SPEC {
189    type Ux = u32;
190}
191#[doc = "`read()` method returns [`ecrd::R`](R) reader structure"]
192impl crate::Readable for ECRD_SPEC {}
193#[doc = "`reset()` method sets ECRD to value 0"]
194impl crate::Resettable for ECRD_SPEC {
195    const RESET_VALUE: u32 = 0;
196}