nrf91/vmc_ns/ram/
powerset.rs

1#[doc = r" Value to write to the register"]
2pub struct W {
3    bits: u32,
4}
5impl super::POWERSET {
6    #[doc = r" Writes to the register"]
7    #[inline]
8    pub fn write<F>(&self, f: F)
9    where
10        F: FnOnce(&mut W) -> &mut W,
11    {
12        let mut w = W::reset_value();
13        f(&mut w);
14        self.register.set(w.bits);
15    }
16}
17#[doc = "Values that can be written to the field `S0POWER`"]
18pub enum S0POWERW {
19    #[doc = "On"]
20    ON,
21}
22impl S0POWERW {
23    #[allow(missing_docs)]
24    #[doc(hidden)]
25    #[inline]
26    pub fn _bits(&self) -> bool {
27        match *self {
28            S0POWERW::ON => true,
29        }
30    }
31}
32#[doc = r" Proxy"]
33pub struct _S0POWERW<'a> {
34    w: &'a mut W,
35}
36impl<'a> _S0POWERW<'a> {
37    #[doc = r" Writes `variant` to the field"]
38    #[inline]
39    pub fn variant(self, variant: S0POWERW) -> &'a mut W {
40        {
41            self.bit(variant._bits())
42        }
43    }
44    #[doc = "On"]
45    #[inline]
46    pub fn on(self) -> &'a mut W {
47        self.variant(S0POWERW::ON)
48    }
49    #[doc = r" Sets the field bit"]
50    pub fn set_bit(self) -> &'a mut W {
51        self.bit(true)
52    }
53    #[doc = r" Clears the field bit"]
54    pub fn clear_bit(self) -> &'a mut W {
55        self.bit(false)
56    }
57    #[doc = r" Writes raw bits to the field"]
58    #[inline]
59    pub fn bit(self, value: bool) -> &'a mut W {
60        const MASK: bool = true;
61        const OFFSET: u8 = 0;
62        self.w.bits &= !((MASK as u32) << OFFSET);
63        self.w.bits |= ((value & MASK) as u32) << OFFSET;
64        self.w
65    }
66}
67#[doc = "Values that can be written to the field `S1POWER`"]
68pub enum S1POWERW {
69    #[doc = "On"]
70    ON,
71}
72impl S1POWERW {
73    #[allow(missing_docs)]
74    #[doc(hidden)]
75    #[inline]
76    pub fn _bits(&self) -> bool {
77        match *self {
78            S1POWERW::ON => true,
79        }
80    }
81}
82#[doc = r" Proxy"]
83pub struct _S1POWERW<'a> {
84    w: &'a mut W,
85}
86impl<'a> _S1POWERW<'a> {
87    #[doc = r" Writes `variant` to the field"]
88    #[inline]
89    pub fn variant(self, variant: S1POWERW) -> &'a mut W {
90        {
91            self.bit(variant._bits())
92        }
93    }
94    #[doc = "On"]
95    #[inline]
96    pub fn on(self) -> &'a mut W {
97        self.variant(S1POWERW::ON)
98    }
99    #[doc = r" Sets the field bit"]
100    pub fn set_bit(self) -> &'a mut W {
101        self.bit(true)
102    }
103    #[doc = r" Clears the field bit"]
104    pub fn clear_bit(self) -> &'a mut W {
105        self.bit(false)
106    }
107    #[doc = r" Writes raw bits to the field"]
108    #[inline]
109    pub fn bit(self, value: bool) -> &'a mut W {
110        const MASK: bool = true;
111        const OFFSET: u8 = 1;
112        self.w.bits &= !((MASK as u32) << OFFSET);
113        self.w.bits |= ((value & MASK) as u32) << OFFSET;
114        self.w
115    }
116}
117#[doc = "Values that can be written to the field `S2POWER`"]
118pub enum S2POWERW {
119    #[doc = "On"]
120    ON,
121}
122impl S2POWERW {
123    #[allow(missing_docs)]
124    #[doc(hidden)]
125    #[inline]
126    pub fn _bits(&self) -> bool {
127        match *self {
128            S2POWERW::ON => true,
129        }
130    }
131}
132#[doc = r" Proxy"]
133pub struct _S2POWERW<'a> {
134    w: &'a mut W,
135}
136impl<'a> _S2POWERW<'a> {
137    #[doc = r" Writes `variant` to the field"]
138    #[inline]
139    pub fn variant(self, variant: S2POWERW) -> &'a mut W {
140        {
141            self.bit(variant._bits())
142        }
143    }
144    #[doc = "On"]
145    #[inline]
146    pub fn on(self) -> &'a mut W {
147        self.variant(S2POWERW::ON)
148    }
149    #[doc = r" Sets the field bit"]
150    pub fn set_bit(self) -> &'a mut W {
151        self.bit(true)
152    }
153    #[doc = r" Clears the field bit"]
154    pub fn clear_bit(self) -> &'a mut W {
155        self.bit(false)
156    }
157    #[doc = r" Writes raw bits to the field"]
158    #[inline]
159    pub fn bit(self, value: bool) -> &'a mut W {
160        const MASK: bool = true;
161        const OFFSET: u8 = 2;
162        self.w.bits &= !((MASK as u32) << OFFSET);
163        self.w.bits |= ((value & MASK) as u32) << OFFSET;
164        self.w
165    }
166}
167#[doc = "Values that can be written to the field `S3POWER`"]
168pub enum S3POWERW {
169    #[doc = "On"]
170    ON,
171}
172impl S3POWERW {
173    #[allow(missing_docs)]
174    #[doc(hidden)]
175    #[inline]
176    pub fn _bits(&self) -> bool {
177        match *self {
178            S3POWERW::ON => true,
179        }
180    }
181}
182#[doc = r" Proxy"]
183pub struct _S3POWERW<'a> {
184    w: &'a mut W,
185}
186impl<'a> _S3POWERW<'a> {
187    #[doc = r" Writes `variant` to the field"]
188    #[inline]
189    pub fn variant(self, variant: S3POWERW) -> &'a mut W {
190        {
191            self.bit(variant._bits())
192        }
193    }
194    #[doc = "On"]
195    #[inline]
196    pub fn on(self) -> &'a mut W {
197        self.variant(S3POWERW::ON)
198    }
199    #[doc = r" Sets the field bit"]
200    pub fn set_bit(self) -> &'a mut W {
201        self.bit(true)
202    }
203    #[doc = r" Clears the field bit"]
204    pub fn clear_bit(self) -> &'a mut W {
205        self.bit(false)
206    }
207    #[doc = r" Writes raw bits to the field"]
208    #[inline]
209    pub fn bit(self, value: bool) -> &'a mut W {
210        const MASK: bool = true;
211        const OFFSET: u8 = 3;
212        self.w.bits &= !((MASK as u32) << OFFSET);
213        self.w.bits |= ((value & MASK) as u32) << OFFSET;
214        self.w
215    }
216}
217#[doc = "Values that can be written to the field `S0RETENTION`"]
218pub enum S0RETENTIONW {
219    #[doc = "On"]
220    ON,
221}
222impl S0RETENTIONW {
223    #[allow(missing_docs)]
224    #[doc(hidden)]
225    #[inline]
226    pub fn _bits(&self) -> bool {
227        match *self {
228            S0RETENTIONW::ON => true,
229        }
230    }
231}
232#[doc = r" Proxy"]
233pub struct _S0RETENTIONW<'a> {
234    w: &'a mut W,
235}
236impl<'a> _S0RETENTIONW<'a> {
237    #[doc = r" Writes `variant` to the field"]
238    #[inline]
239    pub fn variant(self, variant: S0RETENTIONW) -> &'a mut W {
240        {
241            self.bit(variant._bits())
242        }
243    }
244    #[doc = "On"]
245    #[inline]
246    pub fn on(self) -> &'a mut W {
247        self.variant(S0RETENTIONW::ON)
248    }
249    #[doc = r" Sets the field bit"]
250    pub fn set_bit(self) -> &'a mut W {
251        self.bit(true)
252    }
253    #[doc = r" Clears the field bit"]
254    pub fn clear_bit(self) -> &'a mut W {
255        self.bit(false)
256    }
257    #[doc = r" Writes raw bits to the field"]
258    #[inline]
259    pub fn bit(self, value: bool) -> &'a mut W {
260        const MASK: bool = true;
261        const OFFSET: u8 = 16;
262        self.w.bits &= !((MASK as u32) << OFFSET);
263        self.w.bits |= ((value & MASK) as u32) << OFFSET;
264        self.w
265    }
266}
267#[doc = "Values that can be written to the field `S1RETENTION`"]
268pub enum S1RETENTIONW {
269    #[doc = "On"]
270    ON,
271}
272impl S1RETENTIONW {
273    #[allow(missing_docs)]
274    #[doc(hidden)]
275    #[inline]
276    pub fn _bits(&self) -> bool {
277        match *self {
278            S1RETENTIONW::ON => true,
279        }
280    }
281}
282#[doc = r" Proxy"]
283pub struct _S1RETENTIONW<'a> {
284    w: &'a mut W,
285}
286impl<'a> _S1RETENTIONW<'a> {
287    #[doc = r" Writes `variant` to the field"]
288    #[inline]
289    pub fn variant(self, variant: S1RETENTIONW) -> &'a mut W {
290        {
291            self.bit(variant._bits())
292        }
293    }
294    #[doc = "On"]
295    #[inline]
296    pub fn on(self) -> &'a mut W {
297        self.variant(S1RETENTIONW::ON)
298    }
299    #[doc = r" Sets the field bit"]
300    pub fn set_bit(self) -> &'a mut W {
301        self.bit(true)
302    }
303    #[doc = r" Clears the field bit"]
304    pub fn clear_bit(self) -> &'a mut W {
305        self.bit(false)
306    }
307    #[doc = r" Writes raw bits to the field"]
308    #[inline]
309    pub fn bit(self, value: bool) -> &'a mut W {
310        const MASK: bool = true;
311        const OFFSET: u8 = 17;
312        self.w.bits &= !((MASK as u32) << OFFSET);
313        self.w.bits |= ((value & MASK) as u32) << OFFSET;
314        self.w
315    }
316}
317#[doc = "Values that can be written to the field `S2RETENTION`"]
318pub enum S2RETENTIONW {
319    #[doc = "On"]
320    ON,
321}
322impl S2RETENTIONW {
323    #[allow(missing_docs)]
324    #[doc(hidden)]
325    #[inline]
326    pub fn _bits(&self) -> bool {
327        match *self {
328            S2RETENTIONW::ON => true,
329        }
330    }
331}
332#[doc = r" Proxy"]
333pub struct _S2RETENTIONW<'a> {
334    w: &'a mut W,
335}
336impl<'a> _S2RETENTIONW<'a> {
337    #[doc = r" Writes `variant` to the field"]
338    #[inline]
339    pub fn variant(self, variant: S2RETENTIONW) -> &'a mut W {
340        {
341            self.bit(variant._bits())
342        }
343    }
344    #[doc = "On"]
345    #[inline]
346    pub fn on(self) -> &'a mut W {
347        self.variant(S2RETENTIONW::ON)
348    }
349    #[doc = r" Sets the field bit"]
350    pub fn set_bit(self) -> &'a mut W {
351        self.bit(true)
352    }
353    #[doc = r" Clears the field bit"]
354    pub fn clear_bit(self) -> &'a mut W {
355        self.bit(false)
356    }
357    #[doc = r" Writes raw bits to the field"]
358    #[inline]
359    pub fn bit(self, value: bool) -> &'a mut W {
360        const MASK: bool = true;
361        const OFFSET: u8 = 18;
362        self.w.bits &= !((MASK as u32) << OFFSET);
363        self.w.bits |= ((value & MASK) as u32) << OFFSET;
364        self.w
365    }
366}
367#[doc = "Values that can be written to the field `S3RETENTION`"]
368pub enum S3RETENTIONW {
369    #[doc = "On"]
370    ON,
371}
372impl S3RETENTIONW {
373    #[allow(missing_docs)]
374    #[doc(hidden)]
375    #[inline]
376    pub fn _bits(&self) -> bool {
377        match *self {
378            S3RETENTIONW::ON => true,
379        }
380    }
381}
382#[doc = r" Proxy"]
383pub struct _S3RETENTIONW<'a> {
384    w: &'a mut W,
385}
386impl<'a> _S3RETENTIONW<'a> {
387    #[doc = r" Writes `variant` to the field"]
388    #[inline]
389    pub fn variant(self, variant: S3RETENTIONW) -> &'a mut W {
390        {
391            self.bit(variant._bits())
392        }
393    }
394    #[doc = "On"]
395    #[inline]
396    pub fn on(self) -> &'a mut W {
397        self.variant(S3RETENTIONW::ON)
398    }
399    #[doc = r" Sets the field bit"]
400    pub fn set_bit(self) -> &'a mut W {
401        self.bit(true)
402    }
403    #[doc = r" Clears the field bit"]
404    pub fn clear_bit(self) -> &'a mut W {
405        self.bit(false)
406    }
407    #[doc = r" Writes raw bits to the field"]
408    #[inline]
409    pub fn bit(self, value: bool) -> &'a mut W {
410        const MASK: bool = true;
411        const OFFSET: u8 = 19;
412        self.w.bits &= !((MASK as u32) << OFFSET);
413        self.w.bits |= ((value & MASK) as u32) << OFFSET;
414        self.w
415    }
416}
417impl W {
418    #[doc = r" Reset value of the register"]
419    #[inline]
420    pub fn reset_value() -> W {
421        W { bits: 65535 }
422    }
423    #[doc = r" Writes raw bits to the register"]
424    #[inline]
425    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
426        self.bits = bits;
427        self
428    }
429    #[doc = "Bit 0 - Keep RAM section S0 of RAM n on or off in System ON mode"]
430    #[inline]
431    pub fn s0power(&mut self) -> _S0POWERW {
432        _S0POWERW { w: self }
433    }
434    #[doc = "Bit 1 - Keep RAM section S1 of RAM n on or off in System ON mode"]
435    #[inline]
436    pub fn s1power(&mut self) -> _S1POWERW {
437        _S1POWERW { w: self }
438    }
439    #[doc = "Bit 2 - Keep RAM section S2 of RAM n on or off in System ON mode"]
440    #[inline]
441    pub fn s2power(&mut self) -> _S2POWERW {
442        _S2POWERW { w: self }
443    }
444    #[doc = "Bit 3 - Keep RAM section S3 of RAM n on or off in System ON mode"]
445    #[inline]
446    pub fn s3power(&mut self) -> _S3POWERW {
447        _S3POWERW { w: self }
448    }
449    #[doc = "Bit 16 - Keep retention on RAM section S0 of RAM n when RAM section is switched off"]
450    #[inline]
451    pub fn s0retention(&mut self) -> _S0RETENTIONW {
452        _S0RETENTIONW { w: self }
453    }
454    #[doc = "Bit 17 - Keep retention on RAM section S1 of RAM n when RAM section is switched off"]
455    #[inline]
456    pub fn s1retention(&mut self) -> _S1RETENTIONW {
457        _S1RETENTIONW { w: self }
458    }
459    #[doc = "Bit 18 - Keep retention on RAM section S2 of RAM n when RAM section is switched off"]
460    #[inline]
461    pub fn s2retention(&mut self) -> _S2RETENTIONW {
462        _S2RETENTIONW { w: self }
463    }
464    #[doc = "Bit 19 - Keep retention on RAM section S3 of RAM n when RAM section is switched off"]
465    #[inline]
466    pub fn s3retention(&mut self) -> _S3RETENTIONW {
467        _S3RETENTIONW { w: self }
468    }
469}