stm32l5/stm32l562/tim2/
ccmr2_input.rs1pub type R = crate::R<CCMR2_INPUTrs>;
3pub type W = crate::W<CCMR2_INPUTrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u8)]
11pub enum CC3S {
12 Ti3 = 1,
14 Ti4 = 2,
16 Trc = 3,
18}
19impl From<CC3S> for u8 {
20 #[inline(always)]
21 fn from(variant: CC3S) -> Self {
22 variant as _
23 }
24}
25impl crate::FieldSpec for CC3S {
26 type Ux = u8;
27}
28impl crate::IsEnum for CC3S {}
29pub type CC3S_R = crate::FieldReader<CC3S>;
31impl CC3S_R {
32 #[inline(always)]
34 pub const fn variant(&self) -> Option<CC3S> {
35 match self.bits {
36 1 => Some(CC3S::Ti3),
37 2 => Some(CC3S::Ti4),
38 3 => Some(CC3S::Trc),
39 _ => None,
40 }
41 }
42 #[inline(always)]
44 pub fn is_ti3(&self) -> bool {
45 *self == CC3S::Ti3
46 }
47 #[inline(always)]
49 pub fn is_ti4(&self) -> bool {
50 *self == CC3S::Ti4
51 }
52 #[inline(always)]
54 pub fn is_trc(&self) -> bool {
55 *self == CC3S::Trc
56 }
57}
58pub type CC3S_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CC3S>;
60impl<'a, REG> CC3S_W<'a, REG>
61where
62 REG: crate::Writable + crate::RegisterSpec,
63 REG::Ux: From<u8>,
64{
65 #[inline(always)]
67 pub fn ti3(self) -> &'a mut crate::W<REG> {
68 self.variant(CC3S::Ti3)
69 }
70 #[inline(always)]
72 pub fn ti4(self) -> &'a mut crate::W<REG> {
73 self.variant(CC3S::Ti4)
74 }
75 #[inline(always)]
77 pub fn trc(self) -> &'a mut crate::W<REG> {
78 self.variant(CC3S::Trc)
79 }
80}
81pub use super::ccmr1_input::ICFILTER;
83pub use super::ccmr1_input::ICF_R;
85pub use super::ccmr1_input::ICF_W;
87pub use super::ccmr1_input::ICPRESCALER;
89pub use super::ccmr1_input::ICPSC_R;
91pub use super::ccmr1_input::ICPSC_W;
93#[cfg_attr(feature = "defmt", derive(defmt::Format))]
97#[derive(Clone, Copy, Debug, PartialEq, Eq)]
98#[repr(u8)]
99pub enum CC4S {
100 Ti4 = 1,
102 Ti3 = 2,
104 Trc = 3,
106}
107impl From<CC4S> for u8 {
108 #[inline(always)]
109 fn from(variant: CC4S) -> Self {
110 variant as _
111 }
112}
113impl crate::FieldSpec for CC4S {
114 type Ux = u8;
115}
116impl crate::IsEnum for CC4S {}
117pub type CC4S_R = crate::FieldReader<CC4S>;
119impl CC4S_R {
120 #[inline(always)]
122 pub const fn variant(&self) -> Option<CC4S> {
123 match self.bits {
124 1 => Some(CC4S::Ti4),
125 2 => Some(CC4S::Ti3),
126 3 => Some(CC4S::Trc),
127 _ => None,
128 }
129 }
130 #[inline(always)]
132 pub fn is_ti4(&self) -> bool {
133 *self == CC4S::Ti4
134 }
135 #[inline(always)]
137 pub fn is_ti3(&self) -> bool {
138 *self == CC4S::Ti3
139 }
140 #[inline(always)]
142 pub fn is_trc(&self) -> bool {
143 *self == CC4S::Trc
144 }
145}
146pub type CC4S_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CC4S>;
148impl<'a, REG> CC4S_W<'a, REG>
149where
150 REG: crate::Writable + crate::RegisterSpec,
151 REG::Ux: From<u8>,
152{
153 #[inline(always)]
155 pub fn ti4(self) -> &'a mut crate::W<REG> {
156 self.variant(CC4S::Ti4)
157 }
158 #[inline(always)]
160 pub fn ti3(self) -> &'a mut crate::W<REG> {
161 self.variant(CC4S::Ti3)
162 }
163 #[inline(always)]
165 pub fn trc(self) -> &'a mut crate::W<REG> {
166 self.variant(CC4S::Trc)
167 }
168}
169impl R {
170 #[inline(always)]
172 pub fn cc3s(&self) -> CC3S_R {
173 CC3S_R::new((self.bits & 3) as u8)
174 }
175 #[inline(always)]
179 pub fn icpsc(&self, n: u8) -> ICPSC_R {
180 #[allow(clippy::no_effect)]
181 [(); 2][n as usize];
182 ICPSC_R::new(((self.bits >> (n * 8 + 2)) & 3) as u8)
183 }
184 #[inline(always)]
187 pub fn icpsc_iter(&self) -> impl Iterator<Item = ICPSC_R> + '_ {
188 (0..2).map(move |n| ICPSC_R::new(((self.bits >> (n * 8 + 2)) & 3) as u8))
189 }
190 #[inline(always)]
192 pub fn ic3psc(&self) -> ICPSC_R {
193 ICPSC_R::new(((self.bits >> 2) & 3) as u8)
194 }
195 #[inline(always)]
197 pub fn ic4psc(&self) -> ICPSC_R {
198 ICPSC_R::new(((self.bits >> 10) & 3) as u8)
199 }
200 #[inline(always)]
204 pub fn icf(&self, n: u8) -> ICF_R {
205 #[allow(clippy::no_effect)]
206 [(); 2][n as usize];
207 ICF_R::new(((self.bits >> (n * 8 + 4)) & 0x0f) as u8)
208 }
209 #[inline(always)]
212 pub fn icf_iter(&self) -> impl Iterator<Item = ICF_R> + '_ {
213 (0..2).map(move |n| ICF_R::new(((self.bits >> (n * 8 + 4)) & 0x0f) as u8))
214 }
215 #[inline(always)]
217 pub fn ic3f(&self) -> ICF_R {
218 ICF_R::new(((self.bits >> 4) & 0x0f) as u8)
219 }
220 #[inline(always)]
222 pub fn ic4f(&self) -> ICF_R {
223 ICF_R::new(((self.bits >> 12) & 0x0f) as u8)
224 }
225 #[inline(always)]
227 pub fn cc4s(&self) -> CC4S_R {
228 CC4S_R::new(((self.bits >> 8) & 3) as u8)
229 }
230}
231impl core::fmt::Debug for R {
232 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
233 f.debug_struct("CCMR2_Input")
234 .field("ic3f", &self.ic3f())
235 .field("ic4f", &self.ic4f())
236 .field("ic3psc", &self.ic3psc())
237 .field("ic4psc", &self.ic4psc())
238 .field("cc4s", &self.cc4s())
239 .field("cc3s", &self.cc3s())
240 .finish()
241 }
242}
243impl W {
244 #[inline(always)]
246 pub fn cc3s(&mut self) -> CC3S_W<CCMR2_INPUTrs> {
247 CC3S_W::new(self, 0)
248 }
249 #[inline(always)]
253 pub fn icpsc(&mut self, n: u8) -> ICPSC_W<CCMR2_INPUTrs> {
254 #[allow(clippy::no_effect)]
255 [(); 2][n as usize];
256 ICPSC_W::new(self, n * 8 + 2)
257 }
258 #[inline(always)]
260 pub fn ic3psc(&mut self) -> ICPSC_W<CCMR2_INPUTrs> {
261 ICPSC_W::new(self, 2)
262 }
263 #[inline(always)]
265 pub fn ic4psc(&mut self) -> ICPSC_W<CCMR2_INPUTrs> {
266 ICPSC_W::new(self, 10)
267 }
268 #[inline(always)]
272 pub fn icf(&mut self, n: u8) -> ICF_W<CCMR2_INPUTrs> {
273 #[allow(clippy::no_effect)]
274 [(); 2][n as usize];
275 ICF_W::new(self, n * 8 + 4)
276 }
277 #[inline(always)]
279 pub fn ic3f(&mut self) -> ICF_W<CCMR2_INPUTrs> {
280 ICF_W::new(self, 4)
281 }
282 #[inline(always)]
284 pub fn ic4f(&mut self) -> ICF_W<CCMR2_INPUTrs> {
285 ICF_W::new(self, 12)
286 }
287 #[inline(always)]
289 pub fn cc4s(&mut self) -> CC4S_W<CCMR2_INPUTrs> {
290 CC4S_W::new(self, 8)
291 }
292}
293pub struct CCMR2_INPUTrs;
299impl crate::RegisterSpec for CCMR2_INPUTrs {
300 type Ux = u32;
301}
302impl crate::Readable for CCMR2_INPUTrs {}
304impl crate::Writable for CCMR2_INPUTrs {
306 type Safety = crate::Unsafe;
307}
308impl crate::Resettable for CCMR2_INPUTrs {}