atsam4sa16c_pac/pwm/
os.rs

1#[doc = "Register `OS` reader"]
2pub struct R(crate::R<OS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OS` writer"]
17pub struct W(crate::W<OS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OS_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<OS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OSH0` reader - Output Selection for PWMH output of the channel 0"]
38pub type OSH0_R = crate::BitReader<bool>;
39#[doc = "Field `OSH0` writer - Output Selection for PWMH output of the channel 0"]
40pub type OSH0_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
41#[doc = "Field `OSH1` reader - Output Selection for PWMH output of the channel 1"]
42pub type OSH1_R = crate::BitReader<bool>;
43#[doc = "Field `OSH1` writer - Output Selection for PWMH output of the channel 1"]
44pub type OSH1_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
45#[doc = "Field `OSH2` reader - Output Selection for PWMH output of the channel 2"]
46pub type OSH2_R = crate::BitReader<bool>;
47#[doc = "Field `OSH2` writer - Output Selection for PWMH output of the channel 2"]
48pub type OSH2_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
49#[doc = "Field `OSH3` reader - Output Selection for PWMH output of the channel 3"]
50pub type OSH3_R = crate::BitReader<bool>;
51#[doc = "Field `OSH3` writer - Output Selection for PWMH output of the channel 3"]
52pub type OSH3_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
53#[doc = "Field `OSL0` reader - Output Selection for PWML output of the channel 0"]
54pub type OSL0_R = crate::BitReader<bool>;
55#[doc = "Field `OSL0` writer - Output Selection for PWML output of the channel 0"]
56pub type OSL0_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
57#[doc = "Field `OSL1` reader - Output Selection for PWML output of the channel 1"]
58pub type OSL1_R = crate::BitReader<bool>;
59#[doc = "Field `OSL1` writer - Output Selection for PWML output of the channel 1"]
60pub type OSL1_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
61#[doc = "Field `OSL2` reader - Output Selection for PWML output of the channel 2"]
62pub type OSL2_R = crate::BitReader<bool>;
63#[doc = "Field `OSL2` writer - Output Selection for PWML output of the channel 2"]
64pub type OSL2_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
65#[doc = "Field `OSL3` reader - Output Selection for PWML output of the channel 3"]
66pub type OSL3_R = crate::BitReader<bool>;
67#[doc = "Field `OSL3` writer - Output Selection for PWML output of the channel 3"]
68pub type OSL3_W<'a, const O: u8> = crate::BitWriter<'a, u32, OS_SPEC, bool, O>;
69impl R {
70    #[doc = "Bit 0 - Output Selection for PWMH output of the channel 0"]
71    #[inline(always)]
72    pub fn osh0(&self) -> OSH0_R {
73        OSH0_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1 - Output Selection for PWMH output of the channel 1"]
76    #[inline(always)]
77    pub fn osh1(&self) -> OSH1_R {
78        OSH1_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bit 2 - Output Selection for PWMH output of the channel 2"]
81    #[inline(always)]
82    pub fn osh2(&self) -> OSH2_R {
83        OSH2_R::new(((self.bits >> 2) & 1) != 0)
84    }
85    #[doc = "Bit 3 - Output Selection for PWMH output of the channel 3"]
86    #[inline(always)]
87    pub fn osh3(&self) -> OSH3_R {
88        OSH3_R::new(((self.bits >> 3) & 1) != 0)
89    }
90    #[doc = "Bit 16 - Output Selection for PWML output of the channel 0"]
91    #[inline(always)]
92    pub fn osl0(&self) -> OSL0_R {
93        OSL0_R::new(((self.bits >> 16) & 1) != 0)
94    }
95    #[doc = "Bit 17 - Output Selection for PWML output of the channel 1"]
96    #[inline(always)]
97    pub fn osl1(&self) -> OSL1_R {
98        OSL1_R::new(((self.bits >> 17) & 1) != 0)
99    }
100    #[doc = "Bit 18 - Output Selection for PWML output of the channel 2"]
101    #[inline(always)]
102    pub fn osl2(&self) -> OSL2_R {
103        OSL2_R::new(((self.bits >> 18) & 1) != 0)
104    }
105    #[doc = "Bit 19 - Output Selection for PWML output of the channel 3"]
106    #[inline(always)]
107    pub fn osl3(&self) -> OSL3_R {
108        OSL3_R::new(((self.bits >> 19) & 1) != 0)
109    }
110}
111impl W {
112    #[doc = "Bit 0 - Output Selection for PWMH output of the channel 0"]
113    #[inline(always)]
114    #[must_use]
115    pub fn osh0(&mut self) -> OSH0_W<0> {
116        OSH0_W::new(self)
117    }
118    #[doc = "Bit 1 - Output Selection for PWMH output of the channel 1"]
119    #[inline(always)]
120    #[must_use]
121    pub fn osh1(&mut self) -> OSH1_W<1> {
122        OSH1_W::new(self)
123    }
124    #[doc = "Bit 2 - Output Selection for PWMH output of the channel 2"]
125    #[inline(always)]
126    #[must_use]
127    pub fn osh2(&mut self) -> OSH2_W<2> {
128        OSH2_W::new(self)
129    }
130    #[doc = "Bit 3 - Output Selection for PWMH output of the channel 3"]
131    #[inline(always)]
132    #[must_use]
133    pub fn osh3(&mut self) -> OSH3_W<3> {
134        OSH3_W::new(self)
135    }
136    #[doc = "Bit 16 - Output Selection for PWML output of the channel 0"]
137    #[inline(always)]
138    #[must_use]
139    pub fn osl0(&mut self) -> OSL0_W<16> {
140        OSL0_W::new(self)
141    }
142    #[doc = "Bit 17 - Output Selection for PWML output of the channel 1"]
143    #[inline(always)]
144    #[must_use]
145    pub fn osl1(&mut self) -> OSL1_W<17> {
146        OSL1_W::new(self)
147    }
148    #[doc = "Bit 18 - Output Selection for PWML output of the channel 2"]
149    #[inline(always)]
150    #[must_use]
151    pub fn osl2(&mut self) -> OSL2_W<18> {
152        OSL2_W::new(self)
153    }
154    #[doc = "Bit 19 - Output Selection for PWML output of the channel 3"]
155    #[inline(always)]
156    #[must_use]
157    pub fn osl3(&mut self) -> OSL3_W<19> {
158        OSL3_W::new(self)
159    }
160    #[doc = "Writes raw bits to the register."]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167#[doc = "PWM Output Selection 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 [os](index.html) module"]
168pub struct OS_SPEC;
169impl crate::RegisterSpec for OS_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [os::R](R) reader structure"]
173impl crate::Readable for OS_SPEC {
174    type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [os::W](W) writer structure"]
177impl crate::Writable for OS_SPEC {
178    type Writer = W;
179    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
180    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
181}
182#[doc = "`reset()` method sets OS to value 0"]
183impl crate::Resettable for OS_SPEC {
184    const RESET_VALUE: Self::Ux = 0;
185}