ra6t2/canfd_b/
cfdgsts.rs

1#[doc = "Register `CFDGSTS` reader"]
2pub struct R(crate::R<CFDGSTS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFDGSTS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFDGSTS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFDGSTS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `GRSTSTS` reader - Global Reset Status"]
17pub type GRSTSTS_R = crate::BitReader<GRSTSTS_A>;
18#[doc = "Global Reset Status\n\nValue on reset: 1"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum GRSTSTS_A {
21    #[doc = "0: Not in Reset mode"]
22    _0 = 0,
23    #[doc = "1: In Reset mode"]
24    _1 = 1,
25}
26impl From<GRSTSTS_A> for bool {
27    #[inline(always)]
28    fn from(variant: GRSTSTS_A) -> Self {
29        variant as u8 != 0
30    }
31}
32impl GRSTSTS_R {
33    #[doc = "Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> GRSTSTS_A {
36        match self.bits {
37            false => GRSTSTS_A::_0,
38            true => GRSTSTS_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == GRSTSTS_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == GRSTSTS_A::_1
50    }
51}
52#[doc = "Field `GHLTSTS` reader - Global Halt Status"]
53pub type GHLTSTS_R = crate::BitReader<GHLTSTS_A>;
54#[doc = "Global Halt Status\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum GHLTSTS_A {
57    #[doc = "0: Not in Halt mode"]
58    _0 = 0,
59    #[doc = "1: In Halt mode"]
60    _1 = 1,
61}
62impl From<GHLTSTS_A> for bool {
63    #[inline(always)]
64    fn from(variant: GHLTSTS_A) -> Self {
65        variant as u8 != 0
66    }
67}
68impl GHLTSTS_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub fn variant(&self) -> GHLTSTS_A {
72        match self.bits {
73            false => GHLTSTS_A::_0,
74            true => GHLTSTS_A::_1,
75        }
76    }
77    #[doc = "Checks if the value of the field is `_0`"]
78    #[inline(always)]
79    pub fn is_0(&self) -> bool {
80        *self == GHLTSTS_A::_0
81    }
82    #[doc = "Checks if the value of the field is `_1`"]
83    #[inline(always)]
84    pub fn is_1(&self) -> bool {
85        *self == GHLTSTS_A::_1
86    }
87}
88#[doc = "Field `GSLPSTS` reader - Global Sleep Status"]
89pub type GSLPSTS_R = crate::BitReader<GSLPSTS_A>;
90#[doc = "Global Sleep Status\n\nValue on reset: 1"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum GSLPSTS_A {
93    #[doc = "0: Not in Sleep mode"]
94    _0 = 0,
95    #[doc = "1: In Sleep mode"]
96    _1 = 1,
97}
98impl From<GSLPSTS_A> for bool {
99    #[inline(always)]
100    fn from(variant: GSLPSTS_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl GSLPSTS_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> GSLPSTS_A {
108        match self.bits {
109            false => GSLPSTS_A::_0,
110            true => GSLPSTS_A::_1,
111        }
112    }
113    #[doc = "Checks if the value of the field is `_0`"]
114    #[inline(always)]
115    pub fn is_0(&self) -> bool {
116        *self == GSLPSTS_A::_0
117    }
118    #[doc = "Checks if the value of the field is `_1`"]
119    #[inline(always)]
120    pub fn is_1(&self) -> bool {
121        *self == GSLPSTS_A::_1
122    }
123}
124#[doc = "Field `GRAMINIT` reader - Global RAM Initialization"]
125pub type GRAMINIT_R = crate::BitReader<GRAMINIT_A>;
126#[doc = "Global RAM Initialization\n\nValue on reset: 1"]
127#[derive(Clone, Copy, Debug, PartialEq, Eq)]
128pub enum GRAMINIT_A {
129    #[doc = "0: RAM initialization is complete"]
130    _0 = 0,
131    #[doc = "1: RAM initialization is ongoing"]
132    _1 = 1,
133}
134impl From<GRAMINIT_A> for bool {
135    #[inline(always)]
136    fn from(variant: GRAMINIT_A) -> Self {
137        variant as u8 != 0
138    }
139}
140impl GRAMINIT_R {
141    #[doc = "Get enumerated values variant"]
142    #[inline(always)]
143    pub fn variant(&self) -> GRAMINIT_A {
144        match self.bits {
145            false => GRAMINIT_A::_0,
146            true => GRAMINIT_A::_1,
147        }
148    }
149    #[doc = "Checks if the value of the field is `_0`"]
150    #[inline(always)]
151    pub fn is_0(&self) -> bool {
152        *self == GRAMINIT_A::_0
153    }
154    #[doc = "Checks if the value of the field is `_1`"]
155    #[inline(always)]
156    pub fn is_1(&self) -> bool {
157        *self == GRAMINIT_A::_1
158    }
159}
160impl R {
161    #[doc = "Bit 0 - Global Reset Status"]
162    #[inline(always)]
163    pub fn grststs(&self) -> GRSTSTS_R {
164        GRSTSTS_R::new((self.bits & 1) != 0)
165    }
166    #[doc = "Bit 1 - Global Halt Status"]
167    #[inline(always)]
168    pub fn ghltsts(&self) -> GHLTSTS_R {
169        GHLTSTS_R::new(((self.bits >> 1) & 1) != 0)
170    }
171    #[doc = "Bit 2 - Global Sleep Status"]
172    #[inline(always)]
173    pub fn gslpsts(&self) -> GSLPSTS_R {
174        GSLPSTS_R::new(((self.bits >> 2) & 1) != 0)
175    }
176    #[doc = "Bit 3 - Global RAM Initialization"]
177    #[inline(always)]
178    pub fn graminit(&self) -> GRAMINIT_R {
179        GRAMINIT_R::new(((self.bits >> 3) & 1) != 0)
180    }
181}
182#[doc = "Global Status Register\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 [cfdgsts](index.html) module"]
183pub struct CFDGSTS_SPEC;
184impl crate::RegisterSpec for CFDGSTS_SPEC {
185    type Ux = u32;
186}
187#[doc = "`read()` method returns [cfdgsts::R](R) reader structure"]
188impl crate::Readable for CFDGSTS_SPEC {
189    type Reader = R;
190}
191#[doc = "`reset()` method sets CFDGSTS to value 0x0d"]
192impl crate::Resettable for CFDGSTS_SPEC {
193    const RESET_VALUE: Self::Ux = 0x0d;
194}