esp32p4/mcpwm0/timer/
cfg1.rs

1#[doc = "Register `CFG1` reader"]
2pub type R = crate::R<CFG1_SPEC>;
3#[doc = "Register `CFG1` writer"]
4pub type W = crate::W<CFG1_SPEC>;
5#[doc = "Field `START` reader - Configures whether or not to start/stop PWM timer%s.\\\\0: If PWM timer%s starts, then stops at TEZ\\\\1: If timer%s starts, then stops at TEP\\\\2: PWM timer%s starts and runs on\\\\3: Timer%s starts and stops at the next TEZ\\\\4: Timer0 starts and stops at the next TEP.\\\\TEP here and below means the event that happens when the timer equals to period"]
6pub type START_R = crate::FieldReader;
7#[doc = "Field `START` writer - Configures whether or not to start/stop PWM timer%s.\\\\0: If PWM timer%s starts, then stops at TEZ\\\\1: If timer%s starts, then stops at TEP\\\\2: PWM timer%s starts and runs on\\\\3: Timer%s starts and stops at the next TEZ\\\\4: Timer0 starts and stops at the next TEP.\\\\TEP here and below means the event that happens when the timer equals to period"]
8pub type START_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `MOD` reader - Configures the working mode of PWM timer%s.\\\\0: Freeze\\\\1: Increase mode\\\\2: Decrease mode\\\\3: Up-down mode"]
10pub type MOD_R = crate::FieldReader;
11#[doc = "Field `MOD` writer - Configures the working mode of PWM timer%s.\\\\0: Freeze\\\\1: Increase mode\\\\2: Decrease mode\\\\3: Up-down mode"]
12pub type MOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13impl R {
14    #[doc = "Bits 0:2 - Configures whether or not to start/stop PWM timer%s.\\\\0: If PWM timer%s starts, then stops at TEZ\\\\1: If timer%s starts, then stops at TEP\\\\2: PWM timer%s starts and runs on\\\\3: Timer%s starts and stops at the next TEZ\\\\4: Timer0 starts and stops at the next TEP.\\\\TEP here and below means the event that happens when the timer equals to period"]
15    #[inline(always)]
16    pub fn start(&self) -> START_R {
17        START_R::new((self.bits & 7) as u8)
18    }
19    #[doc = "Bits 3:4 - Configures the working mode of PWM timer%s.\\\\0: Freeze\\\\1: Increase mode\\\\2: Decrease mode\\\\3: Up-down mode"]
20    #[inline(always)]
21    pub fn mod_(&self) -> MOD_R {
22        MOD_R::new(((self.bits >> 3) & 3) as u8)
23    }
24}
25#[cfg(feature = "impl-register-debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("CFG1")
29            .field("start", &format_args!("{}", self.start().bits()))
30            .field("mod_", &format_args!("{}", self.mod_().bits()))
31            .finish()
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for crate::generic::Reg<CFG1_SPEC> {
36    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
37        core::fmt::Debug::fmt(&self.read(), f)
38    }
39}
40impl W {
41    #[doc = "Bits 0:2 - Configures whether or not to start/stop PWM timer%s.\\\\0: If PWM timer%s starts, then stops at TEZ\\\\1: If timer%s starts, then stops at TEP\\\\2: PWM timer%s starts and runs on\\\\3: Timer%s starts and stops at the next TEZ\\\\4: Timer0 starts and stops at the next TEP.\\\\TEP here and below means the event that happens when the timer equals to period"]
42    #[inline(always)]
43    #[must_use]
44    pub fn start(&mut self) -> START_W<CFG1_SPEC> {
45        START_W::new(self, 0)
46    }
47    #[doc = "Bits 3:4 - Configures the working mode of PWM timer%s.\\\\0: Freeze\\\\1: Increase mode\\\\2: Decrease mode\\\\3: Up-down mode"]
48    #[inline(always)]
49    #[must_use]
50    pub fn mod_(&mut self) -> MOD_W<CFG1_SPEC> {
51        MOD_W::new(self, 3)
52    }
53}
54#[doc = "PWM timer0 working mode and start/stop control register.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cfg1::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 [`cfg1::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct CFG1_SPEC;
56impl crate::RegisterSpec for CFG1_SPEC {
57    type Ux = u32;
58}
59#[doc = "`read()` method returns [`cfg1::R`](R) reader structure"]
60impl crate::Readable for CFG1_SPEC {}
61#[doc = "`write(|w| ..)` method takes [`cfg1::W`](W) writer structure"]
62impl crate::Writable for CFG1_SPEC {
63    type Safety = crate::Unsafe;
64    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
65    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
66}
67#[doc = "`reset()` method sets CFG1 to value 0"]
68impl crate::Resettable for CFG1_SPEC {
69    const RESET_VALUE: u32 = 0;
70}