da14697_pac/
timer2.rs

1/*
2DISCLAIMER
3This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
4No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
5applicable laws, including copyright laws.
6THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
7OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
8NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
9LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
10INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
11ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
12Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
13of this software. By using this software, you agree to the additional terms and conditions found by accessing the
14following link:
15http://www.renesas.com/disclaimer
16
17*/
18// Generated from SVD 1.2, with svd2pac 0.6.0 on Thu, 24 Jul 2025 04:45:38 +0000
19
20#![allow(clippy::identity_op)]
21#![allow(clippy::module_inception)]
22#![allow(clippy::derivable_impls)]
23#[allow(unused_imports)]
24use crate::common::sealed;
25#[allow(unused_imports)]
26use crate::common::*;
27#[doc = r"TIMER2 registers"]
28unsafe impl ::core::marker::Send for super::Timer2 {}
29unsafe impl ::core::marker::Sync for super::Timer2 {}
30impl super::Timer2 {
31    #[allow(unused)]
32    #[inline(always)]
33    pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34        self.ptr
35    }
36
37    #[doc = "Timer value for event on GPIO1"]
38    #[inline(always)]
39    pub const fn timer2_capture_gpio1_reg(
40        &self,
41    ) -> &'static crate::common::Reg<self::Timer2CaptureGpio1Reg_SPEC, crate::common::RW> {
42        unsafe {
43            crate::common::Reg::<self::Timer2CaptureGpio1Reg_SPEC, crate::common::RW>::from_ptr(
44                self._svd2pac_as_ptr().add(32usize),
45            )
46        }
47    }
48
49    #[doc = "Timer value for event on GPIO2"]
50    #[inline(always)]
51    pub const fn timer2_capture_gpio2_reg(
52        &self,
53    ) -> &'static crate::common::Reg<self::Timer2CaptureGpio2Reg_SPEC, crate::common::RW> {
54        unsafe {
55            crate::common::Reg::<self::Timer2CaptureGpio2Reg_SPEC, crate::common::RW>::from_ptr(
56                self._svd2pac_as_ptr().add(36usize),
57            )
58        }
59    }
60
61    #[doc = "Timer clear interrupt"]
62    #[inline(always)]
63    pub const fn timer2_clear_irq_reg(
64        &self,
65    ) -> &'static crate::common::Reg<self::Timer2ClearIrqReg_SPEC, crate::common::RW> {
66        unsafe {
67            crate::common::Reg::<self::Timer2ClearIrqReg_SPEC, crate::common::RW>::from_ptr(
68                self._svd2pac_as_ptr().add(52usize),
69            )
70        }
71    }
72
73    #[doc = "Timer control register"]
74    #[inline(always)]
75    pub const fn timer2_ctrl_reg(
76        &self,
77    ) -> &'static crate::common::Reg<self::Timer2CtrlReg_SPEC, crate::common::RW> {
78        unsafe {
79            crate::common::Reg::<self::Timer2CtrlReg_SPEC, crate::common::RW>::from_ptr(
80                self._svd2pac_as_ptr().add(0usize),
81            )
82        }
83    }
84
85    #[doc = "Timer gpio1 selection"]
86    #[inline(always)]
87    pub const fn timer2_gpio1_conf_reg(
88        &self,
89    ) -> &'static crate::common::Reg<self::Timer2Gpio1ConfReg_SPEC, crate::common::RW> {
90        unsafe {
91            crate::common::Reg::<self::Timer2Gpio1ConfReg_SPEC, crate::common::RW>::from_ptr(
92                self._svd2pac_as_ptr().add(12usize),
93            )
94        }
95    }
96
97    #[doc = "Timer gpio2 selection"]
98    #[inline(always)]
99    pub const fn timer2_gpio2_conf_reg(
100        &self,
101    ) -> &'static crate::common::Reg<self::Timer2Gpio2ConfReg_SPEC, crate::common::RW> {
102        unsafe {
103            crate::common::Reg::<self::Timer2Gpio2ConfReg_SPEC, crate::common::RW>::from_ptr(
104                self._svd2pac_as_ptr().add(16usize),
105            )
106        }
107    }
108
109    #[doc = "Timer prescaler value"]
110    #[inline(always)]
111    pub const fn timer2_prescaler_reg(
112        &self,
113    ) -> &'static crate::common::Reg<self::Timer2PrescalerReg_SPEC, crate::common::RW> {
114        unsafe {
115            crate::common::Reg::<self::Timer2PrescalerReg_SPEC, crate::common::RW>::from_ptr(
116                self._svd2pac_as_ptr().add(28usize),
117            )
118        }
119    }
120
121    #[doc = "Timer prescaler counter valuew"]
122    #[inline(always)]
123    pub const fn timer2_prescaler_val_reg(
124        &self,
125    ) -> &'static crate::common::Reg<self::Timer2PrescalerValReg_SPEC, crate::common::RW> {
126        unsafe {
127            crate::common::Reg::<self::Timer2PrescalerValReg_SPEC, crate::common::RW>::from_ptr(
128                self._svd2pac_as_ptr().add(40usize),
129            )
130        }
131    }
132
133    #[doc = "Timer pwm dc register"]
134    #[inline(always)]
135    pub const fn timer2_pwm_dc_reg(
136        &self,
137    ) -> &'static crate::common::Reg<self::Timer2PwmDcReg_SPEC, crate::common::RW> {
138        unsafe {
139            crate::common::Reg::<self::Timer2PwmDcReg_SPEC, crate::common::RW>::from_ptr(
140                self._svd2pac_as_ptr().add(48usize),
141            )
142        }
143    }
144
145    #[doc = "Timer pwm frequency register"]
146    #[inline(always)]
147    pub const fn timer2_pwm_freq_reg(
148        &self,
149    ) -> &'static crate::common::Reg<self::Timer2PwmFreqReg_SPEC, crate::common::RW> {
150        unsafe {
151            crate::common::Reg::<self::Timer2PwmFreqReg_SPEC, crate::common::RW>::from_ptr(
152                self._svd2pac_as_ptr().add(44usize),
153            )
154        }
155    }
156
157    #[doc = "Timer reload value and Delay in shot mode"]
158    #[inline(always)]
159    pub const fn timer2_reload_reg(
160        &self,
161    ) -> &'static crate::common::Reg<self::Timer2ReloadReg_SPEC, crate::common::RW> {
162        unsafe {
163            crate::common::Reg::<self::Timer2ReloadReg_SPEC, crate::common::RW>::from_ptr(
164                self._svd2pac_as_ptr().add(20usize),
165            )
166        }
167    }
168
169    #[doc = "Timer Shot duration in shot mode"]
170    #[inline(always)]
171    pub const fn timer2_shotwidth_reg(
172        &self,
173    ) -> &'static crate::common::Reg<self::Timer2ShotwidthReg_SPEC, crate::common::RW> {
174        unsafe {
175            crate::common::Reg::<self::Timer2ShotwidthReg_SPEC, crate::common::RW>::from_ptr(
176                self._svd2pac_as_ptr().add(24usize),
177            )
178        }
179    }
180
181    #[doc = "Timer status register"]
182    #[inline(always)]
183    pub const fn timer2_status_reg(
184        &self,
185    ) -> &'static crate::common::Reg<self::Timer2StatusReg_SPEC, crate::common::RW> {
186        unsafe {
187            crate::common::Reg::<self::Timer2StatusReg_SPEC, crate::common::RW>::from_ptr(
188                self._svd2pac_as_ptr().add(8usize),
189            )
190        }
191    }
192
193    #[doc = "Timer counter value"]
194    #[inline(always)]
195    pub const fn timer2_timer_val_reg(
196        &self,
197    ) -> &'static crate::common::Reg<self::Timer2TimerValReg_SPEC, crate::common::RW> {
198        unsafe {
199            crate::common::Reg::<self::Timer2TimerValReg_SPEC, crate::common::RW>::from_ptr(
200                self._svd2pac_as_ptr().add(4usize),
201            )
202        }
203    }
204}
205#[doc(hidden)]
206#[derive(Copy, Clone, Eq, PartialEq)]
207pub struct Timer2CaptureGpio1Reg_SPEC;
208impl crate::sealed::RegSpec for Timer2CaptureGpio1Reg_SPEC {
209    type DataType = u32;
210}
211
212#[doc = "Timer value for event on GPIO1"]
213pub type Timer2CaptureGpio1Reg = crate::RegValueT<Timer2CaptureGpio1Reg_SPEC>;
214
215impl Timer2CaptureGpio1Reg {
216    #[doc = "Gives the Capture time for event on GPIO1"]
217    #[inline(always)]
218    pub fn tim_capture_gpio1(
219        self,
220    ) -> crate::common::RegisterField<
221        0,
222        0xffffff,
223        1,
224        0,
225        u32,
226        u32,
227        Timer2CaptureGpio1Reg_SPEC,
228        crate::common::R,
229    > {
230        crate::common::RegisterField::<
231            0,
232            0xffffff,
233            1,
234            0,
235            u32,
236            u32,
237            Timer2CaptureGpio1Reg_SPEC,
238            crate::common::R,
239        >::from_register(self, 0)
240    }
241}
242impl ::core::default::Default for Timer2CaptureGpio1Reg {
243    #[inline(always)]
244    fn default() -> Timer2CaptureGpio1Reg {
245        <crate::RegValueT<Timer2CaptureGpio1Reg_SPEC> as RegisterValue<_>>::new(0)
246    }
247}
248
249#[doc(hidden)]
250#[derive(Copy, Clone, Eq, PartialEq)]
251pub struct Timer2CaptureGpio2Reg_SPEC;
252impl crate::sealed::RegSpec for Timer2CaptureGpio2Reg_SPEC {
253    type DataType = u32;
254}
255
256#[doc = "Timer value for event on GPIO2"]
257pub type Timer2CaptureGpio2Reg = crate::RegValueT<Timer2CaptureGpio2Reg_SPEC>;
258
259impl Timer2CaptureGpio2Reg {
260    #[doc = "Gives the Capture time for event on GPIO2"]
261    #[inline(always)]
262    pub fn tim_capture_gpio2(
263        self,
264    ) -> crate::common::RegisterField<
265        0,
266        0xffffff,
267        1,
268        0,
269        u32,
270        u32,
271        Timer2CaptureGpio2Reg_SPEC,
272        crate::common::R,
273    > {
274        crate::common::RegisterField::<
275            0,
276            0xffffff,
277            1,
278            0,
279            u32,
280            u32,
281            Timer2CaptureGpio2Reg_SPEC,
282            crate::common::R,
283        >::from_register(self, 0)
284    }
285}
286impl ::core::default::Default for Timer2CaptureGpio2Reg {
287    #[inline(always)]
288    fn default() -> Timer2CaptureGpio2Reg {
289        <crate::RegValueT<Timer2CaptureGpio2Reg_SPEC> as RegisterValue<_>>::new(0)
290    }
291}
292
293#[doc(hidden)]
294#[derive(Copy, Clone, Eq, PartialEq)]
295pub struct Timer2ClearIrqReg_SPEC;
296impl crate::sealed::RegSpec for Timer2ClearIrqReg_SPEC {
297    type DataType = u32;
298}
299
300#[doc = "Timer clear interrupt"]
301pub type Timer2ClearIrqReg = crate::RegValueT<Timer2ClearIrqReg_SPEC>;
302
303impl Timer2ClearIrqReg {
304    #[doc = "Write any value clear interrupt"]
305    #[inline(always)]
306    pub fn tim_clear_irq(
307        self,
308    ) -> crate::common::RegisterFieldBool<0, 1, 0, Timer2ClearIrqReg_SPEC, crate::common::W> {
309        crate::common::RegisterFieldBool::<0,1,0,Timer2ClearIrqReg_SPEC,crate::common::W>::from_register(self,0)
310    }
311}
312impl ::core::default::Default for Timer2ClearIrqReg {
313    #[inline(always)]
314    fn default() -> Timer2ClearIrqReg {
315        <crate::RegValueT<Timer2ClearIrqReg_SPEC> as RegisterValue<_>>::new(0)
316    }
317}
318
319#[doc(hidden)]
320#[derive(Copy, Clone, Eq, PartialEq)]
321pub struct Timer2CtrlReg_SPEC;
322impl crate::sealed::RegSpec for Timer2CtrlReg_SPEC {
323    type DataType = u32;
324}
325
326#[doc = "Timer control register"]
327pub type Timer2CtrlReg = crate::RegValueT<Timer2CtrlReg_SPEC>;
328
329impl Timer2CtrlReg {
330    #[doc = "Timer clock enable\n1 = clock enabled\n0 = clock disabled"]
331    #[inline(always)]
332    pub fn tim_clk_en(
333        self,
334    ) -> crate::common::RegisterFieldBool<8, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
335        crate::common::RegisterFieldBool::<8,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
336    }
337
338    #[doc = "Select clock\n1 = Timer uses the DIVN clock\n0 = Timer uses the lp clock"]
339    #[inline(always)]
340    pub fn tim_sys_clk_en(
341        self,
342    ) -> crate::common::RegisterFieldBool<7, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
343        crate::common::RegisterFieldBool::<7,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
344    }
345
346    #[doc = "Valid when timer counts up, if it is \'1\' timer does not zero when reaches to reload value. it becomes zero only when it reaches the max value."]
347    #[inline(always)]
348    pub fn tim_free_run_mode_en(
349        self,
350    ) -> crate::common::RegisterFieldBool<6, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
351        crate::common::RegisterFieldBool::<6,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
352    }
353
354    #[doc = "Interrupt mask\n1 = timer IRQ is unmasked\n0 = timer IRQ is masked"]
355    #[inline(always)]
356    pub fn tim_irq_en(
357        self,
358    ) -> crate::common::RegisterFieldBool<5, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
359        crate::common::RegisterFieldBool::<5,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
360    }
361
362    #[doc = "Event input 2 edge type\n1 = falling edge\n0 = rising edge"]
363    #[inline(always)]
364    pub fn tim_in2_event_fall_en(
365        self,
366    ) -> crate::common::RegisterFieldBool<4, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
367        crate::common::RegisterFieldBool::<4,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
368    }
369
370    #[doc = "Event input 1 edge type\n1 = falling edge\n0 = rising edge"]
371    #[inline(always)]
372    pub fn tim_in1_event_fall_en(
373        self,
374    ) -> crate::common::RegisterFieldBool<3, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
375        crate::common::RegisterFieldBool::<3,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
376    }
377
378    #[doc = "Timer count direction\n1 = down\n0 = up"]
379    #[inline(always)]
380    pub fn tim_count_down_en(
381        self,
382    ) -> crate::common::RegisterFieldBool<2, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
383        crate::common::RegisterFieldBool::<2,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
384    }
385
386    #[doc = "Timer mode\n1 = One shot enabled\n0 = Counter enabled"]
387    #[inline(always)]
388    pub fn tim_oneshot_mode_en(
389        self,
390    ) -> crate::common::RegisterFieldBool<1, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
391        crate::common::RegisterFieldBool::<1,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
392    }
393
394    #[doc = "Timer enable\n1 = On\n0 = Off"]
395    #[inline(always)]
396    pub fn tim_en(
397        self,
398    ) -> crate::common::RegisterFieldBool<0, 1, 0, Timer2CtrlReg_SPEC, crate::common::RW> {
399        crate::common::RegisterFieldBool::<0,1,0,Timer2CtrlReg_SPEC,crate::common::RW>::from_register(self,0)
400    }
401}
402impl ::core::default::Default for Timer2CtrlReg {
403    #[inline(always)]
404    fn default() -> Timer2CtrlReg {
405        <crate::RegValueT<Timer2CtrlReg_SPEC> as RegisterValue<_>>::new(0)
406    }
407}
408
409#[doc(hidden)]
410#[derive(Copy, Clone, Eq, PartialEq)]
411pub struct Timer2Gpio1ConfReg_SPEC;
412impl crate::sealed::RegSpec for Timer2Gpio1ConfReg_SPEC {
413    type DataType = u32;
414}
415
416#[doc = "Timer gpio1 selection"]
417pub type Timer2Gpio1ConfReg = crate::RegValueT<Timer2Gpio1ConfReg_SPEC>;
418
419impl Timer2Gpio1ConfReg {
420    #[doc = "Select one of the 32 GPIOs as IN1, Valid value 0-32. 1 for the first gpio, 32 for the last gpio. 0 Disable input"]
421    #[inline(always)]
422    pub fn tim_gpio1_conf(
423        self,
424    ) -> crate::common::RegisterField<
425        0,
426        0x3f,
427        1,
428        0,
429        u8,
430        u8,
431        Timer2Gpio1ConfReg_SPEC,
432        crate::common::RW,
433    > {
434        crate::common::RegisterField::<
435            0,
436            0x3f,
437            1,
438            0,
439            u8,
440            u8,
441            Timer2Gpio1ConfReg_SPEC,
442            crate::common::RW,
443        >::from_register(self, 0)
444    }
445}
446impl ::core::default::Default for Timer2Gpio1ConfReg {
447    #[inline(always)]
448    fn default() -> Timer2Gpio1ConfReg {
449        <crate::RegValueT<Timer2Gpio1ConfReg_SPEC> as RegisterValue<_>>::new(0)
450    }
451}
452
453#[doc(hidden)]
454#[derive(Copy, Clone, Eq, PartialEq)]
455pub struct Timer2Gpio2ConfReg_SPEC;
456impl crate::sealed::RegSpec for Timer2Gpio2ConfReg_SPEC {
457    type DataType = u32;
458}
459
460#[doc = "Timer gpio2 selection"]
461pub type Timer2Gpio2ConfReg = crate::RegValueT<Timer2Gpio2ConfReg_SPEC>;
462
463impl Timer2Gpio2ConfReg {
464    #[doc = "Select one of the 32 GPIOs as IN2, Valid value 0-32. 1 for the first gpio, 32 for the last gpio. 0 Disable input"]
465    #[inline(always)]
466    pub fn tim_gpio2_conf(
467        self,
468    ) -> crate::common::RegisterField<
469        0,
470        0x3f,
471        1,
472        0,
473        u8,
474        u8,
475        Timer2Gpio2ConfReg_SPEC,
476        crate::common::RW,
477    > {
478        crate::common::RegisterField::<
479            0,
480            0x3f,
481            1,
482            0,
483            u8,
484            u8,
485            Timer2Gpio2ConfReg_SPEC,
486            crate::common::RW,
487        >::from_register(self, 0)
488    }
489}
490impl ::core::default::Default for Timer2Gpio2ConfReg {
491    #[inline(always)]
492    fn default() -> Timer2Gpio2ConfReg {
493        <crate::RegValueT<Timer2Gpio2ConfReg_SPEC> as RegisterValue<_>>::new(0)
494    }
495}
496
497#[doc(hidden)]
498#[derive(Copy, Clone, Eq, PartialEq)]
499pub struct Timer2PrescalerReg_SPEC;
500impl crate::sealed::RegSpec for Timer2PrescalerReg_SPEC {
501    type DataType = u32;
502}
503
504#[doc = "Timer prescaler value"]
505pub type Timer2PrescalerReg = crate::RegValueT<Timer2PrescalerReg_SPEC>;
506
507impl Timer2PrescalerReg {
508    #[doc = "Defines the timer count frequency. CLOCK frequency / (TIM_PRESCALER+1)"]
509    #[inline(always)]
510    pub fn tim_prescaler(
511        self,
512    ) -> crate::common::RegisterField<
513        0,
514        0x1f,
515        1,
516        0,
517        u8,
518        u8,
519        Timer2PrescalerReg_SPEC,
520        crate::common::RW,
521    > {
522        crate::common::RegisterField::<
523            0,
524            0x1f,
525            1,
526            0,
527            u8,
528            u8,
529            Timer2PrescalerReg_SPEC,
530            crate::common::RW,
531        >::from_register(self, 0)
532    }
533}
534impl ::core::default::Default for Timer2PrescalerReg {
535    #[inline(always)]
536    fn default() -> Timer2PrescalerReg {
537        <crate::RegValueT<Timer2PrescalerReg_SPEC> as RegisterValue<_>>::new(0)
538    }
539}
540
541#[doc(hidden)]
542#[derive(Copy, Clone, Eq, PartialEq)]
543pub struct Timer2PrescalerValReg_SPEC;
544impl crate::sealed::RegSpec for Timer2PrescalerValReg_SPEC {
545    type DataType = u32;
546}
547
548#[doc = "Timer prescaler counter valuew"]
549pub type Timer2PrescalerValReg = crate::RegValueT<Timer2PrescalerValReg_SPEC>;
550
551impl Timer2PrescalerValReg {
552    #[doc = "Gives the current prescaler counter value"]
553    #[inline(always)]
554    pub fn tim_prescaler_val(
555        self,
556    ) -> crate::common::RegisterField<
557        0,
558        0x1f,
559        1,
560        0,
561        u8,
562        u8,
563        Timer2PrescalerValReg_SPEC,
564        crate::common::R,
565    > {
566        crate::common::RegisterField::<
567            0,
568            0x1f,
569            1,
570            0,
571            u8,
572            u8,
573            Timer2PrescalerValReg_SPEC,
574            crate::common::R,
575        >::from_register(self, 0)
576    }
577}
578impl ::core::default::Default for Timer2PrescalerValReg {
579    #[inline(always)]
580    fn default() -> Timer2PrescalerValReg {
581        <crate::RegValueT<Timer2PrescalerValReg_SPEC> as RegisterValue<_>>::new(0)
582    }
583}
584
585#[doc(hidden)]
586#[derive(Copy, Clone, Eq, PartialEq)]
587pub struct Timer2PwmDcReg_SPEC;
588impl crate::sealed::RegSpec for Timer2PwmDcReg_SPEC {
589    type DataType = u32;
590}
591
592#[doc = "Timer pwm dc register"]
593pub type Timer2PwmDcReg = crate::RegValueT<Timer2PwmDcReg_SPEC>;
594
595impl Timer2PwmDcReg {
596    #[doc = "Defines the PWM duty cycle. TIM_PWM_DC / ( TIM_PWM_FREQ+1)"]
597    #[inline(always)]
598    pub fn tim_pwm_dc(
599        self,
600    ) -> crate::common::RegisterField<
601        0,
602        0xffff,
603        1,
604        0,
605        u16,
606        u16,
607        Timer2PwmDcReg_SPEC,
608        crate::common::RW,
609    > {
610        crate::common::RegisterField::<
611            0,
612            0xffff,
613            1,
614            0,
615            u16,
616            u16,
617            Timer2PwmDcReg_SPEC,
618            crate::common::RW,
619        >::from_register(self, 0)
620    }
621}
622impl ::core::default::Default for Timer2PwmDcReg {
623    #[inline(always)]
624    fn default() -> Timer2PwmDcReg {
625        <crate::RegValueT<Timer2PwmDcReg_SPEC> as RegisterValue<_>>::new(0)
626    }
627}
628
629#[doc(hidden)]
630#[derive(Copy, Clone, Eq, PartialEq)]
631pub struct Timer2PwmFreqReg_SPEC;
632impl crate::sealed::RegSpec for Timer2PwmFreqReg_SPEC {
633    type DataType = u32;
634}
635
636#[doc = "Timer pwm frequency register"]
637pub type Timer2PwmFreqReg = crate::RegValueT<Timer2PwmFreqReg_SPEC>;
638
639impl Timer2PwmFreqReg {
640    #[doc = "Defines the PWM frequency. Timer clock frequency / (TIM_PWM_FREQ+1)\nTimer clock is clock after prescaler"]
641    #[inline(always)]
642    pub fn tim_pwm_freq(
643        self,
644    ) -> crate::common::RegisterField<
645        0,
646        0xffff,
647        1,
648        0,
649        u16,
650        u16,
651        Timer2PwmFreqReg_SPEC,
652        crate::common::RW,
653    > {
654        crate::common::RegisterField::<
655            0,
656            0xffff,
657            1,
658            0,
659            u16,
660            u16,
661            Timer2PwmFreqReg_SPEC,
662            crate::common::RW,
663        >::from_register(self, 0)
664    }
665}
666impl ::core::default::Default for Timer2PwmFreqReg {
667    #[inline(always)]
668    fn default() -> Timer2PwmFreqReg {
669        <crate::RegValueT<Timer2PwmFreqReg_SPEC> as RegisterValue<_>>::new(0)
670    }
671}
672
673#[doc(hidden)]
674#[derive(Copy, Clone, Eq, PartialEq)]
675pub struct Timer2ReloadReg_SPEC;
676impl crate::sealed::RegSpec for Timer2ReloadReg_SPEC {
677    type DataType = u32;
678}
679
680#[doc = "Timer reload value and Delay in shot mode"]
681pub type Timer2ReloadReg = crate::RegValueT<Timer2ReloadReg_SPEC>;
682
683impl Timer2ReloadReg {
684    #[doc = "Reload or max value in timer mode, Delay phase duration in oneshot mode. Actual delay is the register value plus synchronization time (3 clock cycles)"]
685    #[inline(always)]
686    pub fn tim_reload(
687        self,
688    ) -> crate::common::RegisterField<
689        0,
690        0xffffff,
691        1,
692        0,
693        u32,
694        u32,
695        Timer2ReloadReg_SPEC,
696        crate::common::RW,
697    > {
698        crate::common::RegisterField::<
699            0,
700            0xffffff,
701            1,
702            0,
703            u32,
704            u32,
705            Timer2ReloadReg_SPEC,
706            crate::common::RW,
707        >::from_register(self, 0)
708    }
709}
710impl ::core::default::Default for Timer2ReloadReg {
711    #[inline(always)]
712    fn default() -> Timer2ReloadReg {
713        <crate::RegValueT<Timer2ReloadReg_SPEC> as RegisterValue<_>>::new(0)
714    }
715}
716
717#[doc(hidden)]
718#[derive(Copy, Clone, Eq, PartialEq)]
719pub struct Timer2ShotwidthReg_SPEC;
720impl crate::sealed::RegSpec for Timer2ShotwidthReg_SPEC {
721    type DataType = u32;
722}
723
724#[doc = "Timer Shot duration in shot mode"]
725pub type Timer2ShotwidthReg = crate::RegValueT<Timer2ShotwidthReg_SPEC>;
726
727impl Timer2ShotwidthReg {
728    #[doc = "Shot phase duration in oneshot mode"]
729    #[inline(always)]
730    pub fn tim_shotwidth(
731        self,
732    ) -> crate::common::RegisterField<
733        0,
734        0xffffff,
735        1,
736        0,
737        u32,
738        u32,
739        Timer2ShotwidthReg_SPEC,
740        crate::common::RW,
741    > {
742        crate::common::RegisterField::<
743            0,
744            0xffffff,
745            1,
746            0,
747            u32,
748            u32,
749            Timer2ShotwidthReg_SPEC,
750            crate::common::RW,
751        >::from_register(self, 0)
752    }
753}
754impl ::core::default::Default for Timer2ShotwidthReg {
755    #[inline(always)]
756    fn default() -> Timer2ShotwidthReg {
757        <crate::RegValueT<Timer2ShotwidthReg_SPEC> as RegisterValue<_>>::new(0)
758    }
759}
760
761#[doc(hidden)]
762#[derive(Copy, Clone, Eq, PartialEq)]
763pub struct Timer2StatusReg_SPEC;
764impl crate::sealed::RegSpec for Timer2StatusReg_SPEC {
765    type DataType = u32;
766}
767
768#[doc = "Timer status register"]
769pub type Timer2StatusReg = crate::RegValueT<Timer2StatusReg_SPEC>;
770
771impl Timer2StatusReg {
772    #[doc = "OneShot phase\n0 = Wait for event\n1 = Delay phase\n2 = Start Shot\n3 = Shot phase"]
773    #[inline(always)]
774    pub fn tim_oneshot_phase(
775        self,
776    ) -> crate::common::RegisterField<2, 0x3, 1, 0, u8, u8, Timer2StatusReg_SPEC, crate::common::R>
777    {
778        crate::common::RegisterField::<2,0x3,1,0,u8,u8,Timer2StatusReg_SPEC,crate::common::R>::from_register(self,0)
779    }
780
781    #[doc = "Gives the logic level of the IN1"]
782    #[inline(always)]
783    pub fn tim_in2_state(
784        self,
785    ) -> crate::common::RegisterFieldBool<1, 1, 0, Timer2StatusReg_SPEC, crate::common::R> {
786        crate::common::RegisterFieldBool::<1,1,0,Timer2StatusReg_SPEC,crate::common::R>::from_register(self,0)
787    }
788
789    #[doc = "Gives the logic level of the IN2"]
790    #[inline(always)]
791    pub fn tim_in1_state(
792        self,
793    ) -> crate::common::RegisterFieldBool<0, 1, 0, Timer2StatusReg_SPEC, crate::common::R> {
794        crate::common::RegisterFieldBool::<0,1,0,Timer2StatusReg_SPEC,crate::common::R>::from_register(self,0)
795    }
796}
797impl ::core::default::Default for Timer2StatusReg {
798    #[inline(always)]
799    fn default() -> Timer2StatusReg {
800        <crate::RegValueT<Timer2StatusReg_SPEC> as RegisterValue<_>>::new(0)
801    }
802}
803
804#[doc(hidden)]
805#[derive(Copy, Clone, Eq, PartialEq)]
806pub struct Timer2TimerValReg_SPEC;
807impl crate::sealed::RegSpec for Timer2TimerValReg_SPEC {
808    type DataType = u32;
809}
810
811#[doc = "Timer counter value"]
812pub type Timer2TimerValReg = crate::RegValueT<Timer2TimerValReg_SPEC>;
813
814impl Timer2TimerValReg {
815    #[doc = "Gives the current timer value"]
816    #[inline(always)]
817    pub fn tim_timer_value(
818        self,
819    ) -> crate::common::RegisterField<
820        0,
821        0xffffff,
822        1,
823        0,
824        u32,
825        u32,
826        Timer2TimerValReg_SPEC,
827        crate::common::R,
828    > {
829        crate::common::RegisterField::<
830            0,
831            0xffffff,
832            1,
833            0,
834            u32,
835            u32,
836            Timer2TimerValReg_SPEC,
837            crate::common::R,
838        >::from_register(self, 0)
839    }
840}
841impl ::core::default::Default for Timer2TimerValReg {
842    #[inline(always)]
843    fn default() -> Timer2TimerValReg {
844        <crate::RegValueT<Timer2TimerValReg_SPEC> as RegisterValue<_>>::new(0)
845    }
846}