efm32pg22_pac/efm32pg22c200/msc_ns/
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 `BUSY` reader - Erase/Write Busy"]
17pub type BUSY_R = crate::BitReader<bool>;
18#[doc = "Field `LOCKED` reader - Access Locked"]
19pub type LOCKED_R = crate::BitReader<bool>;
20#[doc = "Field `INVADDR` reader - Invalid Write Address or Erase Page"]
21pub type INVADDR_R = crate::BitReader<bool>;
22#[doc = "Field `WDATAREADY` reader - WDATA Write Ready"]
23pub type WDATAREADY_R = crate::BitReader<bool>;
24#[doc = "Field `ERASEABORTED` reader - Erase Operation Aborted"]
25pub type ERASEABORTED_R = crate::BitReader<bool>;
26#[doc = "Field `PENDING` reader - Write Command In Queue"]
27pub type PENDING_R = crate::BitReader<bool>;
28#[doc = "Field `TIMEOUT` reader - Write Command Timeout"]
29pub type TIMEOUT_R = crate::BitReader<bool>;
30#[doc = "Field `REGLOCK` reader - Register Lock Status"]
31pub type REGLOCK_R = crate::BitReader<REGLOCK_A>;
32#[doc = "Register Lock Status\n\nValue on reset: 0"]
33#[derive(Clone, Copy, Debug, PartialEq, Eq)]
34pub enum REGLOCK_A {
35    #[doc = "0: Register lock is unlocked"]
36    UNLOCKED = 0,
37    #[doc = "1: Register lock is locked."]
38    LOCKED = 1,
39}
40impl From<REGLOCK_A> for bool {
41    #[inline(always)]
42    fn from(variant: REGLOCK_A) -> Self {
43        variant as u8 != 0
44    }
45}
46impl REGLOCK_R {
47    #[doc = "Get enumerated values variant"]
48    #[inline(always)]
49    pub fn variant(&self) -> REGLOCK_A {
50        match self.bits {
51            false => REGLOCK_A::UNLOCKED,
52            true => REGLOCK_A::LOCKED,
53        }
54    }
55    #[doc = "Checks if the value of the field is `UNLOCKED`"]
56    #[inline(always)]
57    pub fn is_unlocked(&self) -> bool {
58        *self == REGLOCK_A::UNLOCKED
59    }
60    #[doc = "Checks if the value of the field is `LOCKED`"]
61    #[inline(always)]
62    pub fn is_locked(&self) -> bool {
63        *self == REGLOCK_A::LOCKED
64    }
65}
66#[doc = "Field `PWRON` reader - Flash Power On Status"]
67pub type PWRON_R = crate::BitReader<bool>;
68#[doc = "Field `WREADY` reader - Flash Write Ready"]
69pub type WREADY_R = crate::BitReader<bool>;
70#[doc = "Field `PWRUPCKBDFAILCOUNT` reader - Flash power up checkerboard pattern chec"]
71pub type PWRUPCKBDFAILCOUNT_R = crate::FieldReader<u8, u8>;
72impl R {
73    #[doc = "Bit 0 - Erase/Write Busy"]
74    #[inline(always)]
75    pub fn busy(&self) -> BUSY_R {
76        BUSY_R::new((self.bits & 1) != 0)
77    }
78    #[doc = "Bit 1 - Access Locked"]
79    #[inline(always)]
80    pub fn locked(&self) -> LOCKED_R {
81        LOCKED_R::new(((self.bits >> 1) & 1) != 0)
82    }
83    #[doc = "Bit 2 - Invalid Write Address or Erase Page"]
84    #[inline(always)]
85    pub fn invaddr(&self) -> INVADDR_R {
86        INVADDR_R::new(((self.bits >> 2) & 1) != 0)
87    }
88    #[doc = "Bit 3 - WDATA Write Ready"]
89    #[inline(always)]
90    pub fn wdataready(&self) -> WDATAREADY_R {
91        WDATAREADY_R::new(((self.bits >> 3) & 1) != 0)
92    }
93    #[doc = "Bit 4 - Erase Operation Aborted"]
94    #[inline(always)]
95    pub fn eraseaborted(&self) -> ERASEABORTED_R {
96        ERASEABORTED_R::new(((self.bits >> 4) & 1) != 0)
97    }
98    #[doc = "Bit 5 - Write Command In Queue"]
99    #[inline(always)]
100    pub fn pending(&self) -> PENDING_R {
101        PENDING_R::new(((self.bits >> 5) & 1) != 0)
102    }
103    #[doc = "Bit 6 - Write Command Timeout"]
104    #[inline(always)]
105    pub fn timeout(&self) -> TIMEOUT_R {
106        TIMEOUT_R::new(((self.bits >> 6) & 1) != 0)
107    }
108    #[doc = "Bit 16 - Register Lock Status"]
109    #[inline(always)]
110    pub fn reglock(&self) -> REGLOCK_R {
111        REGLOCK_R::new(((self.bits >> 16) & 1) != 0)
112    }
113    #[doc = "Bit 24 - Flash Power On Status"]
114    #[inline(always)]
115    pub fn pwron(&self) -> PWRON_R {
116        PWRON_R::new(((self.bits >> 24) & 1) != 0)
117    }
118    #[doc = "Bit 27 - Flash Write Ready"]
119    #[inline(always)]
120    pub fn wready(&self) -> WREADY_R {
121        WREADY_R::new(((self.bits >> 27) & 1) != 0)
122    }
123    #[doc = "Bits 28:31 - Flash power up checkerboard pattern chec"]
124    #[inline(always)]
125    pub fn pwrupckbdfailcount(&self) -> PWRUPCKBDFAILCOUNT_R {
126        PWRUPCKBDFAILCOUNT_R::new(((self.bits >> 28) & 0x0f) as u8)
127    }
128}
129#[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"]
130pub struct STATUS_SPEC;
131impl crate::RegisterSpec for STATUS_SPEC {
132    type Ux = u32;
133}
134#[doc = "`read()` method returns [status::R](R) reader structure"]
135impl crate::Readable for STATUS_SPEC {
136    type Reader = R;
137}
138#[doc = "`reset()` method sets STATUS to value 0x0800_0008"]
139impl crate::Resettable for STATUS_SPEC {
140    const RESET_VALUE: Self::Ux = 0x0800_0008;
141}