efm32pg12_pac/vdac0/
opa1_out.rs1#[doc = "Reader of register OPA1_OUT"]
2pub type R = crate::R<u32, super::OPA1_OUT>;
3#[doc = "Writer for register OPA1_OUT"]
4pub type W = crate::W<u32, super::OPA1_OUT>;
5#[doc = "Register OPA1_OUT `reset()`'s with value 0x01"]
6impl crate::ResetValue for super::OPA1_OUT {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0x01
11 }
12}
13#[doc = "Reader of field `MAINOUTEN`"]
14pub type MAINOUTEN_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `MAINOUTEN`"]
16pub struct MAINOUTEN_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> MAINOUTEN_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `ALTOUTEN`"]
38pub type ALTOUTEN_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `ALTOUTEN`"]
40pub struct ALTOUTEN_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> ALTOUTEN_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "Reader of field `APORTOUTEN`"]
62pub type APORTOUTEN_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `APORTOUTEN`"]
64pub struct APORTOUTEN_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> APORTOUTEN_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
82 self.w
83 }
84}
85#[doc = "Reader of field `SHORT`"]
86pub type SHORT_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `SHORT`"]
88pub struct SHORT_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> SHORT_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
106 self.w
107 }
108}
109#[doc = "OPAx Output Enable Value\n\nValue on reset: 0"]
110#[derive(Clone, Copy, Debug, PartialEq)]
111#[repr(u8)]
112pub enum ALTOUTPADEN_A {
113 #[doc = "1: Alternate Output 0"]
114 OUT0 = 1,
115 #[doc = "2: Alternate Output 1"]
116 OUT1 = 2,
117 #[doc = "4: Alternate Output 2"]
118 OUT2 = 4,
119 #[doc = "8: Alternate Output 3"]
120 OUT3 = 8,
121 #[doc = "16: Alternate Output 4"]
122 OUT4 = 16,
123}
124impl From<ALTOUTPADEN_A> for u8 {
125 #[inline(always)]
126 fn from(variant: ALTOUTPADEN_A) -> Self {
127 variant as _
128 }
129}
130#[doc = "Reader of field `ALTOUTPADEN`"]
131pub type ALTOUTPADEN_R = crate::R<u8, ALTOUTPADEN_A>;
132impl ALTOUTPADEN_R {
133 #[doc = r"Get enumerated values variant"]
134 #[inline(always)]
135 pub fn variant(&self) -> crate::Variant<u8, ALTOUTPADEN_A> {
136 use crate::Variant::*;
137 match self.bits {
138 1 => Val(ALTOUTPADEN_A::OUT0),
139 2 => Val(ALTOUTPADEN_A::OUT1),
140 4 => Val(ALTOUTPADEN_A::OUT2),
141 8 => Val(ALTOUTPADEN_A::OUT3),
142 16 => Val(ALTOUTPADEN_A::OUT4),
143 i => Res(i),
144 }
145 }
146 #[doc = "Checks if the value of the field is `OUT0`"]
147 #[inline(always)]
148 pub fn is_out0(&self) -> bool {
149 *self == ALTOUTPADEN_A::OUT0
150 }
151 #[doc = "Checks if the value of the field is `OUT1`"]
152 #[inline(always)]
153 pub fn is_out1(&self) -> bool {
154 *self == ALTOUTPADEN_A::OUT1
155 }
156 #[doc = "Checks if the value of the field is `OUT2`"]
157 #[inline(always)]
158 pub fn is_out2(&self) -> bool {
159 *self == ALTOUTPADEN_A::OUT2
160 }
161 #[doc = "Checks if the value of the field is `OUT3`"]
162 #[inline(always)]
163 pub fn is_out3(&self) -> bool {
164 *self == ALTOUTPADEN_A::OUT3
165 }
166 #[doc = "Checks if the value of the field is `OUT4`"]
167 #[inline(always)]
168 pub fn is_out4(&self) -> bool {
169 *self == ALTOUTPADEN_A::OUT4
170 }
171}
172#[doc = "Write proxy for field `ALTOUTPADEN`"]
173pub struct ALTOUTPADEN_W<'a> {
174 w: &'a mut W,
175}
176impl<'a> ALTOUTPADEN_W<'a> {
177 #[doc = r"Writes `variant` to the field"]
178 #[inline(always)]
179 pub fn variant(self, variant: ALTOUTPADEN_A) -> &'a mut W {
180 unsafe { self.bits(variant.into()) }
181 }
182 #[doc = "Alternate Output 0"]
183 #[inline(always)]
184 pub fn out0(self) -> &'a mut W {
185 self.variant(ALTOUTPADEN_A::OUT0)
186 }
187 #[doc = "Alternate Output 1"]
188 #[inline(always)]
189 pub fn out1(self) -> &'a mut W {
190 self.variant(ALTOUTPADEN_A::OUT1)
191 }
192 #[doc = "Alternate Output 2"]
193 #[inline(always)]
194 pub fn out2(self) -> &'a mut W {
195 self.variant(ALTOUTPADEN_A::OUT2)
196 }
197 #[doc = "Alternate Output 3"]
198 #[inline(always)]
199 pub fn out3(self) -> &'a mut W {
200 self.variant(ALTOUTPADEN_A::OUT3)
201 }
202 #[doc = "Alternate Output 4"]
203 #[inline(always)]
204 pub fn out4(self) -> &'a mut W {
205 self.variant(ALTOUTPADEN_A::OUT4)
206 }
207 #[doc = r"Writes raw bits to the field"]
208 #[inline(always)]
209 pub unsafe fn bits(self, value: u8) -> &'a mut W {
210 self.w.bits = (self.w.bits & !(0x1f << 4)) | (((value as u32) & 0x1f) << 4);
211 self.w
212 }
213}
214#[doc = "Reader of field `APORTOUTSEL`"]
215pub type APORTOUTSEL_R = crate::R<u8, u8>;
216#[doc = "Write proxy for field `APORTOUTSEL`"]
217pub struct APORTOUTSEL_W<'a> {
218 w: &'a mut W,
219}
220impl<'a> APORTOUTSEL_W<'a> {
221 #[doc = r"Writes raw bits to the field"]
222 #[inline(always)]
223 pub unsafe fn bits(self, value: u8) -> &'a mut W {
224 self.w.bits = (self.w.bits & !(0xff << 16)) | (((value as u32) & 0xff) << 16);
225 self.w
226 }
227}
228impl R {
229 #[doc = "Bit 0 - OPAx Main Output Enable"]
230 #[inline(always)]
231 pub fn mainouten(&self) -> MAINOUTEN_R {
232 MAINOUTEN_R::new((self.bits & 0x01) != 0)
233 }
234 #[doc = "Bit 1 - OPAx Alternative Output Enable"]
235 #[inline(always)]
236 pub fn altouten(&self) -> ALTOUTEN_R {
237 ALTOUTEN_R::new(((self.bits >> 1) & 0x01) != 0)
238 }
239 #[doc = "Bit 2 - OPAx Aport Output Enable"]
240 #[inline(always)]
241 pub fn aportouten(&self) -> APORTOUTEN_R {
242 APORTOUTEN_R::new(((self.bits >> 2) & 0x01) != 0)
243 }
244 #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
245 #[inline(always)]
246 pub fn short(&self) -> SHORT_R {
247 SHORT_R::new(((self.bits >> 3) & 0x01) != 0)
248 }
249 #[doc = "Bits 4:8 - OPAx Output Enable Value"]
250 #[inline(always)]
251 pub fn altoutpaden(&self) -> ALTOUTPADEN_R {
252 ALTOUTPADEN_R::new(((self.bits >> 4) & 0x1f) as u8)
253 }
254 #[doc = "Bits 16:23 - OPAx APORT Output"]
255 #[inline(always)]
256 pub fn aportoutsel(&self) -> APORTOUTSEL_R {
257 APORTOUTSEL_R::new(((self.bits >> 16) & 0xff) as u8)
258 }
259}
260impl W {
261 #[doc = "Bit 0 - OPAx Main Output Enable"]
262 #[inline(always)]
263 pub fn mainouten(&mut self) -> MAINOUTEN_W {
264 MAINOUTEN_W { w: self }
265 }
266 #[doc = "Bit 1 - OPAx Alternative Output Enable"]
267 #[inline(always)]
268 pub fn altouten(&mut self) -> ALTOUTEN_W {
269 ALTOUTEN_W { w: self }
270 }
271 #[doc = "Bit 2 - OPAx Aport Output Enable"]
272 #[inline(always)]
273 pub fn aportouten(&mut self) -> APORTOUTEN_W {
274 APORTOUTEN_W { w: self }
275 }
276 #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
277 #[inline(always)]
278 pub fn short(&mut self) -> SHORT_W {
279 SHORT_W { w: self }
280 }
281 #[doc = "Bits 4:8 - OPAx Output Enable Value"]
282 #[inline(always)]
283 pub fn altoutpaden(&mut self) -> ALTOUTPADEN_W {
284 ALTOUTPADEN_W { w: self }
285 }
286 #[doc = "Bits 16:23 - OPAx APORT Output"]
287 #[inline(always)]
288 pub fn aportoutsel(&mut self) -> APORTOUTSEL_W {
289 APORTOUTSEL_W { w: self }
290 }
291}