n32g4/n32g455/tim2/
ctrl2.rs1pub type R = crate::R<Ctrl2Spec>;
3pub type W = crate::W<Ctrl2Spec>;
5pub type CcpctlR = crate::BitReader;
7pub type CcpctlW<'a, REG> = crate::BitWriter<'a, REG>;
9pub type CcuselR = crate::BitReader;
11pub type CcuselW<'a, REG> = crate::BitWriter<'a, REG>;
13pub type CcdselR = crate::BitReader;
15pub type CcdselW<'a, REG> = crate::BitWriter<'a, REG>;
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
21#[repr(u8)]
22pub enum Mmsel {
23 Reset = 0,
25 Enable = 1,
27 Update = 2,
29 CaptureComparePulse = 3,
31 CompareO0c = 4,
33 CompareO1c = 5,
35 CompareO2c = 6,
37 CompareO3c = 7,
39}
40impl From<Mmsel> for u8 {
41 #[inline(always)]
42 fn from(variant: Mmsel) -> Self {
43 variant as _
44 }
45}
46impl crate::FieldSpec for Mmsel {
47 type Ux = u8;
48}
49impl crate::IsEnum for Mmsel {}
50pub type MmselR = crate::FieldReader<Mmsel>;
52impl MmselR {
53 #[inline(always)]
55 pub const fn variant(&self) -> Mmsel {
56 match self.bits {
57 0 => Mmsel::Reset,
58 1 => Mmsel::Enable,
59 2 => Mmsel::Update,
60 3 => Mmsel::CaptureComparePulse,
61 4 => Mmsel::CompareO0c,
62 5 => Mmsel::CompareO1c,
63 6 => Mmsel::CompareO2c,
64 7 => Mmsel::CompareO3c,
65 _ => unreachable!(),
66 }
67 }
68 #[inline(always)]
70 pub fn is_reset(&self) -> bool {
71 *self == Mmsel::Reset
72 }
73 #[inline(always)]
75 pub fn is_enable(&self) -> bool {
76 *self == Mmsel::Enable
77 }
78 #[inline(always)]
80 pub fn is_update(&self) -> bool {
81 *self == Mmsel::Update
82 }
83 #[inline(always)]
85 pub fn is_capture_compare_pulse(&self) -> bool {
86 *self == Mmsel::CaptureComparePulse
87 }
88 #[inline(always)]
90 pub fn is_compare_o0c(&self) -> bool {
91 *self == Mmsel::CompareO0c
92 }
93 #[inline(always)]
95 pub fn is_compare_o1c(&self) -> bool {
96 *self == Mmsel::CompareO1c
97 }
98 #[inline(always)]
100 pub fn is_compare_o2c(&self) -> bool {
101 *self == Mmsel::CompareO2c
102 }
103 #[inline(always)]
105 pub fn is_compare_o3c(&self) -> bool {
106 *self == Mmsel::CompareO3c
107 }
108}
109pub type MmselW<'a, REG> = crate::FieldWriter<'a, REG, 3, Mmsel, crate::Safe>;
111impl<'a, REG> MmselW<'a, REG>
112where
113 REG: crate::Writable + crate::RegisterSpec,
114 REG::Ux: From<u8>,
115{
116 #[inline(always)]
118 pub fn reset(self) -> &'a mut crate::W<REG> {
119 self.variant(Mmsel::Reset)
120 }
121 #[inline(always)]
123 pub fn enable(self) -> &'a mut crate::W<REG> {
124 self.variant(Mmsel::Enable)
125 }
126 #[inline(always)]
128 pub fn update(self) -> &'a mut crate::W<REG> {
129 self.variant(Mmsel::Update)
130 }
131 #[inline(always)]
133 pub fn capture_compare_pulse(self) -> &'a mut crate::W<REG> {
134 self.variant(Mmsel::CaptureComparePulse)
135 }
136 #[inline(always)]
138 pub fn compare_o0c(self) -> &'a mut crate::W<REG> {
139 self.variant(Mmsel::CompareO0c)
140 }
141 #[inline(always)]
143 pub fn compare_o1c(self) -> &'a mut crate::W<REG> {
144 self.variant(Mmsel::CompareO1c)
145 }
146 #[inline(always)]
148 pub fn compare_o2c(self) -> &'a mut crate::W<REG> {
149 self.variant(Mmsel::CompareO2c)
150 }
151 #[inline(always)]
153 pub fn compare_o3c(self) -> &'a mut crate::W<REG> {
154 self.variant(Mmsel::CompareO3c)
155 }
156}
157pub type Ti1selR = crate::BitReader;
159pub type Ti1selW<'a, REG> = crate::BitWriter<'a, REG>;
161pub type Oi1R = crate::BitReader;
163pub type Oi1W<'a, REG> = crate::BitWriter<'a, REG>;
165pub type Oi1nR = crate::BitReader;
167pub type Oi1nW<'a, REG> = crate::BitWriter<'a, REG>;
169pub type Oi2R = crate::BitReader;
171pub type Oi2W<'a, REG> = crate::BitWriter<'a, REG>;
173pub type Oi2nR = crate::BitReader;
175pub type Oi2nW<'a, REG> = crate::BitWriter<'a, REG>;
177pub type Oi3R = crate::BitReader;
179pub type Oi3W<'a, REG> = crate::BitWriter<'a, REG>;
181pub type Oi3nR = crate::BitReader;
183pub type Oi3nW<'a, REG> = crate::BitWriter<'a, REG>;
185pub type Oi4R = crate::BitReader;
187pub type Oi4W<'a, REG> = crate::BitWriter<'a, REG>;
189pub type Oi5R = crate::BitReader;
191pub type Oi5W<'a, REG> = crate::BitWriter<'a, REG>;
193pub type Oi6R = crate::BitReader;
195pub type Oi6W<'a, REG> = crate::BitWriter<'a, REG>;
197impl R {
198 #[inline(always)]
200 pub fn ccpctl(&self) -> CcpctlR {
201 CcpctlR::new((self.bits & 1) != 0)
202 }
203 #[inline(always)]
205 pub fn ccusel(&self) -> CcuselR {
206 CcuselR::new(((self.bits >> 2) & 1) != 0)
207 }
208 #[inline(always)]
210 pub fn ccdsel(&self) -> CcdselR {
211 CcdselR::new(((self.bits >> 3) & 1) != 0)
212 }
213 #[inline(always)]
215 pub fn mmsel(&self) -> MmselR {
216 MmselR::new(((self.bits >> 4) & 7) as u8)
217 }
218 #[inline(always)]
220 pub fn ti1sel(&self) -> Ti1selR {
221 Ti1selR::new(((self.bits >> 7) & 1) != 0)
222 }
223 #[inline(always)]
225 pub fn oi1(&self) -> Oi1R {
226 Oi1R::new(((self.bits >> 8) & 1) != 0)
227 }
228 #[inline(always)]
230 pub fn oi1n(&self) -> Oi1nR {
231 Oi1nR::new(((self.bits >> 9) & 1) != 0)
232 }
233 #[inline(always)]
235 pub fn oi2(&self) -> Oi2R {
236 Oi2R::new(((self.bits >> 10) & 1) != 0)
237 }
238 #[inline(always)]
240 pub fn oi2n(&self) -> Oi2nR {
241 Oi2nR::new(((self.bits >> 11) & 1) != 0)
242 }
243 #[inline(always)]
245 pub fn oi3(&self) -> Oi3R {
246 Oi3R::new(((self.bits >> 12) & 1) != 0)
247 }
248 #[inline(always)]
250 pub fn oi3n(&self) -> Oi3nR {
251 Oi3nR::new(((self.bits >> 13) & 1) != 0)
252 }
253 #[inline(always)]
255 pub fn oi4(&self) -> Oi4R {
256 Oi4R::new(((self.bits >> 14) & 1) != 0)
257 }
258 #[inline(always)]
260 pub fn oi5(&self) -> Oi5R {
261 Oi5R::new(((self.bits >> 16) & 1) != 0)
262 }
263 #[inline(always)]
265 pub fn oi6(&self) -> Oi6R {
266 Oi6R::new(((self.bits >> 18) & 1) != 0)
267 }
268}
269impl W {
270 #[inline(always)]
272 #[must_use]
273 pub fn ccpctl(&mut self) -> CcpctlW<Ctrl2Spec> {
274 CcpctlW::new(self, 0)
275 }
276 #[inline(always)]
278 #[must_use]
279 pub fn ccusel(&mut self) -> CcuselW<Ctrl2Spec> {
280 CcuselW::new(self, 2)
281 }
282 #[inline(always)]
284 #[must_use]
285 pub fn ccdsel(&mut self) -> CcdselW<Ctrl2Spec> {
286 CcdselW::new(self, 3)
287 }
288 #[inline(always)]
290 #[must_use]
291 pub fn mmsel(&mut self) -> MmselW<Ctrl2Spec> {
292 MmselW::new(self, 4)
293 }
294 #[inline(always)]
296 #[must_use]
297 pub fn ti1sel(&mut self) -> Ti1selW<Ctrl2Spec> {
298 Ti1selW::new(self, 7)
299 }
300 #[inline(always)]
302 #[must_use]
303 pub fn oi1(&mut self) -> Oi1W<Ctrl2Spec> {
304 Oi1W::new(self, 8)
305 }
306 #[inline(always)]
308 #[must_use]
309 pub fn oi1n(&mut self) -> Oi1nW<Ctrl2Spec> {
310 Oi1nW::new(self, 9)
311 }
312 #[inline(always)]
314 #[must_use]
315 pub fn oi2(&mut self) -> Oi2W<Ctrl2Spec> {
316 Oi2W::new(self, 10)
317 }
318 #[inline(always)]
320 #[must_use]
321 pub fn oi2n(&mut self) -> Oi2nW<Ctrl2Spec> {
322 Oi2nW::new(self, 11)
323 }
324 #[inline(always)]
326 #[must_use]
327 pub fn oi3(&mut self) -> Oi3W<Ctrl2Spec> {
328 Oi3W::new(self, 12)
329 }
330 #[inline(always)]
332 #[must_use]
333 pub fn oi3n(&mut self) -> Oi3nW<Ctrl2Spec> {
334 Oi3nW::new(self, 13)
335 }
336 #[inline(always)]
338 #[must_use]
339 pub fn oi4(&mut self) -> Oi4W<Ctrl2Spec> {
340 Oi4W::new(self, 14)
341 }
342 #[inline(always)]
344 #[must_use]
345 pub fn oi5(&mut self) -> Oi5W<Ctrl2Spec> {
346 Oi5W::new(self, 16)
347 }
348 #[inline(always)]
350 #[must_use]
351 pub fn oi6(&mut self) -> Oi6W<Ctrl2Spec> {
352 Oi6W::new(self, 18)
353 }
354}
355pub struct Ctrl2Spec;
359impl crate::RegisterSpec for Ctrl2Spec {
360 type Ux = u32;
361}
362impl crate::Readable for Ctrl2Spec {}
364impl crate::Writable for Ctrl2Spec {
366 type Safety = crate::Unsafe;
367 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
368 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
369}
370impl crate::Resettable for Ctrl2Spec {
372 const RESET_VALUE: u32 = 0;
373}