atsams70j19/pwm0/
pwm_fpv2.rs

1#[doc = "Register `PWM_FPV2` reader"]
2pub struct R(crate::R<PWM_FPV2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PWM_FPV2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PWM_FPV2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PWM_FPV2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PWM_FPV2` writer"]
17pub struct W(crate::W<PWM_FPV2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PWM_FPV2_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<PWM_FPV2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PWM_FPV2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `FPZH0` reader - Fault Protection to Hi-Z for PWMH output on channel 0"]
38pub struct FPZH0_R(crate::FieldReader<bool, bool>);
39impl FPZH0_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        FPZH0_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for FPZH0_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `FPZH0` writer - Fault Protection to Hi-Z for PWMH output on channel 0"]
53pub struct FPZH0_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> FPZH0_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `FPZH1` reader - Fault Protection to Hi-Z for PWMH output on channel 1"]
75pub struct FPZH1_R(crate::FieldReader<bool, bool>);
76impl FPZH1_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        FPZH1_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for FPZH1_R {
83    type Target = crate::FieldReader<bool, bool>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `FPZH1` writer - Fault Protection to Hi-Z for PWMH output on channel 1"]
90pub struct FPZH1_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> FPZH1_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108        self.w
109    }
110}
111#[doc = "Field `FPZH2` reader - Fault Protection to Hi-Z for PWMH output on channel 2"]
112pub struct FPZH2_R(crate::FieldReader<bool, bool>);
113impl FPZH2_R {
114    #[inline(always)]
115    pub(crate) fn new(bits: bool) -> Self {
116        FPZH2_R(crate::FieldReader::new(bits))
117    }
118}
119impl core::ops::Deref for FPZH2_R {
120    type Target = crate::FieldReader<bool, bool>;
121    #[inline(always)]
122    fn deref(&self) -> &Self::Target {
123        &self.0
124    }
125}
126#[doc = "Field `FPZH2` writer - Fault Protection to Hi-Z for PWMH output on channel 2"]
127pub struct FPZH2_W<'a> {
128    w: &'a mut W,
129}
130impl<'a> FPZH2_W<'a> {
131    #[doc = r"Sets the field bit"]
132    #[inline(always)]
133    pub fn set_bit(self) -> &'a mut W {
134        self.bit(true)
135    }
136    #[doc = r"Clears the field bit"]
137    #[inline(always)]
138    pub fn clear_bit(self) -> &'a mut W {
139        self.bit(false)
140    }
141    #[doc = r"Writes raw bits to the field"]
142    #[inline(always)]
143    pub fn bit(self, value: bool) -> &'a mut W {
144        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
145        self.w
146    }
147}
148#[doc = "Field `FPZH3` reader - Fault Protection to Hi-Z for PWMH output on channel 3"]
149pub struct FPZH3_R(crate::FieldReader<bool, bool>);
150impl FPZH3_R {
151    #[inline(always)]
152    pub(crate) fn new(bits: bool) -> Self {
153        FPZH3_R(crate::FieldReader::new(bits))
154    }
155}
156impl core::ops::Deref for FPZH3_R {
157    type Target = crate::FieldReader<bool, bool>;
158    #[inline(always)]
159    fn deref(&self) -> &Self::Target {
160        &self.0
161    }
162}
163#[doc = "Field `FPZH3` writer - Fault Protection to Hi-Z for PWMH output on channel 3"]
164pub struct FPZH3_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> FPZH3_W<'a> {
168    #[doc = r"Sets the field bit"]
169    #[inline(always)]
170    pub fn set_bit(self) -> &'a mut W {
171        self.bit(true)
172    }
173    #[doc = r"Clears the field bit"]
174    #[inline(always)]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
182        self.w
183    }
184}
185#[doc = "Field `FPZL0` reader - Fault Protection to Hi-Z for PWML output on channel 0"]
186pub struct FPZL0_R(crate::FieldReader<bool, bool>);
187impl FPZL0_R {
188    #[inline(always)]
189    pub(crate) fn new(bits: bool) -> Self {
190        FPZL0_R(crate::FieldReader::new(bits))
191    }
192}
193impl core::ops::Deref for FPZL0_R {
194    type Target = crate::FieldReader<bool, bool>;
195    #[inline(always)]
196    fn deref(&self) -> &Self::Target {
197        &self.0
198    }
199}
200#[doc = "Field `FPZL0` writer - Fault Protection to Hi-Z for PWML output on channel 0"]
201pub struct FPZL0_W<'a> {
202    w: &'a mut W,
203}
204impl<'a> FPZL0_W<'a> {
205    #[doc = r"Sets the field bit"]
206    #[inline(always)]
207    pub fn set_bit(self) -> &'a mut W {
208        self.bit(true)
209    }
210    #[doc = r"Clears the field bit"]
211    #[inline(always)]
212    pub fn clear_bit(self) -> &'a mut W {
213        self.bit(false)
214    }
215    #[doc = r"Writes raw bits to the field"]
216    #[inline(always)]
217    pub fn bit(self, value: bool) -> &'a mut W {
218        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
219        self.w
220    }
221}
222#[doc = "Field `FPZL1` reader - Fault Protection to Hi-Z for PWML output on channel 1"]
223pub struct FPZL1_R(crate::FieldReader<bool, bool>);
224impl FPZL1_R {
225    #[inline(always)]
226    pub(crate) fn new(bits: bool) -> Self {
227        FPZL1_R(crate::FieldReader::new(bits))
228    }
229}
230impl core::ops::Deref for FPZL1_R {
231    type Target = crate::FieldReader<bool, bool>;
232    #[inline(always)]
233    fn deref(&self) -> &Self::Target {
234        &self.0
235    }
236}
237#[doc = "Field `FPZL1` writer - Fault Protection to Hi-Z for PWML output on channel 1"]
238pub struct FPZL1_W<'a> {
239    w: &'a mut W,
240}
241impl<'a> FPZL1_W<'a> {
242    #[doc = r"Sets the field bit"]
243    #[inline(always)]
244    pub fn set_bit(self) -> &'a mut W {
245        self.bit(true)
246    }
247    #[doc = r"Clears the field bit"]
248    #[inline(always)]
249    pub fn clear_bit(self) -> &'a mut W {
250        self.bit(false)
251    }
252    #[doc = r"Writes raw bits to the field"]
253    #[inline(always)]
254    pub fn bit(self, value: bool) -> &'a mut W {
255        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
256        self.w
257    }
258}
259#[doc = "Field `FPZL2` reader - Fault Protection to Hi-Z for PWML output on channel 2"]
260pub struct FPZL2_R(crate::FieldReader<bool, bool>);
261impl FPZL2_R {
262    #[inline(always)]
263    pub(crate) fn new(bits: bool) -> Self {
264        FPZL2_R(crate::FieldReader::new(bits))
265    }
266}
267impl core::ops::Deref for FPZL2_R {
268    type Target = crate::FieldReader<bool, bool>;
269    #[inline(always)]
270    fn deref(&self) -> &Self::Target {
271        &self.0
272    }
273}
274#[doc = "Field `FPZL2` writer - Fault Protection to Hi-Z for PWML output on channel 2"]
275pub struct FPZL2_W<'a> {
276    w: &'a mut W,
277}
278impl<'a> FPZL2_W<'a> {
279    #[doc = r"Sets the field bit"]
280    #[inline(always)]
281    pub fn set_bit(self) -> &'a mut W {
282        self.bit(true)
283    }
284    #[doc = r"Clears the field bit"]
285    #[inline(always)]
286    pub fn clear_bit(self) -> &'a mut W {
287        self.bit(false)
288    }
289    #[doc = r"Writes raw bits to the field"]
290    #[inline(always)]
291    pub fn bit(self, value: bool) -> &'a mut W {
292        self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
293        self.w
294    }
295}
296#[doc = "Field `FPZL3` reader - Fault Protection to Hi-Z for PWML output on channel 3"]
297pub struct FPZL3_R(crate::FieldReader<bool, bool>);
298impl FPZL3_R {
299    #[inline(always)]
300    pub(crate) fn new(bits: bool) -> Self {
301        FPZL3_R(crate::FieldReader::new(bits))
302    }
303}
304impl core::ops::Deref for FPZL3_R {
305    type Target = crate::FieldReader<bool, bool>;
306    #[inline(always)]
307    fn deref(&self) -> &Self::Target {
308        &self.0
309    }
310}
311#[doc = "Field `FPZL3` writer - Fault Protection to Hi-Z for PWML output on channel 3"]
312pub struct FPZL3_W<'a> {
313    w: &'a mut W,
314}
315impl<'a> FPZL3_W<'a> {
316    #[doc = r"Sets the field bit"]
317    #[inline(always)]
318    pub fn set_bit(self) -> &'a mut W {
319        self.bit(true)
320    }
321    #[doc = r"Clears the field bit"]
322    #[inline(always)]
323    pub fn clear_bit(self) -> &'a mut W {
324        self.bit(false)
325    }
326    #[doc = r"Writes raw bits to the field"]
327    #[inline(always)]
328    pub fn bit(self, value: bool) -> &'a mut W {
329        self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
330        self.w
331    }
332}
333impl R {
334    #[doc = "Bit 0 - Fault Protection to Hi-Z for PWMH output on channel 0"]
335    #[inline(always)]
336    pub fn fpzh0(&self) -> FPZH0_R {
337        FPZH0_R::new((self.bits & 0x01) != 0)
338    }
339    #[doc = "Bit 1 - Fault Protection to Hi-Z for PWMH output on channel 1"]
340    #[inline(always)]
341    pub fn fpzh1(&self) -> FPZH1_R {
342        FPZH1_R::new(((self.bits >> 1) & 0x01) != 0)
343    }
344    #[doc = "Bit 2 - Fault Protection to Hi-Z for PWMH output on channel 2"]
345    #[inline(always)]
346    pub fn fpzh2(&self) -> FPZH2_R {
347        FPZH2_R::new(((self.bits >> 2) & 0x01) != 0)
348    }
349    #[doc = "Bit 3 - Fault Protection to Hi-Z for PWMH output on channel 3"]
350    #[inline(always)]
351    pub fn fpzh3(&self) -> FPZH3_R {
352        FPZH3_R::new(((self.bits >> 3) & 0x01) != 0)
353    }
354    #[doc = "Bit 16 - Fault Protection to Hi-Z for PWML output on channel 0"]
355    #[inline(always)]
356    pub fn fpzl0(&self) -> FPZL0_R {
357        FPZL0_R::new(((self.bits >> 16) & 0x01) != 0)
358    }
359    #[doc = "Bit 17 - Fault Protection to Hi-Z for PWML output on channel 1"]
360    #[inline(always)]
361    pub fn fpzl1(&self) -> FPZL1_R {
362        FPZL1_R::new(((self.bits >> 17) & 0x01) != 0)
363    }
364    #[doc = "Bit 18 - Fault Protection to Hi-Z for PWML output on channel 2"]
365    #[inline(always)]
366    pub fn fpzl2(&self) -> FPZL2_R {
367        FPZL2_R::new(((self.bits >> 18) & 0x01) != 0)
368    }
369    #[doc = "Bit 19 - Fault Protection to Hi-Z for PWML output on channel 3"]
370    #[inline(always)]
371    pub fn fpzl3(&self) -> FPZL3_R {
372        FPZL3_R::new(((self.bits >> 19) & 0x01) != 0)
373    }
374}
375impl W {
376    #[doc = "Bit 0 - Fault Protection to Hi-Z for PWMH output on channel 0"]
377    #[inline(always)]
378    pub fn fpzh0(&mut self) -> FPZH0_W {
379        FPZH0_W { w: self }
380    }
381    #[doc = "Bit 1 - Fault Protection to Hi-Z for PWMH output on channel 1"]
382    #[inline(always)]
383    pub fn fpzh1(&mut self) -> FPZH1_W {
384        FPZH1_W { w: self }
385    }
386    #[doc = "Bit 2 - Fault Protection to Hi-Z for PWMH output on channel 2"]
387    #[inline(always)]
388    pub fn fpzh2(&mut self) -> FPZH2_W {
389        FPZH2_W { w: self }
390    }
391    #[doc = "Bit 3 - Fault Protection to Hi-Z for PWMH output on channel 3"]
392    #[inline(always)]
393    pub fn fpzh3(&mut self) -> FPZH3_W {
394        FPZH3_W { w: self }
395    }
396    #[doc = "Bit 16 - Fault Protection to Hi-Z for PWML output on channel 0"]
397    #[inline(always)]
398    pub fn fpzl0(&mut self) -> FPZL0_W {
399        FPZL0_W { w: self }
400    }
401    #[doc = "Bit 17 - Fault Protection to Hi-Z for PWML output on channel 1"]
402    #[inline(always)]
403    pub fn fpzl1(&mut self) -> FPZL1_W {
404        FPZL1_W { w: self }
405    }
406    #[doc = "Bit 18 - Fault Protection to Hi-Z for PWML output on channel 2"]
407    #[inline(always)]
408    pub fn fpzl2(&mut self) -> FPZL2_W {
409        FPZL2_W { w: self }
410    }
411    #[doc = "Bit 19 - Fault Protection to Hi-Z for PWML output on channel 3"]
412    #[inline(always)]
413    pub fn fpzl3(&mut self) -> FPZL3_W {
414        FPZL3_W { w: self }
415    }
416    #[doc = "Writes raw bits to the register."]
417    #[inline(always)]
418    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
419        self.0.bits(bits);
420        self
421    }
422}
423#[doc = "PWM Fault Protection Value 2 Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pwm_fpv2](index.html) module"]
424pub struct PWM_FPV2_SPEC;
425impl crate::RegisterSpec for PWM_FPV2_SPEC {
426    type Ux = u32;
427}
428#[doc = "`read()` method returns [pwm_fpv2::R](R) reader structure"]
429impl crate::Readable for PWM_FPV2_SPEC {
430    type Reader = R;
431}
432#[doc = "`write(|w| ..)` method takes [pwm_fpv2::W](W) writer structure"]
433impl crate::Writable for PWM_FPV2_SPEC {
434    type Writer = W;
435}
436#[doc = "`reset()` method sets PWM_FPV2 to value 0"]
437impl crate::Resettable for PWM_FPV2_SPEC {
438    #[inline(always)]
439    fn reset_value() -> Self::Ux {
440        0
441    }
442}