efm32pg12_pac/emu/
dcdclpem01cfg.rs

1#[doc = "Reader of register DCDCLPEM01CFG"]
2pub type R = crate::R<u32, super::DCDCLPEM01CFG>;
3#[doc = "Writer for register DCDCLPEM01CFG"]
4pub type W = crate::W<u32, super::DCDCLPEM01CFG>;
5#[doc = "Register DCDCLPEM01CFG `reset()`'s with value 0x0300"]
6impl crate::ResetValue for super::DCDCLPEM01CFG {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0300
11    }
12}
13#[doc = "LP Mode Comparator Bias Selection for EM01\n\nValue on reset: 3"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum LPCMPBIASEM01_A {
17    #[doc = "0: Maximum load current less than 75uA."]
18    BIAS0 = 0,
19    #[doc = "1: Maximum load current less than 500uA."]
20    BIAS1 = 1,
21    #[doc = "2: Maximum load current less than 2.5mA."]
22    BIAS2 = 2,
23    #[doc = "3: Maximum load current less than 10mA."]
24    BIAS3 = 3,
25}
26impl From<LPCMPBIASEM01_A> for u8 {
27    #[inline(always)]
28    fn from(variant: LPCMPBIASEM01_A) -> Self {
29        variant as _
30    }
31}
32#[doc = "Reader of field `LPCMPBIASEM01`"]
33pub type LPCMPBIASEM01_R = crate::R<u8, LPCMPBIASEM01_A>;
34impl LPCMPBIASEM01_R {
35    #[doc = r"Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> LPCMPBIASEM01_A {
38        match self.bits {
39            0 => LPCMPBIASEM01_A::BIAS0,
40            1 => LPCMPBIASEM01_A::BIAS1,
41            2 => LPCMPBIASEM01_A::BIAS2,
42            3 => LPCMPBIASEM01_A::BIAS3,
43            _ => unreachable!(),
44        }
45    }
46    #[doc = "Checks if the value of the field is `BIAS0`"]
47    #[inline(always)]
48    pub fn is_bias0(&self) -> bool {
49        *self == LPCMPBIASEM01_A::BIAS0
50    }
51    #[doc = "Checks if the value of the field is `BIAS1`"]
52    #[inline(always)]
53    pub fn is_bias1(&self) -> bool {
54        *self == LPCMPBIASEM01_A::BIAS1
55    }
56    #[doc = "Checks if the value of the field is `BIAS2`"]
57    #[inline(always)]
58    pub fn is_bias2(&self) -> bool {
59        *self == LPCMPBIASEM01_A::BIAS2
60    }
61    #[doc = "Checks if the value of the field is `BIAS3`"]
62    #[inline(always)]
63    pub fn is_bias3(&self) -> bool {
64        *self == LPCMPBIASEM01_A::BIAS3
65    }
66}
67#[doc = "Write proxy for field `LPCMPBIASEM01`"]
68pub struct LPCMPBIASEM01_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> LPCMPBIASEM01_W<'a> {
72    #[doc = r"Writes `variant` to the field"]
73    #[inline(always)]
74    pub fn variant(self, variant: LPCMPBIASEM01_A) -> &'a mut W {
75        {
76            self.bits(variant.into())
77        }
78    }
79    #[doc = "Maximum load current less than 75uA."]
80    #[inline(always)]
81    pub fn bias0(self) -> &'a mut W {
82        self.variant(LPCMPBIASEM01_A::BIAS0)
83    }
84    #[doc = "Maximum load current less than 500uA."]
85    #[inline(always)]
86    pub fn bias1(self) -> &'a mut W {
87        self.variant(LPCMPBIASEM01_A::BIAS1)
88    }
89    #[doc = "Maximum load current less than 2.5mA."]
90    #[inline(always)]
91    pub fn bias2(self) -> &'a mut W {
92        self.variant(LPCMPBIASEM01_A::BIAS2)
93    }
94    #[doc = "Maximum load current less than 10mA."]
95    #[inline(always)]
96    pub fn bias3(self) -> &'a mut W {
97        self.variant(LPCMPBIASEM01_A::BIAS3)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
103        self.w
104    }
105}
106#[doc = "Reader of field `LPCMPHYSSELEM01`"]
107pub type LPCMPHYSSELEM01_R = crate::R<u8, u8>;
108#[doc = "Write proxy for field `LPCMPHYSSELEM01`"]
109pub struct LPCMPHYSSELEM01_W<'a> {
110    w: &'a mut W,
111}
112impl<'a> LPCMPHYSSELEM01_W<'a> {
113    #[doc = r"Writes raw bits to the field"]
114    #[inline(always)]
115    pub unsafe fn bits(self, value: u8) -> &'a mut W {
116        self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
117        self.w
118    }
119}
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) & 0x03) 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 { w: 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 { w: self }
142    }
143}