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