atsam4sd32b_pac/pwm/
cmpm6.rs

1#[doc = "Register `CMPM6` reader"]
2pub struct R(crate::R<CMPM6_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CMPM6_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CMPM6_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CMPM6_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CMPM6` writer"]
17pub struct W(crate::W<CMPM6_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CMPM6_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<CMPM6_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CMPM6_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CEN` reader - Comparison x Enable"]
38pub type CEN_R = crate::BitReader<bool>;
39#[doc = "Field `CEN` writer - Comparison x Enable"]
40pub type CEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CMPM6_SPEC, bool, O>;
41#[doc = "Field `CTR` reader - Comparison x Trigger"]
42pub type CTR_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `CTR` writer - Comparison x Trigger"]
44pub type CTR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMPM6_SPEC, u8, u8, 4, O>;
45#[doc = "Field `CPR` reader - Comparison x Period"]
46pub type CPR_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `CPR` writer - Comparison x Period"]
48pub type CPR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMPM6_SPEC, u8, u8, 4, O>;
49#[doc = "Field `CPRCNT` reader - Comparison x Period Counter"]
50pub type CPRCNT_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `CPRCNT` writer - Comparison x Period Counter"]
52pub type CPRCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMPM6_SPEC, u8, u8, 4, O>;
53#[doc = "Field `CUPR` reader - Comparison x Update Period"]
54pub type CUPR_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `CUPR` writer - Comparison x Update Period"]
56pub type CUPR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMPM6_SPEC, u8, u8, 4, O>;
57#[doc = "Field `CUPRCNT` reader - Comparison x Update Period Counter"]
58pub type CUPRCNT_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `CUPRCNT` writer - Comparison x Update Period Counter"]
60pub type CUPRCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CMPM6_SPEC, u8, u8, 4, O>;
61impl R {
62    #[doc = "Bit 0 - Comparison x Enable"]
63    #[inline(always)]
64    pub fn cen(&self) -> CEN_R {
65        CEN_R::new((self.bits & 1) != 0)
66    }
67    #[doc = "Bits 4:7 - Comparison x Trigger"]
68    #[inline(always)]
69    pub fn ctr(&self) -> CTR_R {
70        CTR_R::new(((self.bits >> 4) & 0x0f) as u8)
71    }
72    #[doc = "Bits 8:11 - Comparison x Period"]
73    #[inline(always)]
74    pub fn cpr(&self) -> CPR_R {
75        CPR_R::new(((self.bits >> 8) & 0x0f) as u8)
76    }
77    #[doc = "Bits 12:15 - Comparison x Period Counter"]
78    #[inline(always)]
79    pub fn cprcnt(&self) -> CPRCNT_R {
80        CPRCNT_R::new(((self.bits >> 12) & 0x0f) as u8)
81    }
82    #[doc = "Bits 16:19 - Comparison x Update Period"]
83    #[inline(always)]
84    pub fn cupr(&self) -> CUPR_R {
85        CUPR_R::new(((self.bits >> 16) & 0x0f) as u8)
86    }
87    #[doc = "Bits 20:23 - Comparison x Update Period Counter"]
88    #[inline(always)]
89    pub fn cuprcnt(&self) -> CUPRCNT_R {
90        CUPRCNT_R::new(((self.bits >> 20) & 0x0f) as u8)
91    }
92}
93impl W {
94    #[doc = "Bit 0 - Comparison x Enable"]
95    #[inline(always)]
96    #[must_use]
97    pub fn cen(&mut self) -> CEN_W<0> {
98        CEN_W::new(self)
99    }
100    #[doc = "Bits 4:7 - Comparison x Trigger"]
101    #[inline(always)]
102    #[must_use]
103    pub fn ctr(&mut self) -> CTR_W<4> {
104        CTR_W::new(self)
105    }
106    #[doc = "Bits 8:11 - Comparison x Period"]
107    #[inline(always)]
108    #[must_use]
109    pub fn cpr(&mut self) -> CPR_W<8> {
110        CPR_W::new(self)
111    }
112    #[doc = "Bits 12:15 - Comparison x Period Counter"]
113    #[inline(always)]
114    #[must_use]
115    pub fn cprcnt(&mut self) -> CPRCNT_W<12> {
116        CPRCNT_W::new(self)
117    }
118    #[doc = "Bits 16:19 - Comparison x Update Period"]
119    #[inline(always)]
120    #[must_use]
121    pub fn cupr(&mut self) -> CUPR_W<16> {
122        CUPR_W::new(self)
123    }
124    #[doc = "Bits 20:23 - Comparison x Update Period Counter"]
125    #[inline(always)]
126    #[must_use]
127    pub fn cuprcnt(&mut self) -> CUPRCNT_W<20> {
128        CUPRCNT_W::new(self)
129    }
130    #[doc = "Writes raw bits to the register."]
131    #[inline(always)]
132    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
133        self.0.bits(bits);
134        self
135    }
136}
137#[doc = "PWM Comparison 6 Mode 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 [cmpm6](index.html) module"]
138pub struct CMPM6_SPEC;
139impl crate::RegisterSpec for CMPM6_SPEC {
140    type Ux = u32;
141}
142#[doc = "`read()` method returns [cmpm6::R](R) reader structure"]
143impl crate::Readable for CMPM6_SPEC {
144    type Reader = R;
145}
146#[doc = "`write(|w| ..)` method takes [cmpm6::W](W) writer structure"]
147impl crate::Writable for CMPM6_SPEC {
148    type Writer = W;
149    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
150    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
151}
152#[doc = "`reset()` method sets CMPM6 to value 0"]
153impl crate::Resettable for CMPM6_SPEC {
154    const RESET_VALUE: Self::Ux = 0;
155}