esp32c6/mcpwm0/ch/
gen_force.rs

1#[doc = "Register `GEN_FORCE` reader"]
2pub type R = crate::R<GEN_FORCE_SPEC>;
3#[doc = "Register `GEN_FORCE` writer"]
4pub type W = crate::W<GEN_FORCE_SPEC>;
5#[doc = "Field `CNTUFORCE_UPMETHOD` reader - Updating method for continuous software force of PWM generator0. When all bits are set to 0: immediately, when bit0 is set to 1: TEZ,,when bit1 is set to 1: TEP, when bit2 is set to 1: TEA, when bit3 is set to 1: TEB, when bit4 is set to 1: sync, when bit5 is set to 1: disable update. (TEA/B here and below means an event generated when the timer's value equals to that of register A/B.)"]
6pub type CNTUFORCE_UPMETHOD_R = crate::FieldReader;
7#[doc = "Field `CNTUFORCE_UPMETHOD` writer - Updating method for continuous software force of PWM generator0. When all bits are set to 0: immediately, when bit0 is set to 1: TEZ,,when bit1 is set to 1: TEP, when bit2 is set to 1: TEA, when bit3 is set to 1: TEB, when bit4 is set to 1: sync, when bit5 is set to 1: disable update. (TEA/B here and below means an event generated when the timer's value equals to that of register A/B.)"]
8pub type CNTUFORCE_UPMETHOD_W<'a, REG> = crate::FieldWriter<'a, REG, 6>;
9#[doc = "Field `A_CNTUFORCE_MODE` reader - Continuous software force mode for PWM0A. 0: disabled, 1: low, 2: high, 3: disabled"]
10pub type A_CNTUFORCE_MODE_R = crate::FieldReader;
11#[doc = "Field `A_CNTUFORCE_MODE` writer - Continuous software force mode for PWM0A. 0: disabled, 1: low, 2: high, 3: disabled"]
12pub type A_CNTUFORCE_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `B_CNTUFORCE_MODE` reader - Continuous software force mode for PWM0B. 0: disabled, 1: low, 2: high, 3: disabled"]
14pub type B_CNTUFORCE_MODE_R = crate::FieldReader;
15#[doc = "Field `B_CNTUFORCE_MODE` writer - Continuous software force mode for PWM0B. 0: disabled, 1: low, 2: high, 3: disabled"]
16pub type B_CNTUFORCE_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `A_NCIFORCE` reader - Trigger of non-continuous immediate software-force event for PWM0A, a toggle will trigger a force event."]
18pub type A_NCIFORCE_R = crate::BitReader;
19#[doc = "Field `A_NCIFORCE` writer - Trigger of non-continuous immediate software-force event for PWM0A, a toggle will trigger a force event."]
20pub type A_NCIFORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `A_NCIFORCE_MODE` reader - non-continuous immediate software force mode for PWM0A, 0: disabled, 1: low, 2: high, 3: disabled"]
22pub type A_NCIFORCE_MODE_R = crate::FieldReader;
23#[doc = "Field `A_NCIFORCE_MODE` writer - non-continuous immediate software force mode for PWM0A, 0: disabled, 1: low, 2: high, 3: disabled"]
24pub type A_NCIFORCE_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `B_NCIFORCE` reader - Trigger of non-continuous immediate software-force event for PWM0B, a toggle will trigger a force event."]
26pub type B_NCIFORCE_R = crate::BitReader;
27#[doc = "Field `B_NCIFORCE` writer - Trigger of non-continuous immediate software-force event for PWM0B, a toggle will trigger a force event."]
28pub type B_NCIFORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `B_NCIFORCE_MODE` reader - non-continuous immediate software force mode for PWM0B, 0: disabled, 1: low, 2: high, 3: disabled"]
30pub type B_NCIFORCE_MODE_R = crate::FieldReader;
31#[doc = "Field `B_NCIFORCE_MODE` writer - non-continuous immediate software force mode for PWM0B, 0: disabled, 1: low, 2: high, 3: disabled"]
32pub type B_NCIFORCE_MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
33impl R {
34    #[doc = "Bits 0:5 - Updating method for continuous software force of PWM generator0. When all bits are set to 0: immediately, when bit0 is set to 1: TEZ,,when bit1 is set to 1: TEP, when bit2 is set to 1: TEA, when bit3 is set to 1: TEB, when bit4 is set to 1: sync, when bit5 is set to 1: disable update. (TEA/B here and below means an event generated when the timer's value equals to that of register A/B.)"]
35    #[inline(always)]
36    pub fn cntuforce_upmethod(&self) -> CNTUFORCE_UPMETHOD_R {
37        CNTUFORCE_UPMETHOD_R::new((self.bits & 0x3f) as u8)
38    }
39    #[doc = "Bits 6:7 - Continuous software force mode for PWM0A. 0: disabled, 1: low, 2: high, 3: disabled"]
40    #[inline(always)]
41    pub fn a_cntuforce_mode(&self) -> A_CNTUFORCE_MODE_R {
42        A_CNTUFORCE_MODE_R::new(((self.bits >> 6) & 3) as u8)
43    }
44    #[doc = "Bits 8:9 - Continuous software force mode for PWM0B. 0: disabled, 1: low, 2: high, 3: disabled"]
45    #[inline(always)]
46    pub fn b_cntuforce_mode(&self) -> B_CNTUFORCE_MODE_R {
47        B_CNTUFORCE_MODE_R::new(((self.bits >> 8) & 3) as u8)
48    }
49    #[doc = "Bit 10 - Trigger of non-continuous immediate software-force event for PWM0A, a toggle will trigger a force event."]
50    #[inline(always)]
51    pub fn a_nciforce(&self) -> A_NCIFORCE_R {
52        A_NCIFORCE_R::new(((self.bits >> 10) & 1) != 0)
53    }
54    #[doc = "Bits 11:12 - non-continuous immediate software force mode for PWM0A, 0: disabled, 1: low, 2: high, 3: disabled"]
55    #[inline(always)]
56    pub fn a_nciforce_mode(&self) -> A_NCIFORCE_MODE_R {
57        A_NCIFORCE_MODE_R::new(((self.bits >> 11) & 3) as u8)
58    }
59    #[doc = "Bit 13 - Trigger of non-continuous immediate software-force event for PWM0B, a toggle will trigger a force event."]
60    #[inline(always)]
61    pub fn b_nciforce(&self) -> B_NCIFORCE_R {
62        B_NCIFORCE_R::new(((self.bits >> 13) & 1) != 0)
63    }
64    #[doc = "Bits 14:15 - non-continuous immediate software force mode for PWM0B, 0: disabled, 1: low, 2: high, 3: disabled"]
65    #[inline(always)]
66    pub fn b_nciforce_mode(&self) -> B_NCIFORCE_MODE_R {
67        B_NCIFORCE_MODE_R::new(((self.bits >> 14) & 3) as u8)
68    }
69}
70#[cfg(feature = "impl-register-debug")]
71impl core::fmt::Debug for R {
72    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
73        f.debug_struct("GEN_FORCE")
74            .field("cntuforce_upmethod", &self.cntuforce_upmethod())
75            .field("a_cntuforce_mode", &self.a_cntuforce_mode())
76            .field("b_cntuforce_mode", &self.b_cntuforce_mode())
77            .field("a_nciforce", &self.a_nciforce())
78            .field("a_nciforce_mode", &self.a_nciforce_mode())
79            .field("b_nciforce", &self.b_nciforce())
80            .field("b_nciforce_mode", &self.b_nciforce_mode())
81            .finish()
82    }
83}
84impl W {
85    #[doc = "Bits 0:5 - Updating method for continuous software force of PWM generator0. When all bits are set to 0: immediately, when bit0 is set to 1: TEZ,,when bit1 is set to 1: TEP, when bit2 is set to 1: TEA, when bit3 is set to 1: TEB, when bit4 is set to 1: sync, when bit5 is set to 1: disable update. (TEA/B here and below means an event generated when the timer's value equals to that of register A/B.)"]
86    #[inline(always)]
87    pub fn cntuforce_upmethod(&mut self) -> CNTUFORCE_UPMETHOD_W<GEN_FORCE_SPEC> {
88        CNTUFORCE_UPMETHOD_W::new(self, 0)
89    }
90    #[doc = "Bits 6:7 - Continuous software force mode for PWM0A. 0: disabled, 1: low, 2: high, 3: disabled"]
91    #[inline(always)]
92    pub fn a_cntuforce_mode(&mut self) -> A_CNTUFORCE_MODE_W<GEN_FORCE_SPEC> {
93        A_CNTUFORCE_MODE_W::new(self, 6)
94    }
95    #[doc = "Bits 8:9 - Continuous software force mode for PWM0B. 0: disabled, 1: low, 2: high, 3: disabled"]
96    #[inline(always)]
97    pub fn b_cntuforce_mode(&mut self) -> B_CNTUFORCE_MODE_W<GEN_FORCE_SPEC> {
98        B_CNTUFORCE_MODE_W::new(self, 8)
99    }
100    #[doc = "Bit 10 - Trigger of non-continuous immediate software-force event for PWM0A, a toggle will trigger a force event."]
101    #[inline(always)]
102    pub fn a_nciforce(&mut self) -> A_NCIFORCE_W<GEN_FORCE_SPEC> {
103        A_NCIFORCE_W::new(self, 10)
104    }
105    #[doc = "Bits 11:12 - non-continuous immediate software force mode for PWM0A, 0: disabled, 1: low, 2: high, 3: disabled"]
106    #[inline(always)]
107    pub fn a_nciforce_mode(&mut self) -> A_NCIFORCE_MODE_W<GEN_FORCE_SPEC> {
108        A_NCIFORCE_MODE_W::new(self, 11)
109    }
110    #[doc = "Bit 13 - Trigger of non-continuous immediate software-force event for PWM0B, a toggle will trigger a force event."]
111    #[inline(always)]
112    pub fn b_nciforce(&mut self) -> B_NCIFORCE_W<GEN_FORCE_SPEC> {
113        B_NCIFORCE_W::new(self, 13)
114    }
115    #[doc = "Bits 14:15 - non-continuous immediate software force mode for PWM0B, 0: disabled, 1: low, 2: high, 3: disabled"]
116    #[inline(always)]
117    pub fn b_nciforce_mode(&mut self) -> B_NCIFORCE_MODE_W<GEN_FORCE_SPEC> {
118        B_NCIFORCE_MODE_W::new(self, 14)
119    }
120}
121#[doc = "Permissives to force PWMxA and PWMxB outputs by software\n\nYou can [`read`](crate::Reg::read) this register and get [`gen_force::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gen_force::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
122pub struct GEN_FORCE_SPEC;
123impl crate::RegisterSpec for GEN_FORCE_SPEC {
124    type Ux = u32;
125}
126#[doc = "`read()` method returns [`gen_force::R`](R) reader structure"]
127impl crate::Readable for GEN_FORCE_SPEC {}
128#[doc = "`write(|w| ..)` method takes [`gen_force::W`](W) writer structure"]
129impl crate::Writable for GEN_FORCE_SPEC {
130    type Safety = crate::Unsafe;
131    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
132    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
133}
134#[doc = "`reset()` method sets GEN_FORCE to value 0x20"]
135impl crate::Resettable for GEN_FORCE_SPEC {
136    const RESET_VALUE: u32 = 0x20;
137}