efm32lg230_pac/dac0/
opactrl.rs

1#[doc = "Register `OPACTRL` reader"]
2pub struct R(crate::R<OPACTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OPACTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OPACTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OPACTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OPACTRL` writer"]
17pub struct W(crate::W<OPACTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OPACTRL_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<OPACTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OPACTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `OPA0EN` reader - OPA0 Enable"]
38pub type OPA0EN_R = crate::BitReader<bool>;
39#[doc = "Field `OPA0EN` writer - OPA0 Enable"]
40pub type OPA0EN_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 0>;
41#[doc = "Field `OPA1EN` reader - OPA1 Enable"]
42pub type OPA1EN_R = crate::BitReader<bool>;
43#[doc = "Field `OPA1EN` writer - OPA1 Enable"]
44pub type OPA1EN_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 1>;
45#[doc = "Field `OPA2EN` reader - OPA2 Enable"]
46pub type OPA2EN_R = crate::BitReader<bool>;
47#[doc = "Field `OPA2EN` writer - OPA2 Enable"]
48pub type OPA2EN_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 2>;
49#[doc = "Field `OPA0HCMDIS` reader - High Common Mode Disable."]
50pub type OPA0HCMDIS_R = crate::BitReader<bool>;
51#[doc = "Field `OPA0HCMDIS` writer - High Common Mode Disable."]
52pub type OPA0HCMDIS_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 6>;
53#[doc = "Field `OPA1HCMDIS` reader - High Common Mode Disable."]
54pub type OPA1HCMDIS_R = crate::BitReader<bool>;
55#[doc = "Field `OPA1HCMDIS` writer - High Common Mode Disable."]
56pub type OPA1HCMDIS_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 7>;
57#[doc = "Field `OPA2HCMDIS` reader - High Common Mode Disable."]
58pub type OPA2HCMDIS_R = crate::BitReader<bool>;
59#[doc = "Field `OPA2HCMDIS` writer - High Common Mode Disable."]
60pub type OPA2HCMDIS_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 8>;
61#[doc = "Disables Low Pass Filter.\n\nValue on reset: 0"]
62#[derive(Clone, Copy, Debug, PartialEq)]
63#[repr(u8)]
64pub enum OPA0LPFDIS_A {
65    #[doc = "1: Disables the LPF between positive pad and positive input."]
66    PLPFDIS = 1,
67    #[doc = "2: Disables the LPF between negative pad and negative input."]
68    NLPFDIS = 2,
69}
70impl From<OPA0LPFDIS_A> for u8 {
71    #[inline(always)]
72    fn from(variant: OPA0LPFDIS_A) -> Self {
73        variant as _
74    }
75}
76#[doc = "Field `OPA0LPFDIS` reader - Disables Low Pass Filter."]
77pub type OPA0LPFDIS_R = crate::FieldReader<u8, OPA0LPFDIS_A>;
78impl OPA0LPFDIS_R {
79    #[doc = "Get enumerated values variant"]
80    #[inline(always)]
81    pub fn variant(&self) -> Option<OPA0LPFDIS_A> {
82        match self.bits {
83            1 => Some(OPA0LPFDIS_A::PLPFDIS),
84            2 => Some(OPA0LPFDIS_A::NLPFDIS),
85            _ => None,
86        }
87    }
88    #[doc = "Checks if the value of the field is `PLPFDIS`"]
89    #[inline(always)]
90    pub fn is_plpfdis(&self) -> bool {
91        *self == OPA0LPFDIS_A::PLPFDIS
92    }
93    #[doc = "Checks if the value of the field is `NLPFDIS`"]
94    #[inline(always)]
95    pub fn is_nlpfdis(&self) -> bool {
96        *self == OPA0LPFDIS_A::NLPFDIS
97    }
98}
99#[doc = "Field `OPA0LPFDIS` writer - Disables Low Pass Filter."]
100pub type OPA0LPFDIS_W<'a> = crate::FieldWriter<'a, u32, OPACTRL_SPEC, u8, OPA0LPFDIS_A, 2, 12>;
101impl<'a> OPA0LPFDIS_W<'a> {
102    #[doc = "Disables the LPF between positive pad and positive input."]
103    #[inline(always)]
104    pub fn plpfdis(self) -> &'a mut W {
105        self.variant(OPA0LPFDIS_A::PLPFDIS)
106    }
107    #[doc = "Disables the LPF between negative pad and negative input."]
108    #[inline(always)]
109    pub fn nlpfdis(self) -> &'a mut W {
110        self.variant(OPA0LPFDIS_A::NLPFDIS)
111    }
112}
113#[doc = "Disables Low Pass Filter.\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq)]
115#[repr(u8)]
116pub enum OPA1LPFDIS_A {
117    #[doc = "1: Disables the LPF between positive pad and positive input."]
118    PLPFDIS = 1,
119    #[doc = "2: Disables the LPF between negative pad and negative input."]
120    NLPFDIS = 2,
121}
122impl From<OPA1LPFDIS_A> for u8 {
123    #[inline(always)]
124    fn from(variant: OPA1LPFDIS_A) -> Self {
125        variant as _
126    }
127}
128#[doc = "Field `OPA1LPFDIS` reader - Disables Low Pass Filter."]
129pub type OPA1LPFDIS_R = crate::FieldReader<u8, OPA1LPFDIS_A>;
130impl OPA1LPFDIS_R {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub fn variant(&self) -> Option<OPA1LPFDIS_A> {
134        match self.bits {
135            1 => Some(OPA1LPFDIS_A::PLPFDIS),
136            2 => Some(OPA1LPFDIS_A::NLPFDIS),
137            _ => None,
138        }
139    }
140    #[doc = "Checks if the value of the field is `PLPFDIS`"]
141    #[inline(always)]
142    pub fn is_plpfdis(&self) -> bool {
143        *self == OPA1LPFDIS_A::PLPFDIS
144    }
145    #[doc = "Checks if the value of the field is `NLPFDIS`"]
146    #[inline(always)]
147    pub fn is_nlpfdis(&self) -> bool {
148        *self == OPA1LPFDIS_A::NLPFDIS
149    }
150}
151#[doc = "Field `OPA1LPFDIS` writer - Disables Low Pass Filter."]
152pub type OPA1LPFDIS_W<'a> = crate::FieldWriter<'a, u32, OPACTRL_SPEC, u8, OPA1LPFDIS_A, 2, 14>;
153impl<'a> OPA1LPFDIS_W<'a> {
154    #[doc = "Disables the LPF between positive pad and positive input."]
155    #[inline(always)]
156    pub fn plpfdis(self) -> &'a mut W {
157        self.variant(OPA1LPFDIS_A::PLPFDIS)
158    }
159    #[doc = "Disables the LPF between negative pad and negative input."]
160    #[inline(always)]
161    pub fn nlpfdis(self) -> &'a mut W {
162        self.variant(OPA1LPFDIS_A::NLPFDIS)
163    }
164}
165#[doc = "Disables Low Pass Filter.\n\nValue on reset: 0"]
166#[derive(Clone, Copy, Debug, PartialEq)]
167#[repr(u8)]
168pub enum OPA2LPFDIS_A {
169    #[doc = "1: Disables the LPF between positive pad and positive input."]
170    PLPFDIS = 1,
171    #[doc = "2: Disables the LPF between negative pad and negative input."]
172    NLPFDIS = 2,
173}
174impl From<OPA2LPFDIS_A> for u8 {
175    #[inline(always)]
176    fn from(variant: OPA2LPFDIS_A) -> Self {
177        variant as _
178    }
179}
180#[doc = "Field `OPA2LPFDIS` reader - Disables Low Pass Filter."]
181pub type OPA2LPFDIS_R = crate::FieldReader<u8, OPA2LPFDIS_A>;
182impl OPA2LPFDIS_R {
183    #[doc = "Get enumerated values variant"]
184    #[inline(always)]
185    pub fn variant(&self) -> Option<OPA2LPFDIS_A> {
186        match self.bits {
187            1 => Some(OPA2LPFDIS_A::PLPFDIS),
188            2 => Some(OPA2LPFDIS_A::NLPFDIS),
189            _ => None,
190        }
191    }
192    #[doc = "Checks if the value of the field is `PLPFDIS`"]
193    #[inline(always)]
194    pub fn is_plpfdis(&self) -> bool {
195        *self == OPA2LPFDIS_A::PLPFDIS
196    }
197    #[doc = "Checks if the value of the field is `NLPFDIS`"]
198    #[inline(always)]
199    pub fn is_nlpfdis(&self) -> bool {
200        *self == OPA2LPFDIS_A::NLPFDIS
201    }
202}
203#[doc = "Field `OPA2LPFDIS` writer - Disables Low Pass Filter."]
204pub type OPA2LPFDIS_W<'a> = crate::FieldWriter<'a, u32, OPACTRL_SPEC, u8, OPA2LPFDIS_A, 2, 16>;
205impl<'a> OPA2LPFDIS_W<'a> {
206    #[doc = "Disables the LPF between positive pad and positive input."]
207    #[inline(always)]
208    pub fn plpfdis(self) -> &'a mut W {
209        self.variant(OPA2LPFDIS_A::PLPFDIS)
210    }
211    #[doc = "Disables the LPF between negative pad and negative input."]
212    #[inline(always)]
213    pub fn nlpfdis(self) -> &'a mut W {
214        self.variant(OPA2LPFDIS_A::NLPFDIS)
215    }
216}
217#[doc = "Field `OPA0SHORT` reader - Short the non-inverting and inverting input."]
218pub type OPA0SHORT_R = crate::BitReader<bool>;
219#[doc = "Field `OPA0SHORT` writer - Short the non-inverting and inverting input."]
220pub type OPA0SHORT_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 22>;
221#[doc = "Field `OPA1SHORT` reader - Short the non-inverting and inverting input."]
222pub type OPA1SHORT_R = crate::BitReader<bool>;
223#[doc = "Field `OPA1SHORT` writer - Short the non-inverting and inverting input."]
224pub type OPA1SHORT_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 23>;
225#[doc = "Field `OPA2SHORT` reader - Short the non-inverting and inverting input."]
226pub type OPA2SHORT_R = crate::BitReader<bool>;
227#[doc = "Field `OPA2SHORT` writer - Short the non-inverting and inverting input."]
228pub type OPA2SHORT_W<'a> = crate::BitWriter<'a, u32, OPACTRL_SPEC, bool, 24>;
229impl R {
230    #[doc = "Bit 0 - OPA0 Enable"]
231    #[inline(always)]
232    pub fn opa0en(&self) -> OPA0EN_R {
233        OPA0EN_R::new((self.bits & 1) != 0)
234    }
235    #[doc = "Bit 1 - OPA1 Enable"]
236    #[inline(always)]
237    pub fn opa1en(&self) -> OPA1EN_R {
238        OPA1EN_R::new(((self.bits >> 1) & 1) != 0)
239    }
240    #[doc = "Bit 2 - OPA2 Enable"]
241    #[inline(always)]
242    pub fn opa2en(&self) -> OPA2EN_R {
243        OPA2EN_R::new(((self.bits >> 2) & 1) != 0)
244    }
245    #[doc = "Bit 6 - High Common Mode Disable."]
246    #[inline(always)]
247    pub fn opa0hcmdis(&self) -> OPA0HCMDIS_R {
248        OPA0HCMDIS_R::new(((self.bits >> 6) & 1) != 0)
249    }
250    #[doc = "Bit 7 - High Common Mode Disable."]
251    #[inline(always)]
252    pub fn opa1hcmdis(&self) -> OPA1HCMDIS_R {
253        OPA1HCMDIS_R::new(((self.bits >> 7) & 1) != 0)
254    }
255    #[doc = "Bit 8 - High Common Mode Disable."]
256    #[inline(always)]
257    pub fn opa2hcmdis(&self) -> OPA2HCMDIS_R {
258        OPA2HCMDIS_R::new(((self.bits >> 8) & 1) != 0)
259    }
260    #[doc = "Bits 12:13 - Disables Low Pass Filter."]
261    #[inline(always)]
262    pub fn opa0lpfdis(&self) -> OPA0LPFDIS_R {
263        OPA0LPFDIS_R::new(((self.bits >> 12) & 3) as u8)
264    }
265    #[doc = "Bits 14:15 - Disables Low Pass Filter."]
266    #[inline(always)]
267    pub fn opa1lpfdis(&self) -> OPA1LPFDIS_R {
268        OPA1LPFDIS_R::new(((self.bits >> 14) & 3) as u8)
269    }
270    #[doc = "Bits 16:17 - Disables Low Pass Filter."]
271    #[inline(always)]
272    pub fn opa2lpfdis(&self) -> OPA2LPFDIS_R {
273        OPA2LPFDIS_R::new(((self.bits >> 16) & 3) as u8)
274    }
275    #[doc = "Bit 22 - Short the non-inverting and inverting input."]
276    #[inline(always)]
277    pub fn opa0short(&self) -> OPA0SHORT_R {
278        OPA0SHORT_R::new(((self.bits >> 22) & 1) != 0)
279    }
280    #[doc = "Bit 23 - Short the non-inverting and inverting input."]
281    #[inline(always)]
282    pub fn opa1short(&self) -> OPA1SHORT_R {
283        OPA1SHORT_R::new(((self.bits >> 23) & 1) != 0)
284    }
285    #[doc = "Bit 24 - Short the non-inverting and inverting input."]
286    #[inline(always)]
287    pub fn opa2short(&self) -> OPA2SHORT_R {
288        OPA2SHORT_R::new(((self.bits >> 24) & 1) != 0)
289    }
290}
291impl W {
292    #[doc = "Bit 0 - OPA0 Enable"]
293    #[inline(always)]
294    pub fn opa0en(&mut self) -> OPA0EN_W {
295        OPA0EN_W::new(self)
296    }
297    #[doc = "Bit 1 - OPA1 Enable"]
298    #[inline(always)]
299    pub fn opa1en(&mut self) -> OPA1EN_W {
300        OPA1EN_W::new(self)
301    }
302    #[doc = "Bit 2 - OPA2 Enable"]
303    #[inline(always)]
304    pub fn opa2en(&mut self) -> OPA2EN_W {
305        OPA2EN_W::new(self)
306    }
307    #[doc = "Bit 6 - High Common Mode Disable."]
308    #[inline(always)]
309    pub fn opa0hcmdis(&mut self) -> OPA0HCMDIS_W {
310        OPA0HCMDIS_W::new(self)
311    }
312    #[doc = "Bit 7 - High Common Mode Disable."]
313    #[inline(always)]
314    pub fn opa1hcmdis(&mut self) -> OPA1HCMDIS_W {
315        OPA1HCMDIS_W::new(self)
316    }
317    #[doc = "Bit 8 - High Common Mode Disable."]
318    #[inline(always)]
319    pub fn opa2hcmdis(&mut self) -> OPA2HCMDIS_W {
320        OPA2HCMDIS_W::new(self)
321    }
322    #[doc = "Bits 12:13 - Disables Low Pass Filter."]
323    #[inline(always)]
324    pub fn opa0lpfdis(&mut self) -> OPA0LPFDIS_W {
325        OPA0LPFDIS_W::new(self)
326    }
327    #[doc = "Bits 14:15 - Disables Low Pass Filter."]
328    #[inline(always)]
329    pub fn opa1lpfdis(&mut self) -> OPA1LPFDIS_W {
330        OPA1LPFDIS_W::new(self)
331    }
332    #[doc = "Bits 16:17 - Disables Low Pass Filter."]
333    #[inline(always)]
334    pub fn opa2lpfdis(&mut self) -> OPA2LPFDIS_W {
335        OPA2LPFDIS_W::new(self)
336    }
337    #[doc = "Bit 22 - Short the non-inverting and inverting input."]
338    #[inline(always)]
339    pub fn opa0short(&mut self) -> OPA0SHORT_W {
340        OPA0SHORT_W::new(self)
341    }
342    #[doc = "Bit 23 - Short the non-inverting and inverting input."]
343    #[inline(always)]
344    pub fn opa1short(&mut self) -> OPA1SHORT_W {
345        OPA1SHORT_W::new(self)
346    }
347    #[doc = "Bit 24 - Short the non-inverting and inverting input."]
348    #[inline(always)]
349    pub fn opa2short(&mut self) -> OPA2SHORT_W {
350        OPA2SHORT_W::new(self)
351    }
352    #[doc = "Writes raw bits to the register."]
353    #[inline(always)]
354    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
355        self.0.bits(bits);
356        self
357    }
358}
359#[doc = "Operational Amplifier Control 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 [opactrl](index.html) module"]
360pub struct OPACTRL_SPEC;
361impl crate::RegisterSpec for OPACTRL_SPEC {
362    type Ux = u32;
363}
364#[doc = "`read()` method returns [opactrl::R](R) reader structure"]
365impl crate::Readable for OPACTRL_SPEC {
366    type Reader = R;
367}
368#[doc = "`write(|w| ..)` method takes [opactrl::W](W) writer structure"]
369impl crate::Writable for OPACTRL_SPEC {
370    type Writer = W;
371}
372#[doc = "`reset()` method sets OPACTRL to value 0"]
373impl crate::Resettable for OPACTRL_SPEC {
374    #[inline(always)]
375    fn reset_value() -> Self::Ux {
376        0
377    }
378}