efm32tg11b540_pac/vdac0/
opa1_out.rs1#[doc = "Register `OPA1_OUT` reader"]
2pub struct R(crate::R<OPA1_OUT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OPA1_OUT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OPA1_OUT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OPA1_OUT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OPA1_OUT` writer"]
17pub struct W(crate::W<OPA1_OUT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OPA1_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<OPA1_OUT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OPA1_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> = crate::BitWriter<'a, u32, OPA1_OUT_SPEC, bool, 0>;
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> = crate::BitWriter<'a, u32, OPA1_OUT_SPEC, bool, 1>;
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> = crate::BitWriter<'a, u32, OPA1_OUT_SPEC, bool, 2>;
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> = crate::BitWriter<'a, u32, OPA1_OUT_SPEC, bool, 3>;
53#[doc = "OPAx Output Enable Value\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum ALTOUTPADEN_A {
57    #[doc = "1: Alternate Output 0"]
58    OUT0 = 1,
59    #[doc = "2: Alternate Output 1"]
60    OUT1 = 2,
61    #[doc = "4: Alternate Output 2"]
62    OUT2 = 4,
63    #[doc = "8: Alternate Output 3"]
64    OUT3 = 8,
65    #[doc = "16: Alternate Output 4"]
66    OUT4 = 16,
67}
68impl From<ALTOUTPADEN_A> for u8 {
69    #[inline(always)]
70    fn from(variant: ALTOUTPADEN_A) -> Self {
71        variant as _
72    }
73}
74#[doc = "Field `ALTOUTPADEN` reader - OPAx Output Enable Value"]
75pub type ALTOUTPADEN_R = crate::FieldReader<u8, ALTOUTPADEN_A>;
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> = crate::FieldWriter<'a, u32, OPA1_OUT_SPEC, u8, ALTOUTPADEN_A, 5, 4>;
117impl<'a> ALTOUTPADEN_W<'a> {
118    #[doc = "Alternate Output 0"]
119    #[inline(always)]
120    pub fn out0(self) -> &'a mut W {
121        self.variant(ALTOUTPADEN_A::OUT0)
122    }
123    #[doc = "Alternate Output 1"]
124    #[inline(always)]
125    pub fn out1(self) -> &'a mut W {
126        self.variant(ALTOUTPADEN_A::OUT1)
127    }
128    #[doc = "Alternate Output 2"]
129    #[inline(always)]
130    pub fn out2(self) -> &'a mut W {
131        self.variant(ALTOUTPADEN_A::OUT2)
132    }
133    #[doc = "Alternate Output 3"]
134    #[inline(always)]
135    pub fn out3(self) -> &'a mut W {
136        self.variant(ALTOUTPADEN_A::OUT3)
137    }
138    #[doc = "Alternate Output 4"]
139    #[inline(always)]
140    pub fn out4(self) -> &'a mut W {
141        self.variant(ALTOUTPADEN_A::OUT4)
142    }
143}
144#[doc = "Field `APORTOUTSEL` reader - OPAx APORT Output"]
145pub type APORTOUTSEL_R = crate::FieldReader<u8, u8>;
146#[doc = "Field `APORTOUTSEL` writer - OPAx APORT Output"]
147pub type APORTOUTSEL_W<'a> = crate::FieldWriter<'a, u32, OPA1_OUT_SPEC, u8, u8, 8, 16>;
148impl R {
149    #[doc = "Bit 0 - OPAx Main Output Enable"]
150    #[inline(always)]
151    pub fn mainouten(&self) -> MAINOUTEN_R {
152        MAINOUTEN_R::new((self.bits & 1) != 0)
153    }
154    #[doc = "Bit 1 - OPAx Alternative Output Enable"]
155    #[inline(always)]
156    pub fn altouten(&self) -> ALTOUTEN_R {
157        ALTOUTEN_R::new(((self.bits >> 1) & 1) != 0)
158    }
159    #[doc = "Bit 2 - OPAx Aport Output Enable"]
160    #[inline(always)]
161    pub fn aportouten(&self) -> APORTOUTEN_R {
162        APORTOUTEN_R::new(((self.bits >> 2) & 1) != 0)
163    }
164    #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
165    #[inline(always)]
166    pub fn short(&self) -> SHORT_R {
167        SHORT_R::new(((self.bits >> 3) & 1) != 0)
168    }
169    #[doc = "Bits 4:8 - OPAx Output Enable Value"]
170    #[inline(always)]
171    pub fn altoutpaden(&self) -> ALTOUTPADEN_R {
172        ALTOUTPADEN_R::new(((self.bits >> 4) & 0x1f) as u8)
173    }
174    #[doc = "Bits 16:23 - OPAx APORT Output"]
175    #[inline(always)]
176    pub fn aportoutsel(&self) -> APORTOUTSEL_R {
177        APORTOUTSEL_R::new(((self.bits >> 16) & 0xff) as u8)
178    }
179}
180impl W {
181    #[doc = "Bit 0 - OPAx Main Output Enable"]
182    #[inline(always)]
183    pub fn mainouten(&mut self) -> MAINOUTEN_W {
184        MAINOUTEN_W::new(self)
185    }
186    #[doc = "Bit 1 - OPAx Alternative Output Enable"]
187    #[inline(always)]
188    pub fn altouten(&mut self) -> ALTOUTEN_W {
189        ALTOUTEN_W::new(self)
190    }
191    #[doc = "Bit 2 - OPAx Aport Output Enable"]
192    #[inline(always)]
193    pub fn aportouten(&mut self) -> APORTOUTEN_W {
194        APORTOUTEN_W::new(self)
195    }
196    #[doc = "Bit 3 - OPAx Main and Alternative Output Short"]
197    #[inline(always)]
198    pub fn short(&mut self) -> SHORT_W {
199        SHORT_W::new(self)
200    }
201    #[doc = "Bits 4:8 - OPAx Output Enable Value"]
202    #[inline(always)]
203    pub fn altoutpaden(&mut self) -> ALTOUTPADEN_W {
204        ALTOUTPADEN_W::new(self)
205    }
206    #[doc = "Bits 16:23 - OPAx APORT Output"]
207    #[inline(always)]
208    pub fn aportoutsel(&mut self) -> APORTOUTSEL_W {
209        APORTOUTSEL_W::new(self)
210    }
211    #[doc = "Writes raw bits to the register."]
212    #[inline(always)]
213    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
214        self.0.bits(bits);
215        self
216    }
217}
218#[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 [opa1_out](index.html) module"]
219pub struct OPA1_OUT_SPEC;
220impl crate::RegisterSpec for OPA1_OUT_SPEC {
221    type Ux = u32;
222}
223#[doc = "`read()` method returns [opa1_out::R](R) reader structure"]
224impl crate::Readable for OPA1_OUT_SPEC {
225    type Reader = R;
226}
227#[doc = "`write(|w| ..)` method takes [opa1_out::W](W) writer structure"]
228impl crate::Writable for OPA1_OUT_SPEC {
229    type Writer = W;
230}
231#[doc = "`reset()` method sets OPA1_OUT to value 0x01"]
232impl crate::Resettable for OPA1_OUT_SPEC {
233    #[inline(always)]
234    fn reset_value() -> Self::Ux {
235        0x01
236    }
237}