1#[doc = "Register `per` reader"]
2pub type R = crate::R<PER_SPEC>;
3#[doc = "Register `per` writer"]
4pub type W = crate::W<PER_SPEC>;
5#[doc = "Field `pwm_en[0-7]` reader - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
6pub type PWM_EN_R = crate::BitReader<PWM_EN_A>;
7#[doc = "When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform.\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum PWM_EN_A {
10 #[doc = "0: PWM disable"]
11 DISABLE = 0,
12 #[doc = "1: PWM enable"]
13 ENABLE = 1,
14}
15impl From<PWM_EN_A> for bool {
16 #[inline(always)]
17 fn from(variant: PWM_EN_A) -> Self {
18 variant as u8 != 0
19 }
20}
21impl PWM_EN_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> PWM_EN_A {
25 match self.bits {
26 false => PWM_EN_A::DISABLE,
27 true => PWM_EN_A::ENABLE,
28 }
29 }
30 #[doc = "PWM disable"]
31 #[inline(always)]
32 pub fn is_disable(&self) -> bool {
33 *self == PWM_EN_A::DISABLE
34 }
35 #[doc = "PWM enable"]
36 #[inline(always)]
37 pub fn is_enable(&self) -> bool {
38 *self == PWM_EN_A::ENABLE
39 }
40}
41#[doc = "Field `pwm_en[0-7]` writer - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
42pub type PWM_EN_W<'a, REG> = crate::BitWriter<'a, REG, PWM_EN_A>;
43impl<'a, REG> PWM_EN_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "PWM disable"]
48 #[inline(always)]
49 pub fn disable(self) -> &'a mut crate::W<REG> {
50 self.variant(PWM_EN_A::DISABLE)
51 }
52 #[doc = "PWM enable"]
53 #[inline(always)]
54 pub fn enable(self) -> &'a mut crate::W<REG> {
55 self.variant(PWM_EN_A::ENABLE)
56 }
57}
58impl R {
59 #[doc = "When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform.\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pwm0_en` field"]
60 #[inline(always)]
61 pub fn pwm_en(&self, n: u8) -> PWM_EN_R {
62 #[allow(clippy::no_effect)]
63 [(); 8][n as usize];
64 PWM_EN_R::new(((self.bits >> n) & 1) != 0)
65 }
66 #[doc = "Bit 0 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
67 #[inline(always)]
68 pub fn pwm0_en(&self) -> PWM_EN_R {
69 PWM_EN_R::new((self.bits & 1) != 0)
70 }
71 #[doc = "Bit 1 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
72 #[inline(always)]
73 pub fn pwm1_en(&self) -> PWM_EN_R {
74 PWM_EN_R::new(((self.bits >> 1) & 1) != 0)
75 }
76 #[doc = "Bit 2 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
77 #[inline(always)]
78 pub fn pwm2_en(&self) -> PWM_EN_R {
79 PWM_EN_R::new(((self.bits >> 2) & 1) != 0)
80 }
81 #[doc = "Bit 3 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
82 #[inline(always)]
83 pub fn pwm3_en(&self) -> PWM_EN_R {
84 PWM_EN_R::new(((self.bits >> 3) & 1) != 0)
85 }
86 #[doc = "Bit 4 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
87 #[inline(always)]
88 pub fn pwm4_en(&self) -> PWM_EN_R {
89 PWM_EN_R::new(((self.bits >> 4) & 1) != 0)
90 }
91 #[doc = "Bit 5 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
92 #[inline(always)]
93 pub fn pwm5_en(&self) -> PWM_EN_R {
94 PWM_EN_R::new(((self.bits >> 5) & 1) != 0)
95 }
96 #[doc = "Bit 6 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
97 #[inline(always)]
98 pub fn pwm6_en(&self) -> PWM_EN_R {
99 PWM_EN_R::new(((self.bits >> 6) & 1) != 0)
100 }
101 #[doc = "Bit 7 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
102 #[inline(always)]
103 pub fn pwm7_en(&self) -> PWM_EN_R {
104 PWM_EN_R::new(((self.bits >> 7) & 1) != 0)
105 }
106}
107impl W {
108 #[doc = "When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform.\n\nNOTE: `n` is number of field in register. `n == 0` corresponds to `pwm0_en` field"]
109 #[inline(always)]
110 #[must_use]
111 pub fn pwm_en(&mut self, n: u8) -> PWM_EN_W<PER_SPEC> {
112 #[allow(clippy::no_effect)]
113 [(); 8][n as usize];
114 PWM_EN_W::new(self, n)
115 }
116 #[doc = "Bit 0 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
117 #[inline(always)]
118 #[must_use]
119 pub fn pwm0_en(&mut self) -> PWM_EN_W<PER_SPEC> {
120 PWM_EN_W::new(self, 0)
121 }
122 #[doc = "Bit 1 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
123 #[inline(always)]
124 #[must_use]
125 pub fn pwm1_en(&mut self) -> PWM_EN_W<PER_SPEC> {
126 PWM_EN_W::new(self, 1)
127 }
128 #[doc = "Bit 2 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
129 #[inline(always)]
130 #[must_use]
131 pub fn pwm2_en(&mut self) -> PWM_EN_W<PER_SPEC> {
132 PWM_EN_W::new(self, 2)
133 }
134 #[doc = "Bit 3 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
135 #[inline(always)]
136 #[must_use]
137 pub fn pwm3_en(&mut self) -> PWM_EN_W<PER_SPEC> {
138 PWM_EN_W::new(self, 3)
139 }
140 #[doc = "Bit 4 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
141 #[inline(always)]
142 #[must_use]
143 pub fn pwm4_en(&mut self) -> PWM_EN_W<PER_SPEC> {
144 PWM_EN_W::new(self, 4)
145 }
146 #[doc = "Bit 5 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
147 #[inline(always)]
148 #[must_use]
149 pub fn pwm5_en(&mut self) -> PWM_EN_W<PER_SPEC> {
150 PWM_EN_W::new(self, 5)
151 }
152 #[doc = "Bit 6 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
153 #[inline(always)]
154 #[must_use]
155 pub fn pwm6_en(&mut self) -> PWM_EN_W<PER_SPEC> {
156 PWM_EN_W::new(self, 6)
157 }
158 #[doc = "Bit 7 - When PWM is enabled, the 16-bit up-counter starts working and PWM channel is permitted to output PWM waveform."]
159 #[inline(always)]
160 #[must_use]
161 pub fn pwm7_en(&mut self) -> PWM_EN_W<PER_SPEC> {
162 PWM_EN_W::new(self, 7)
163 }
164 #[doc = r" Writes raw bits to the register."]
165 #[doc = r""]
166 #[doc = r" # Safety"]
167 #[doc = r""]
168 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
169 #[inline(always)]
170 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
171 self.bits = bits;
172 self
173 }
174}
175#[doc = "PWM Enable Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`per::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 [`per::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
176pub struct PER_SPEC;
177impl crate::RegisterSpec for PER_SPEC {
178 type Ux = u32;
179}
180#[doc = "`read()` method returns [`per::R`](R) reader structure"]
181impl crate::Readable for PER_SPEC {}
182#[doc = "`write(|w| ..)` method takes [`per::W`](W) writer structure"]
183impl crate::Writable for PER_SPEC {
184 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
186}
187#[doc = "`reset()` method sets per to value 0"]
188impl crate::Resettable for PER_SPEC {
189 const RESET_VALUE: Self::Ux = 0;
190}