nrf52810_pac/power/ram/
powerset.rs1#[doc = "Register `POWERSET` writer"]
2pub struct W(crate::W<POWERSET_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<POWERSET_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<POWERSET_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<POWERSET_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Keep RAM section S0 of RAMn on or off in System ON mode\n\nValue on reset: 1"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24pub enum S0POWER_AW {
25 #[doc = "1: On"]
26 ON = 1,
27}
28impl From<S0POWER_AW> for bool {
29 #[inline(always)]
30 fn from(variant: S0POWER_AW) -> Self {
31 variant as u8 != 0
32 }
33}
34#[doc = "Field `S0POWER` writer - Keep RAM section S0 of RAMn on or off in System ON mode"]
35pub type S0POWER_W<'a, const O: u8> = crate::BitWriter<'a, u32, POWERSET_SPEC, S0POWER_AW, O>;
36impl<'a, const O: u8> S0POWER_W<'a, O> {
37 #[doc = "On"]
38 #[inline(always)]
39 pub fn on(self) -> &'a mut W {
40 self.variant(S0POWER_AW::ON)
41 }
42}
43#[doc = "Keep RAM section S1 of RAMn on or off in System ON mode\n\nValue on reset: 1"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45pub enum S1POWER_AW {
46 #[doc = "1: On"]
47 ON = 1,
48}
49impl From<S1POWER_AW> for bool {
50 #[inline(always)]
51 fn from(variant: S1POWER_AW) -> Self {
52 variant as u8 != 0
53 }
54}
55#[doc = "Field `S1POWER` writer - Keep RAM section S1 of RAMn on or off in System ON mode"]
56pub type S1POWER_W<'a, const O: u8> = crate::BitWriter<'a, u32, POWERSET_SPEC, S1POWER_AW, O>;
57impl<'a, const O: u8> S1POWER_W<'a, O> {
58 #[doc = "On"]
59 #[inline(always)]
60 pub fn on(self) -> &'a mut W {
61 self.variant(S1POWER_AW::ON)
62 }
63}
64#[doc = "Keep retention on RAM section S0 when RAM section is switched off\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66pub enum S0RETENTION_AW {
67 #[doc = "1: On"]
68 ON = 1,
69}
70impl From<S0RETENTION_AW> for bool {
71 #[inline(always)]
72 fn from(variant: S0RETENTION_AW) -> Self {
73 variant as u8 != 0
74 }
75}
76#[doc = "Field `S0RETENTION` writer - Keep retention on RAM section S0 when RAM section is switched off"]
77pub type S0RETENTION_W<'a, const O: u8> =
78 crate::BitWriter<'a, u32, POWERSET_SPEC, S0RETENTION_AW, O>;
79impl<'a, const O: u8> S0RETENTION_W<'a, O> {
80 #[doc = "On"]
81 #[inline(always)]
82 pub fn on(self) -> &'a mut W {
83 self.variant(S0RETENTION_AW::ON)
84 }
85}
86#[doc = "Keep retention on RAM section S1 when RAM section is switched off\n\nValue on reset: 0"]
87#[derive(Clone, Copy, Debug, PartialEq)]
88pub enum S1RETENTION_AW {
89 #[doc = "1: On"]
90 ON = 1,
91}
92impl From<S1RETENTION_AW> for bool {
93 #[inline(always)]
94 fn from(variant: S1RETENTION_AW) -> Self {
95 variant as u8 != 0
96 }
97}
98#[doc = "Field `S1RETENTION` writer - Keep retention on RAM section S1 when RAM section is switched off"]
99pub type S1RETENTION_W<'a, const O: u8> =
100 crate::BitWriter<'a, u32, POWERSET_SPEC, S1RETENTION_AW, O>;
101impl<'a, const O: u8> S1RETENTION_W<'a, O> {
102 #[doc = "On"]
103 #[inline(always)]
104 pub fn on(self) -> &'a mut W {
105 self.variant(S1RETENTION_AW::ON)
106 }
107}
108impl W {
109 #[doc = "Bit 0 - Keep RAM section S0 of RAMn on or off in System ON mode"]
110 #[inline(always)]
111 pub fn s0power(&mut self) -> S0POWER_W<0> {
112 S0POWER_W::new(self)
113 }
114 #[doc = "Bit 1 - Keep RAM section S1 of RAMn on or off in System ON mode"]
115 #[inline(always)]
116 pub fn s1power(&mut self) -> S1POWER_W<1> {
117 S1POWER_W::new(self)
118 }
119 #[doc = "Bit 16 - Keep retention on RAM section S0 when RAM section is switched off"]
120 #[inline(always)]
121 pub fn s0retention(&mut self) -> S0RETENTION_W<16> {
122 S0RETENTION_W::new(self)
123 }
124 #[doc = "Bit 17 - Keep retention on RAM section S1 when RAM section is switched off"]
125 #[inline(always)]
126 pub fn s1retention(&mut self) -> S1RETENTION_W<17> {
127 S1RETENTION_W::new(self)
128 }
129 #[doc = "Writes raw bits to the register."]
130 #[inline(always)]
131 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
132 self.0.bits(bits);
133 self
134 }
135}
136#[doc = "Description cluster: RAMn power control set register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [powerset](index.html) module"]
137pub struct POWERSET_SPEC;
138impl crate::RegisterSpec for POWERSET_SPEC {
139 type Ux = u32;
140}
141#[doc = "`write(|w| ..)` method takes [powerset::W](W) writer structure"]
142impl crate::Writable for POWERSET_SPEC {
143 type Writer = W;
144}
145#[doc = "`reset()` method sets POWERSET to value 0xffff"]
146impl crate::Resettable for POWERSET_SPEC {
147 #[inline(always)]
148 fn reset_value() -> Self::Ux {
149 0xffff
150 }
151}