nrf52832_pac/power/
ramonb.rs1#[doc = "Register `RAMONB` reader"]
2pub struct R(crate::R<RAMONB_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RAMONB_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RAMONB_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RAMONB_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RAMONB` writer"]
17pub struct W(crate::W<RAMONB_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RAMONB_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<RAMONB_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RAMONB_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ONRAM2` reader - Keep RAM block 2 on or off in system ON Mode"]
38pub type ONRAM2_R = crate::BitReader<ONRAM2_A>;
39#[doc = "Keep RAM block 2 on or off in system ON Mode\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum ONRAM2_A {
42 #[doc = "0: Off"]
43 RAM2OFF = 0,
44 #[doc = "1: On"]
45 RAM2ON = 1,
46}
47impl From<ONRAM2_A> for bool {
48 #[inline(always)]
49 fn from(variant: ONRAM2_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl ONRAM2_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> ONRAM2_A {
57 match self.bits {
58 false => ONRAM2_A::RAM2OFF,
59 true => ONRAM2_A::RAM2ON,
60 }
61 }
62 #[doc = "Checks if the value of the field is `RAM2OFF`"]
63 #[inline(always)]
64 pub fn is_ram2off(&self) -> bool {
65 *self == ONRAM2_A::RAM2OFF
66 }
67 #[doc = "Checks if the value of the field is `RAM2ON`"]
68 #[inline(always)]
69 pub fn is_ram2on(&self) -> bool {
70 *self == ONRAM2_A::RAM2ON
71 }
72}
73#[doc = "Field `ONRAM2` writer - Keep RAM block 2 on or off in system ON Mode"]
74pub type ONRAM2_W<'a, const O: u8> = crate::BitWriter<'a, u32, RAMONB_SPEC, ONRAM2_A, O>;
75impl<'a, const O: u8> ONRAM2_W<'a, O> {
76 #[doc = "Off"]
77 #[inline(always)]
78 pub fn ram2off(self) -> &'a mut W {
79 self.variant(ONRAM2_A::RAM2OFF)
80 }
81 #[doc = "On"]
82 #[inline(always)]
83 pub fn ram2on(self) -> &'a mut W {
84 self.variant(ONRAM2_A::RAM2ON)
85 }
86}
87#[doc = "Field `ONRAM3` reader - Keep RAM block 3 on or off in system ON Mode"]
88pub type ONRAM3_R = crate::BitReader<ONRAM3_A>;
89#[doc = "Keep RAM block 3 on or off in system ON Mode\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum ONRAM3_A {
92 #[doc = "0: Off"]
93 RAM3OFF = 0,
94 #[doc = "1: On"]
95 RAM3ON = 1,
96}
97impl From<ONRAM3_A> for bool {
98 #[inline(always)]
99 fn from(variant: ONRAM3_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl ONRAM3_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> ONRAM3_A {
107 match self.bits {
108 false => ONRAM3_A::RAM3OFF,
109 true => ONRAM3_A::RAM3ON,
110 }
111 }
112 #[doc = "Checks if the value of the field is `RAM3OFF`"]
113 #[inline(always)]
114 pub fn is_ram3off(&self) -> bool {
115 *self == ONRAM3_A::RAM3OFF
116 }
117 #[doc = "Checks if the value of the field is `RAM3ON`"]
118 #[inline(always)]
119 pub fn is_ram3on(&self) -> bool {
120 *self == ONRAM3_A::RAM3ON
121 }
122}
123#[doc = "Field `ONRAM3` writer - Keep RAM block 3 on or off in system ON Mode"]
124pub type ONRAM3_W<'a, const O: u8> = crate::BitWriter<'a, u32, RAMONB_SPEC, ONRAM3_A, O>;
125impl<'a, const O: u8> ONRAM3_W<'a, O> {
126 #[doc = "Off"]
127 #[inline(always)]
128 pub fn ram3off(self) -> &'a mut W {
129 self.variant(ONRAM3_A::RAM3OFF)
130 }
131 #[doc = "On"]
132 #[inline(always)]
133 pub fn ram3on(self) -> &'a mut W {
134 self.variant(ONRAM3_A::RAM3ON)
135 }
136}
137#[doc = "Field `OFFRAM2` reader - Keep retention on RAM block 2 when RAM block is switched off"]
138pub type OFFRAM2_R = crate::BitReader<OFFRAM2_A>;
139#[doc = "Keep retention on RAM block 2 when RAM block is switched off\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum OFFRAM2_A {
142 #[doc = "0: Off"]
143 RAM2OFF = 0,
144 #[doc = "1: On"]
145 RAM2ON = 1,
146}
147impl From<OFFRAM2_A> for bool {
148 #[inline(always)]
149 fn from(variant: OFFRAM2_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl OFFRAM2_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> OFFRAM2_A {
157 match self.bits {
158 false => OFFRAM2_A::RAM2OFF,
159 true => OFFRAM2_A::RAM2ON,
160 }
161 }
162 #[doc = "Checks if the value of the field is `RAM2OFF`"]
163 #[inline(always)]
164 pub fn is_ram2off(&self) -> bool {
165 *self == OFFRAM2_A::RAM2OFF
166 }
167 #[doc = "Checks if the value of the field is `RAM2ON`"]
168 #[inline(always)]
169 pub fn is_ram2on(&self) -> bool {
170 *self == OFFRAM2_A::RAM2ON
171 }
172}
173#[doc = "Field `OFFRAM2` writer - Keep retention on RAM block 2 when RAM block is switched off"]
174pub type OFFRAM2_W<'a, const O: u8> = crate::BitWriter<'a, u32, RAMONB_SPEC, OFFRAM2_A, O>;
175impl<'a, const O: u8> OFFRAM2_W<'a, O> {
176 #[doc = "Off"]
177 #[inline(always)]
178 pub fn ram2off(self) -> &'a mut W {
179 self.variant(OFFRAM2_A::RAM2OFF)
180 }
181 #[doc = "On"]
182 #[inline(always)]
183 pub fn ram2on(self) -> &'a mut W {
184 self.variant(OFFRAM2_A::RAM2ON)
185 }
186}
187#[doc = "Field `OFFRAM3` reader - Keep retention on RAM block 3 when RAM block is switched off"]
188pub type OFFRAM3_R = crate::BitReader<OFFRAM3_A>;
189#[doc = "Keep retention on RAM block 3 when RAM block is switched off\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq)]
191pub enum OFFRAM3_A {
192 #[doc = "0: Off"]
193 RAM3OFF = 0,
194 #[doc = "1: On"]
195 RAM3ON = 1,
196}
197impl From<OFFRAM3_A> for bool {
198 #[inline(always)]
199 fn from(variant: OFFRAM3_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl OFFRAM3_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> OFFRAM3_A {
207 match self.bits {
208 false => OFFRAM3_A::RAM3OFF,
209 true => OFFRAM3_A::RAM3ON,
210 }
211 }
212 #[doc = "Checks if the value of the field is `RAM3OFF`"]
213 #[inline(always)]
214 pub fn is_ram3off(&self) -> bool {
215 *self == OFFRAM3_A::RAM3OFF
216 }
217 #[doc = "Checks if the value of the field is `RAM3ON`"]
218 #[inline(always)]
219 pub fn is_ram3on(&self) -> bool {
220 *self == OFFRAM3_A::RAM3ON
221 }
222}
223#[doc = "Field `OFFRAM3` writer - Keep retention on RAM block 3 when RAM block is switched off"]
224pub type OFFRAM3_W<'a, const O: u8> = crate::BitWriter<'a, u32, RAMONB_SPEC, OFFRAM3_A, O>;
225impl<'a, const O: u8> OFFRAM3_W<'a, O> {
226 #[doc = "Off"]
227 #[inline(always)]
228 pub fn ram3off(self) -> &'a mut W {
229 self.variant(OFFRAM3_A::RAM3OFF)
230 }
231 #[doc = "On"]
232 #[inline(always)]
233 pub fn ram3on(self) -> &'a mut W {
234 self.variant(OFFRAM3_A::RAM3ON)
235 }
236}
237impl R {
238 #[doc = "Bit 0 - Keep RAM block 2 on or off in system ON Mode"]
239 #[inline(always)]
240 pub fn onram2(&self) -> ONRAM2_R {
241 ONRAM2_R::new((self.bits & 1) != 0)
242 }
243 #[doc = "Bit 1 - Keep RAM block 3 on or off in system ON Mode"]
244 #[inline(always)]
245 pub fn onram3(&self) -> ONRAM3_R {
246 ONRAM3_R::new(((self.bits >> 1) & 1) != 0)
247 }
248 #[doc = "Bit 16 - Keep retention on RAM block 2 when RAM block is switched off"]
249 #[inline(always)]
250 pub fn offram2(&self) -> OFFRAM2_R {
251 OFFRAM2_R::new(((self.bits >> 16) & 1) != 0)
252 }
253 #[doc = "Bit 17 - Keep retention on RAM block 3 when RAM block is switched off"]
254 #[inline(always)]
255 pub fn offram3(&self) -> OFFRAM3_R {
256 OFFRAM3_R::new(((self.bits >> 17) & 1) != 0)
257 }
258}
259impl W {
260 #[doc = "Bit 0 - Keep RAM block 2 on or off in system ON Mode"]
261 #[inline(always)]
262 pub fn onram2(&mut self) -> ONRAM2_W<0> {
263 ONRAM2_W::new(self)
264 }
265 #[doc = "Bit 1 - Keep RAM block 3 on or off in system ON Mode"]
266 #[inline(always)]
267 pub fn onram3(&mut self) -> ONRAM3_W<1> {
268 ONRAM3_W::new(self)
269 }
270 #[doc = "Bit 16 - Keep retention on RAM block 2 when RAM block is switched off"]
271 #[inline(always)]
272 pub fn offram2(&mut self) -> OFFRAM2_W<16> {
273 OFFRAM2_W::new(self)
274 }
275 #[doc = "Bit 17 - Keep retention on RAM block 3 when RAM block is switched off"]
276 #[inline(always)]
277 pub fn offram3(&mut self) -> OFFRAM3_W<17> {
278 OFFRAM3_W::new(self)
279 }
280 #[doc = "Writes raw bits to the register."]
281 #[inline(always)]
282 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
283 self.0.bits(bits);
284 self
285 }
286}
287#[doc = "Deprecated register - RAM on/off register (this register is retained)\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 [ramonb](index.html) module"]
288pub struct RAMONB_SPEC;
289impl crate::RegisterSpec for RAMONB_SPEC {
290 type Ux = u32;
291}
292#[doc = "`read()` method returns [ramonb::R](R) reader structure"]
293impl crate::Readable for RAMONB_SPEC {
294 type Reader = R;
295}
296#[doc = "`write(|w| ..)` method takes [ramonb::W](W) writer structure"]
297impl crate::Writable for RAMONB_SPEC {
298 type Writer = W;
299}
300#[doc = "`reset()` method sets RAMONB to value 0x03"]
301impl crate::Resettable for RAMONB_SPEC {
302 #[inline(always)]
303 fn reset_value() -> Self::Ux {
304 0x03
305 }
306}