esp32p4/mcpwm0/ch/
gen_cfg0.rs

1#[doc = "Register `GEN_CFG0` reader"]
2pub type R = crate::R<GEN_CFG0_SPEC>;
3#[doc = "Register `GEN_CFG0` writer"]
4pub type W = crate::W<GEN_CFG0_SPEC>;
5#[doc = "Field `CFG_UPMETHOD` reader - Configures update method for PWM generator %s's active register.\\\\0: Immediately\\\\Bit0 is set to 1: TEZ\\\\Bit1 is set to 1: TEP\\\\Bit2 is set to 1: Sync\\\\Bit3 is set to 1: Disable the update"]
6pub type CFG_UPMETHOD_R = crate::FieldReader;
7#[doc = "Field `CFG_UPMETHOD` writer - Configures update method for PWM generator %s's active register.\\\\0: Immediately\\\\Bit0 is set to 1: TEZ\\\\Bit1 is set to 1: TEP\\\\Bit2 is set to 1: Sync\\\\Bit3 is set to 1: Disable the update"]
8pub type CFG_UPMETHOD_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Field `T0_SEL` reader - Configures source selection for PWM generator %s event_t0, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
10pub type T0_SEL_R = crate::FieldReader;
11#[doc = "Field `T0_SEL` writer - Configures source selection for PWM generator %s event_t0, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
12pub type T0_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `T1_SEL` reader - Configures source selection for PWM generator %s event_t1, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
14pub type T1_SEL_R = crate::FieldReader;
15#[doc = "Field `T1_SEL` writer - Configures source selection for PWM generator %s event_t1, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
16pub type T1_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17impl R {
18    #[doc = "Bits 0:3 - Configures update method for PWM generator %s's active register.\\\\0: Immediately\\\\Bit0 is set to 1: TEZ\\\\Bit1 is set to 1: TEP\\\\Bit2 is set to 1: Sync\\\\Bit3 is set to 1: Disable the update"]
19    #[inline(always)]
20    pub fn cfg_upmethod(&self) -> CFG_UPMETHOD_R {
21        CFG_UPMETHOD_R::new((self.bits & 0x0f) as u8)
22    }
23    #[doc = "Bits 4:6 - Configures source selection for PWM generator %s event_t0, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
24    #[inline(always)]
25    pub fn t0_sel(&self) -> T0_SEL_R {
26        T0_SEL_R::new(((self.bits >> 4) & 7) as u8)
27    }
28    #[doc = "Bits 7:9 - Configures source selection for PWM generator %s event_t1, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
29    #[inline(always)]
30    pub fn t1_sel(&self) -> T1_SEL_R {
31        T1_SEL_R::new(((self.bits >> 7) & 7) as u8)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("GEN_CFG0")
38            .field(
39                "cfg_upmethod",
40                &format_args!("{}", self.cfg_upmethod().bits()),
41            )
42            .field("t0_sel", &format_args!("{}", self.t0_sel().bits()))
43            .field("t1_sel", &format_args!("{}", self.t1_sel().bits()))
44            .finish()
45    }
46}
47#[cfg(feature = "impl-register-debug")]
48impl core::fmt::Debug for crate::generic::Reg<GEN_CFG0_SPEC> {
49    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
50        core::fmt::Debug::fmt(&self.read(), f)
51    }
52}
53impl W {
54    #[doc = "Bits 0:3 - Configures update method for PWM generator %s's active register.\\\\0: Immediately\\\\Bit0 is set to 1: TEZ\\\\Bit1 is set to 1: TEP\\\\Bit2 is set to 1: Sync\\\\Bit3 is set to 1: Disable the update"]
55    #[inline(always)]
56    #[must_use]
57    pub fn cfg_upmethod(&mut self) -> CFG_UPMETHOD_W<GEN_CFG0_SPEC> {
58        CFG_UPMETHOD_W::new(self, 0)
59    }
60    #[doc = "Bits 4:6 - Configures source selection for PWM generator %s event_t0, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
61    #[inline(always)]
62    #[must_use]
63    pub fn t0_sel(&mut self) -> T0_SEL_W<GEN_CFG0_SPEC> {
64        T0_SEL_W::new(self, 4)
65    }
66    #[doc = "Bits 7:9 - Configures source selection for PWM generator %s event_t1, take effect immediately.\\\\0: fault_event0\\\\1: fault_event1\\\\2: fault_event2\\\\3: sync_taken\\\\4: Invalid, Select nothing"]
67    #[inline(always)]
68    #[must_use]
69    pub fn t1_sel(&mut self) -> T1_SEL_W<GEN_CFG0_SPEC> {
70        T1_SEL_W::new(self, 7)
71    }
72}
73#[doc = "Generator0 fault event T0 and T1 configuration register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`gen_cfg0::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`gen_cfg0::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
74pub struct GEN_CFG0_SPEC;
75impl crate::RegisterSpec for GEN_CFG0_SPEC {
76    type Ux = u32;
77}
78#[doc = "`read()` method returns [`gen_cfg0::R`](R) reader structure"]
79impl crate::Readable for GEN_CFG0_SPEC {}
80#[doc = "`write(|w| ..)` method takes [`gen_cfg0::W`](W) writer structure"]
81impl crate::Writable for GEN_CFG0_SPEC {
82    type Safety = crate::Unsafe;
83    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
84    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
85}
86#[doc = "`reset()` method sets GEN_CFG0 to value 0"]
87impl crate::Resettable for GEN_CFG0_SPEC {
88    const RESET_VALUE: u32 = 0;
89}