efm32gg12b_pac/efm32gg12b830/vdac0/
opa2_out.rs1#[doc = "Register `OPA2_OUT` reader"]
2pub struct R(crate::R<OPA2_OUT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<OPA2_OUT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<OPA2_OUT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<OPA2_OUT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `OPA2_OUT` writer"]
17pub struct W(crate::W<OPA2_OUT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<OPA2_OUT_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<OPA2_OUT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<OPA2_OUT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MAINOUTEN` reader - OPAx Main Output Enable"]
38pub type MAINOUTEN_R = crate::BitReader<bool>;
39#[doc = "Field `MAINOUTEN` writer - OPAx Main Output Enable"]
40pub type MAINOUTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_OUT_SPEC, bool, O>;
41#[doc = "Field `ALTOUTEN` reader - OPAx Alternative Output Enable"]
42pub type ALTOUTEN_R = crate::BitReader<bool>;
43#[doc = "Field `ALTOUTEN` writer - OPAx Alternative Output Enable"]
44pub type ALTOUTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_OUT_SPEC, bool, O>;
45#[doc = "Field `APORTOUTEN` reader - OPAx Aport Output Enable"]
46pub type APORTOUTEN_R = crate::BitReader<bool>;
47#[doc = "Field `APORTOUTEN` writer - OPAx Aport Output Enable"]
48pub type APORTOUTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_OUT_SPEC, bool, O>;
49#[doc = "Field `SHORT` reader - OPAx Main and Alternative Output Short"]
50pub type SHORT_R = crate::BitReader<bool>;
51#[doc = "Field `SHORT` writer - OPAx Main and Alternative Output Short"]
52pub type SHORT_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_OUT_SPEC, bool, O>;
53#[doc = "Field `ALTOUTPADEN` reader - OPAx Output Enable Value"]
54pub type ALTOUTPADEN_R = crate::FieldReader<u8, ALTOUTPADEN_A>;
55#[doc = "OPAx Output Enable Value\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum ALTOUTPADEN_A {
59 #[doc = "1: Alternate Output 0"]
60 OUT0 = 1,
61 #[doc = "2: Alternate Output 1"]
62 OUT1 = 2,
63 #[doc = "4: Alternate Output 2"]
64 OUT2 = 4,
65 #[doc = "8: Alternate Output 3"]
66 OUT3 = 8,
67 #[doc = "16: Alternate Output 4"]
68 OUT4 = 16,
69}
70impl From<ALTOUTPADEN_A> for u8 {
71 #[inline(always)]
72 fn from(variant: ALTOUTPADEN_A) -> Self {
73 variant as _
74 }
75}
76impl ALTOUTPADEN_R {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub fn variant(&self) -> Option<ALTOUTPADEN_A> {
80 match self.bits {
81 1 => Some(ALTOUTPADEN_A::OUT0),
82 2 => Some(ALTOUTPADEN_A::OUT1),
83 4 => Some(ALTOUTPADEN_A::OUT2),
84 8 => Some(ALTOUTPADEN_A::OUT3),
85 16 => Some(ALTOUTPADEN_A::OUT4),
86 _ => None,
87 }
88 }
89 #[doc = "Checks if the value of the field is `OUT0`"]
90 #[inline(always)]
91 pub fn is_out0(&self) -> bool {
92 *self == ALTOUTPADEN_A::OUT0
93 }
94 #[doc = "Checks if the value of the field is `OUT1`"]
95 #[inline(always)]
96 pub fn is_out1(&self) -> bool {
97 *self == ALTOUTPADEN_A::OUT1
98 }
99 #[doc = "Checks if the value of the field is `OUT2`"]
100 #[inline(always)]
101 pub fn is_out2(&self) -> bool {
102 *self == ALTOUTPADEN_A::OUT2
103 }
104 #[doc = "Checks if the value of the field is `OUT3`"]
105 #[inline(always)]
106 pub fn is_out3(&self) -> bool {
107 *self == ALTOUTPADEN_A::OUT3
108 }
109 #[doc = "Checks if the value of the field is `OUT4`"]
110 #[inline(always)]
111 pub fn is_out4(&self) -> bool {
112 *self == ALTOUTPADEN_A::OUT4
113 }
114}
115#[doc = "Field `ALTOUTPADEN` writer - OPAx Output Enable Value"]
116pub type ALTOUTPADEN_W<'a, const O: u8> =
117 crate::FieldWriter<'a, u32, OPA2_OUT_SPEC, u8, ALTOUTPADEN_A, 5, O>;
118impl<'a, const O: u8> ALTOUTPADEN_W<'a, O> {
119 #[doc = "Alternate Output 0"]
120 #[inline(always)]
121 pub fn out0(self) -> &'a mut W {
122 self.variant(ALTOUTPADEN_A::OUT0)
123 }
124 #[doc = "Alternate Output 1"]
125 #[inline(always)]
126 pub fn out1(self) -> &'a mut W {
127 self.variant(ALTOUTPADEN_A::OUT1)
128 }
129 #[doc = "Alternate Output 2"]
130 #[inline(always)]
131 pub fn out2(self) -> &'a mut W {
132 self.variant(ALTOUTPADEN_A::OUT2)
133 }
134 #[doc = "Alternate Output 3"]
135 #[inline(always)]
136 pub fn out3(self) -> &'a mut W {
137 self.variant(ALTOUTPADEN_A::OUT3)
138 }
139 #[doc = "Alternate Output 4"]
140 #[inline(always)]
141 pub fn out4(self) -> &'a mut W {
142 self.variant(ALTOUTPADEN_A::OUT4)
143 }
144}
145#[doc = "Field `APORTOUTSEL` reader - OPAx APORT Output"]
146pub type APORTOUTSEL_R = crate::FieldReader<u8, u8>;
147#[doc = "Field `APORTOUTSEL` writer - OPAx APORT Output"]
148pub type APORTOUTSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, OPA2_OUT_SPEC, u8, u8, 8, O>;
149impl R {
150 #[doc = "Bit 0 - OPAx Main Output Enable"]
151 #[inline(always)]
152 pub fn mainouten(&self) -> MAINOUTEN_R {
153 MAINOUTEN_R::new((self.bits & 1) != 0)
154 }
155 #[doc = "Bit 1 - OPAx Alternative Output Enable"]
156 #[inline(always)]
157 pub fn altouten(&self) -> ALTOUTEN_R {
158 ALTOUTEN_R::new(((self.bits >> 1) & 1) != 0)
159 }
160 #[doc = "Bit 2 - OPAx Aport Output Enable"]
161 #[inline(always)]
162 pub fn aportouten(&self) -> APORTOUTEN_R {
163 APORTOUTEN_R::new(((self.bits >> 2) & 1) != 0)
164 }
165 #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
166 #[inline(always)]
167 pub fn short(&self) -> SHORT_R {
168 SHORT_R::new(((self.bits >> 3) & 1) != 0)
169 }
170 #[doc = "Bits 4:8 - OPAx Output Enable Value"]
171 #[inline(always)]
172 pub fn altoutpaden(&self) -> ALTOUTPADEN_R {
173 ALTOUTPADEN_R::new(((self.bits >> 4) & 0x1f) as u8)
174 }
175 #[doc = "Bits 16:23 - OPAx APORT Output"]
176 #[inline(always)]
177 pub fn aportoutsel(&self) -> APORTOUTSEL_R {
178 APORTOUTSEL_R::new(((self.bits >> 16) & 0xff) as u8)
179 }
180}
181impl W {
182 #[doc = "Bit 0 - OPAx Main Output Enable"]
183 #[inline(always)]
184 #[must_use]
185 pub fn mainouten(&mut self) -> MAINOUTEN_W<0> {
186 MAINOUTEN_W::new(self)
187 }
188 #[doc = "Bit 1 - OPAx Alternative Output Enable"]
189 #[inline(always)]
190 #[must_use]
191 pub fn altouten(&mut self) -> ALTOUTEN_W<1> {
192 ALTOUTEN_W::new(self)
193 }
194 #[doc = "Bit 2 - OPAx Aport Output Enable"]
195 #[inline(always)]
196 #[must_use]
197 pub fn aportouten(&mut self) -> APORTOUTEN_W<2> {
198 APORTOUTEN_W::new(self)
199 }
200 #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
201 #[inline(always)]
202 #[must_use]
203 pub fn short(&mut self) -> SHORT_W<3> {
204 SHORT_W::new(self)
205 }
206 #[doc = "Bits 4:8 - OPAx Output Enable Value"]
207 #[inline(always)]
208 #[must_use]
209 pub fn altoutpaden(&mut self) -> ALTOUTPADEN_W<4> {
210 ALTOUTPADEN_W::new(self)
211 }
212 #[doc = "Bits 16:23 - OPAx APORT Output"]
213 #[inline(always)]
214 #[must_use]
215 pub fn aportoutsel(&mut self) -> APORTOUTSEL_W<16> {
216 APORTOUTSEL_W::new(self)
217 }
218 #[doc = "Writes raw bits to the register."]
219 #[inline(always)]
220 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
221 self.0.bits(bits);
222 self
223 }
224}
225#[doc = "Operational Amplifier Output Configuration 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 [opa2_out](index.html) module"]
226pub struct OPA2_OUT_SPEC;
227impl crate::RegisterSpec for OPA2_OUT_SPEC {
228 type Ux = u32;
229}
230#[doc = "`read()` method returns [opa2_out::R](R) reader structure"]
231impl crate::Readable for OPA2_OUT_SPEC {
232 type Reader = R;
233}
234#[doc = "`write(|w| ..)` method takes [opa2_out::W](W) writer structure"]
235impl crate::Writable for OPA2_OUT_SPEC {
236 type Writer = W;
237 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
238 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
239}
240#[doc = "`reset()` method sets OPA2_OUT to value 0x01"]
241impl crate::Resettable for OPA2_OUT_SPEC {
242 const RESET_VALUE: Self::Ux = 0x01;
243}