efm32pg22_pac/efm32pg22c200/emu_s/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub struct R(crate::R<STATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<STATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<STATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<STATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `LOCK` reader - Lock status"]
17pub type LOCK_R = crate::BitReader<LOCK_A>;
18#[doc = "Lock status\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum LOCK_A {
21    #[doc = "0: All EMU lockable registers are unlocked."]
22    UNLOCKED = 0,
23    #[doc = "1: All EMU lockable registers are locked."]
24    LOCKED = 1,
25}
26impl From<LOCK_A> for bool {
27    #[inline(always)]
28    fn from(variant: LOCK_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl LOCK_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> LOCK_A {
36        match self.bits {
37            false => LOCK_A::UNLOCKED,
38            true => LOCK_A::LOCKED,
39        }
40    }
41    #[doc = "Checks if the value of the field is `UNLOCKED`"]
42    #[inline(always)]
43    pub fn is_unlocked(&self) -> bool {
44        *self == LOCK_A::UNLOCKED
45    }
46    #[doc = "Checks if the value of the field is `LOCKED`"]
47    #[inline(always)]
48    pub fn is_locked(&self) -> bool {
49        *self == LOCK_A::LOCKED
50    }
51}
52#[doc = "Field `FIRSTTEMPDONE` reader - First Temp done"]
53pub type FIRSTTEMPDONE_R = crate::BitReader<bool>;
54#[doc = "Field `TEMPACTIVE` reader - Temp active"]
55pub type TEMPACTIVE_R = crate::BitReader<bool>;
56#[doc = "Field `TEMPAVGACTIVE` reader - Temp Average active"]
57pub type TEMPAVGACTIVE_R = crate::BitReader<bool>;
58#[doc = "Field `VSCALEBUSY` reader - Vscale busy"]
59pub type VSCALEBUSY_R = crate::BitReader<bool>;
60#[doc = "Field `VSCALEFAILED` reader - Vscale failed"]
61pub type VSCALEFAILED_R = crate::BitReader<bool>;
62#[doc = "Field `VSCALE` reader - Vscale status"]
63pub type VSCALE_R = crate::FieldReader<u8, VSCALE_A>;
64#[doc = "Vscale status\n\nValue on reset: 2"]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66#[repr(u8)]
67pub enum VSCALE_A {
68    #[doc = "0: Voltage scaling set to 0.9v"]
69    VSCALE0 = 0,
70    #[doc = "1: Voltage scaling set to 1.0v"]
71    VSCALE1 = 1,
72    #[doc = "2: Voltage scaling set to 1.1v"]
73    VSCALE2 = 2,
74}
75impl From<VSCALE_A> for u8 {
76    #[inline(always)]
77    fn from(variant: VSCALE_A) -> Self {
78        variant as _
79    }
80}
81impl VSCALE_R {
82    #[doc = "Get enumerated values variant"]
83    #[inline(always)]
84    pub fn variant(&self) -> Option<VSCALE_A> {
85        match self.bits {
86            0 => Some(VSCALE_A::VSCALE0),
87            1 => Some(VSCALE_A::VSCALE1),
88            2 => Some(VSCALE_A::VSCALE2),
89            _ => None,
90        }
91    }
92    #[doc = "Checks if the value of the field is `VSCALE0`"]
93    #[inline(always)]
94    pub fn is_vscale0(&self) -> bool {
95        *self == VSCALE_A::VSCALE0
96    }
97    #[doc = "Checks if the value of the field is `VSCALE1`"]
98    #[inline(always)]
99    pub fn is_vscale1(&self) -> bool {
100        *self == VSCALE_A::VSCALE1
101    }
102    #[doc = "Checks if the value of the field is `VSCALE2`"]
103    #[inline(always)]
104    pub fn is_vscale2(&self) -> bool {
105        *self == VSCALE_A::VSCALE2
106    }
107}
108#[doc = "Field `EM4IORET` reader - EM4 IO retention status"]
109pub type EM4IORET_R = crate::BitReader<bool>;
110#[doc = "Field `EM2ENTERED` reader - EM2 entered"]
111pub type EM2ENTERED_R = crate::BitReader<bool>;
112impl R {
113    #[doc = "Bit 0 - Lock status"]
114    #[inline(always)]
115    pub fn lock(&self) -> LOCK_R {
116        LOCK_R::new((self.bits & 1) != 0)
117    }
118    #[doc = "Bit 1 - First Temp done"]
119    #[inline(always)]
120    pub fn firsttempdone(&self) -> FIRSTTEMPDONE_R {
121        FIRSTTEMPDONE_R::new(((self.bits >> 1) & 1) != 0)
122    }
123    #[doc = "Bit 2 - Temp active"]
124    #[inline(always)]
125    pub fn tempactive(&self) -> TEMPACTIVE_R {
126        TEMPACTIVE_R::new(((self.bits >> 2) & 1) != 0)
127    }
128    #[doc = "Bit 3 - Temp Average active"]
129    #[inline(always)]
130    pub fn tempavgactive(&self) -> TEMPAVGACTIVE_R {
131        TEMPAVGACTIVE_R::new(((self.bits >> 3) & 1) != 0)
132    }
133    #[doc = "Bit 4 - Vscale busy"]
134    #[inline(always)]
135    pub fn vscalebusy(&self) -> VSCALEBUSY_R {
136        VSCALEBUSY_R::new(((self.bits >> 4) & 1) != 0)
137    }
138    #[doc = "Bit 5 - Vscale failed"]
139    #[inline(always)]
140    pub fn vscalefailed(&self) -> VSCALEFAILED_R {
141        VSCALEFAILED_R::new(((self.bits >> 5) & 1) != 0)
142    }
143    #[doc = "Bits 6:7 - Vscale status"]
144    #[inline(always)]
145    pub fn vscale(&self) -> VSCALE_R {
146        VSCALE_R::new(((self.bits >> 6) & 3) as u8)
147    }
148    #[doc = "Bit 12 - EM4 IO retention status"]
149    #[inline(always)]
150    pub fn em4ioret(&self) -> EM4IORET_R {
151        EM4IORET_R::new(((self.bits >> 12) & 1) != 0)
152    }
153    #[doc = "Bit 14 - EM2 entered"]
154    #[inline(always)]
155    pub fn em2entered(&self) -> EM2ENTERED_R {
156        EM2ENTERED_R::new(((self.bits >> 14) & 1) != 0)
157    }
158}
159#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [status](index.html) module"]
160pub struct STATUS_SPEC;
161impl crate::RegisterSpec for STATUS_SPEC {
162    type Ux = u32;
163}
164#[doc = "`read()` method returns [status::R](R) reader structure"]
165impl crate::Readable for STATUS_SPEC {
166    type Reader = R;
167}
168#[doc = "`reset()` method sets STATUS to value 0x80"]
169impl crate::Resettable for STATUS_SPEC {
170    const RESET_VALUE: Self::Ux = 0x80;
171}