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