1#[doc = "Register `PWMC` reader"]
2pub type R = crate::R<PwmcSpec>;
3#[doc = "Register `PWMC` writer"]
4pub type W = crate::W<PwmcSpec>;
5#[doc = "PWM Mode Enable for Channel 0\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Pwmen0 {
9 #[doc = "0: Disable"]
10 Match = 0,
11 #[doc = "1: Enable"]
12 Pwm = 1,
13}
14impl From<Pwmen0> for bool {
15 #[inline(always)]
16 fn from(variant: Pwmen0) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `PWMEN0` reader - PWM Mode Enable for Channel 0"]
21pub type Pwmen0R = crate::BitReader<Pwmen0>;
22impl Pwmen0R {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Pwmen0 {
26 match self.bits {
27 false => Pwmen0::Match,
28 true => Pwmen0::Pwm,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_match(&self) -> bool {
34 *self == Pwmen0::Match
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_pwm(&self) -> bool {
39 *self == Pwmen0::Pwm
40 }
41}
42#[doc = "Field `PWMEN0` writer - PWM Mode Enable for Channel 0"]
43pub type Pwmen0W<'a, REG> = crate::BitWriter<'a, REG, Pwmen0>;
44impl<'a, REG> Pwmen0W<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn match_(self) -> &'a mut crate::W<REG> {
51 self.variant(Pwmen0::Match)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn pwm(self) -> &'a mut crate::W<REG> {
56 self.variant(Pwmen0::Pwm)
57 }
58}
59#[doc = "PWM Mode Enable for Channel 1\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Pwmen1 {
63 #[doc = "0: Disable"]
64 Match = 0,
65 #[doc = "1: Enable"]
66 Pwm = 1,
67}
68impl From<Pwmen1> for bool {
69 #[inline(always)]
70 fn from(variant: Pwmen1) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `PWMEN1` reader - PWM Mode Enable for Channel 1"]
75pub type Pwmen1R = crate::BitReader<Pwmen1>;
76impl Pwmen1R {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Pwmen1 {
80 match self.bits {
81 false => Pwmen1::Match,
82 true => Pwmen1::Pwm,
83 }
84 }
85 #[doc = "Disable"]
86 #[inline(always)]
87 pub fn is_match(&self) -> bool {
88 *self == Pwmen1::Match
89 }
90 #[doc = "Enable"]
91 #[inline(always)]
92 pub fn is_pwm(&self) -> bool {
93 *self == Pwmen1::Pwm
94 }
95}
96#[doc = "Field `PWMEN1` writer - PWM Mode Enable for Channel 1"]
97pub type Pwmen1W<'a, REG> = crate::BitWriter<'a, REG, Pwmen1>;
98impl<'a, REG> Pwmen1W<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Disable"]
103 #[inline(always)]
104 pub fn match_(self) -> &'a mut crate::W<REG> {
105 self.variant(Pwmen1::Match)
106 }
107 #[doc = "Enable"]
108 #[inline(always)]
109 pub fn pwm(self) -> &'a mut crate::W<REG> {
110 self.variant(Pwmen1::Pwm)
111 }
112}
113#[doc = "PWM Mode Enable for Channel 2\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Pwmen2 {
117 #[doc = "0: Disable"]
118 Match = 0,
119 #[doc = "1: Enable"]
120 Pwm = 1,
121}
122impl From<Pwmen2> for bool {
123 #[inline(always)]
124 fn from(variant: Pwmen2) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `PWMEN2` reader - PWM Mode Enable for Channel 2"]
129pub type Pwmen2R = crate::BitReader<Pwmen2>;
130impl Pwmen2R {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Pwmen2 {
134 match self.bits {
135 false => Pwmen2::Match,
136 true => Pwmen2::Pwm,
137 }
138 }
139 #[doc = "Disable"]
140 #[inline(always)]
141 pub fn is_match(&self) -> bool {
142 *self == Pwmen2::Match
143 }
144 #[doc = "Enable"]
145 #[inline(always)]
146 pub fn is_pwm(&self) -> bool {
147 *self == Pwmen2::Pwm
148 }
149}
150#[doc = "Field `PWMEN2` writer - PWM Mode Enable for Channel 2"]
151pub type Pwmen2W<'a, REG> = crate::BitWriter<'a, REG, Pwmen2>;
152impl<'a, REG> Pwmen2W<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Disable"]
157 #[inline(always)]
158 pub fn match_(self) -> &'a mut crate::W<REG> {
159 self.variant(Pwmen2::Match)
160 }
161 #[doc = "Enable"]
162 #[inline(always)]
163 pub fn pwm(self) -> &'a mut crate::W<REG> {
164 self.variant(Pwmen2::Pwm)
165 }
166}
167#[doc = "PWM Mode Enable for Channel 3\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Pwmen3 {
171 #[doc = "0: Disable"]
172 Match = 0,
173 #[doc = "1: Enable"]
174 Pwm = 1,
175}
176impl From<Pwmen3> for bool {
177 #[inline(always)]
178 fn from(variant: Pwmen3) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `PWMEN3` reader - PWM Mode Enable for Channel 3"]
183pub type Pwmen3R = crate::BitReader<Pwmen3>;
184impl Pwmen3R {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> Pwmen3 {
188 match self.bits {
189 false => Pwmen3::Match,
190 true => Pwmen3::Pwm,
191 }
192 }
193 #[doc = "Disable"]
194 #[inline(always)]
195 pub fn is_match(&self) -> bool {
196 *self == Pwmen3::Match
197 }
198 #[doc = "Enable"]
199 #[inline(always)]
200 pub fn is_pwm(&self) -> bool {
201 *self == Pwmen3::Pwm
202 }
203}
204#[doc = "Field `PWMEN3` writer - PWM Mode Enable for Channel 3"]
205pub type Pwmen3W<'a, REG> = crate::BitWriter<'a, REG, Pwmen3>;
206impl<'a, REG> Pwmen3W<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Disable"]
211 #[inline(always)]
212 pub fn match_(self) -> &'a mut crate::W<REG> {
213 self.variant(Pwmen3::Match)
214 }
215 #[doc = "Enable"]
216 #[inline(always)]
217 pub fn pwm(self) -> &'a mut crate::W<REG> {
218 self.variant(Pwmen3::Pwm)
219 }
220}
221impl R {
222 #[doc = "Bit 0 - PWM Mode Enable for Channel 0"]
223 #[inline(always)]
224 pub fn pwmen0(&self) -> Pwmen0R {
225 Pwmen0R::new((self.bits & 1) != 0)
226 }
227 #[doc = "Bit 1 - PWM Mode Enable for Channel 1"]
228 #[inline(always)]
229 pub fn pwmen1(&self) -> Pwmen1R {
230 Pwmen1R::new(((self.bits >> 1) & 1) != 0)
231 }
232 #[doc = "Bit 2 - PWM Mode Enable for Channel 2"]
233 #[inline(always)]
234 pub fn pwmen2(&self) -> Pwmen2R {
235 Pwmen2R::new(((self.bits >> 2) & 1) != 0)
236 }
237 #[doc = "Bit 3 - PWM Mode Enable for Channel 3"]
238 #[inline(always)]
239 pub fn pwmen3(&self) -> Pwmen3R {
240 Pwmen3R::new(((self.bits >> 3) & 1) != 0)
241 }
242}
243#[cfg(feature = "debug")]
244impl core::fmt::Debug for R {
245 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
246 f.debug_struct("PWMC")
247 .field("pwmen0", &self.pwmen0())
248 .field("pwmen1", &self.pwmen1())
249 .field("pwmen2", &self.pwmen2())
250 .field("pwmen3", &self.pwmen3())
251 .finish()
252 }
253}
254impl W {
255 #[doc = "Bit 0 - PWM Mode Enable for Channel 0"]
256 #[inline(always)]
257 pub fn pwmen0(&mut self) -> Pwmen0W<'_, PwmcSpec> {
258 Pwmen0W::new(self, 0)
259 }
260 #[doc = "Bit 1 - PWM Mode Enable for Channel 1"]
261 #[inline(always)]
262 pub fn pwmen1(&mut self) -> Pwmen1W<'_, PwmcSpec> {
263 Pwmen1W::new(self, 1)
264 }
265 #[doc = "Bit 2 - PWM Mode Enable for Channel 2"]
266 #[inline(always)]
267 pub fn pwmen2(&mut self) -> Pwmen2W<'_, PwmcSpec> {
268 Pwmen2W::new(self, 2)
269 }
270 #[doc = "Bit 3 - PWM Mode Enable for Channel 3"]
271 #[inline(always)]
272 pub fn pwmen3(&mut self) -> Pwmen3W<'_, PwmcSpec> {
273 Pwmen3W::new(self, 3)
274 }
275}
276#[doc = "PWM Control\n\nYou can [`read`](crate::Reg::read) this register and get [`pwmc::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pwmc::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
277pub struct PwmcSpec;
278impl crate::RegisterSpec for PwmcSpec {
279 type Ux = u32;
280}
281#[doc = "`read()` method returns [`pwmc::R`](R) reader structure"]
282impl crate::Readable for PwmcSpec {}
283#[doc = "`write(|w| ..)` method takes [`pwmc::W`](W) writer structure"]
284impl crate::Writable for PwmcSpec {
285 type Safety = crate::Unsafe;
286}
287#[doc = "`reset()` method sets PWMC to value 0"]
288impl crate::Resettable for PwmcSpec {}