efm32gg11b510_pac/emu/
dcdclpem01cfg.rs

1#[doc = "Register `DCDCLPEM01CFG` reader"]
2pub struct R(crate::R<DCDCLPEM01CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DCDCLPEM01CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DCDCLPEM01CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DCDCLPEM01CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DCDCLPEM01CFG` writer"]
17pub struct W(crate::W<DCDCLPEM01CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DCDCLPEM01CFG_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<DCDCLPEM01CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DCDCLPEM01CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "LP Mode Comparator Bias Selection for EM01\n\nValue on reset: 3"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum LPCMPBIASEM01_A {
41    #[doc = "0: Maximum load current less than 75uA."]
42    BIAS0 = 0,
43    #[doc = "1: Maximum load current less than 500uA."]
44    BIAS1 = 1,
45    #[doc = "2: Maximum load current less than 2.5mA."]
46    BIAS2 = 2,
47    #[doc = "3: Maximum load current less than 10mA."]
48    BIAS3 = 3,
49}
50impl From<LPCMPBIASEM01_A> for u8 {
51    #[inline(always)]
52    fn from(variant: LPCMPBIASEM01_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `LPCMPBIASEM01` reader - LP Mode Comparator Bias Selection for EM01"]
57pub type LPCMPBIASEM01_R = crate::FieldReader<u8, LPCMPBIASEM01_A>;
58impl LPCMPBIASEM01_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> LPCMPBIASEM01_A {
62        match self.bits {
63            0 => LPCMPBIASEM01_A::BIAS0,
64            1 => LPCMPBIASEM01_A::BIAS1,
65            2 => LPCMPBIASEM01_A::BIAS2,
66            3 => LPCMPBIASEM01_A::BIAS3,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `BIAS0`"]
71    #[inline(always)]
72    pub fn is_bias0(&self) -> bool {
73        *self == LPCMPBIASEM01_A::BIAS0
74    }
75    #[doc = "Checks if the value of the field is `BIAS1`"]
76    #[inline(always)]
77    pub fn is_bias1(&self) -> bool {
78        *self == LPCMPBIASEM01_A::BIAS1
79    }
80    #[doc = "Checks if the value of the field is `BIAS2`"]
81    #[inline(always)]
82    pub fn is_bias2(&self) -> bool {
83        *self == LPCMPBIASEM01_A::BIAS2
84    }
85    #[doc = "Checks if the value of the field is `BIAS3`"]
86    #[inline(always)]
87    pub fn is_bias3(&self) -> bool {
88        *self == LPCMPBIASEM01_A::BIAS3
89    }
90}
91#[doc = "Field `LPCMPBIASEM01` writer - LP Mode Comparator Bias Selection for EM01"]
92pub type LPCMPBIASEM01_W<'a> =
93    crate::FieldWriterSafe<'a, u32, DCDCLPEM01CFG_SPEC, u8, LPCMPBIASEM01_A, 2, 8>;
94impl<'a> LPCMPBIASEM01_W<'a> {
95    #[doc = "Maximum load current less than 75uA."]
96    #[inline(always)]
97    pub fn bias0(self) -> &'a mut W {
98        self.variant(LPCMPBIASEM01_A::BIAS0)
99    }
100    #[doc = "Maximum load current less than 500uA."]
101    #[inline(always)]
102    pub fn bias1(self) -> &'a mut W {
103        self.variant(LPCMPBIASEM01_A::BIAS1)
104    }
105    #[doc = "Maximum load current less than 2.5mA."]
106    #[inline(always)]
107    pub fn bias2(self) -> &'a mut W {
108        self.variant(LPCMPBIASEM01_A::BIAS2)
109    }
110    #[doc = "Maximum load current less than 10mA."]
111    #[inline(always)]
112    pub fn bias3(self) -> &'a mut W {
113        self.variant(LPCMPBIASEM01_A::BIAS3)
114    }
115}
116#[doc = "Field `LPCMPHYSSELEM01` reader - LP Mode Hysteresis Selection for EM01"]
117pub type LPCMPHYSSELEM01_R = crate::FieldReader<u8, u8>;
118#[doc = "Field `LPCMPHYSSELEM01` writer - LP Mode Hysteresis Selection for EM01"]
119pub type LPCMPHYSSELEM01_W<'a> = crate::FieldWriter<'a, u32, DCDCLPEM01CFG_SPEC, u8, u8, 4, 12>;
120impl R {
121    #[doc = "Bits 8:9 - LP Mode Comparator Bias Selection for EM01"]
122    #[inline(always)]
123    pub fn lpcmpbiasem01(&self) -> LPCMPBIASEM01_R {
124        LPCMPBIASEM01_R::new(((self.bits >> 8) & 3) as u8)
125    }
126    #[doc = "Bits 12:15 - LP Mode Hysteresis Selection for EM01"]
127    #[inline(always)]
128    pub fn lpcmphysselem01(&self) -> LPCMPHYSSELEM01_R {
129        LPCMPHYSSELEM01_R::new(((self.bits >> 12) & 0x0f) as u8)
130    }
131}
132impl W {
133    #[doc = "Bits 8:9 - LP Mode Comparator Bias Selection for EM01"]
134    #[inline(always)]
135    pub fn lpcmpbiasem01(&mut self) -> LPCMPBIASEM01_W {
136        LPCMPBIASEM01_W::new(self)
137    }
138    #[doc = "Bits 12:15 - LP Mode Hysteresis Selection for EM01"]
139    #[inline(always)]
140    pub fn lpcmphysselem01(&mut self) -> LPCMPHYSSELEM01_W {
141        LPCMPHYSSELEM01_W::new(self)
142    }
143    #[doc = "Writes raw bits to the register."]
144    #[inline(always)]
145    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
146        self.0.bits(bits);
147        self
148    }
149}
150#[doc = "Configuration Bits for Low Power Mode to Be Applied During EM01, This Field is Only Relevant If LP Mode is Used in EM01\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 [dcdclpem01cfg](index.html) module"]
151pub struct DCDCLPEM01CFG_SPEC;
152impl crate::RegisterSpec for DCDCLPEM01CFG_SPEC {
153    type Ux = u32;
154}
155#[doc = "`read()` method returns [dcdclpem01cfg::R](R) reader structure"]
156impl crate::Readable for DCDCLPEM01CFG_SPEC {
157    type Reader = R;
158}
159#[doc = "`write(|w| ..)` method takes [dcdclpem01cfg::W](W) writer structure"]
160impl crate::Writable for DCDCLPEM01CFG_SPEC {
161    type Writer = W;
162}
163#[doc = "`reset()` method sets DCDCLPEM01CFG to value 0x0300"]
164impl crate::Resettable for DCDCLPEM01CFG_SPEC {
165    #[inline(always)]
166    fn reset_value() -> Self::Ux {
167        0x0300
168    }
169}