eos_s3/pmu/
gen_purpose_1.rs1#[doc = "Register `GEN_PURPOSE_1` reader"]
2pub struct R(crate::R<GEN_PURPOSE_1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<GEN_PURPOSE_1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<GEN_PURPOSE_1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<GEN_PURPOSE_1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `GEN_PURPOSE_1` writer"]
17pub struct W(crate::W<GEN_PURPOSE_1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<GEN_PURPOSE_1_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<GEN_PURPOSE_1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<GEN_PURPOSE_1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LOW_POWER_Mode` reader - Set to enable the low power mdoe"]
38pub struct LOW_POWER_MODE_R(crate::FieldReader<bool, bool>);
39impl LOW_POWER_MODE_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 LOW_POWER_MODE_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for LOW_POWER_MODE_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `LOW_POWER_Mode` writer - Set to enable the low power mdoe"]
53pub struct LOW_POWER_MODE_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> LOW_POWER_MODE_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71 self.w
72 }
73}
74#[doc = "Field `LOW_POWER_MODE_M4` reader - Set to use M4 Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1"]
75pub struct LOW_POWER_MODE_M4_R(crate::FieldReader<bool, bool>);
76impl LOW_POWER_MODE_M4_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 LOW_POWER_MODE_M4_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for LOW_POWER_MODE_M4_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `LOW_POWER_MODE_M4` writer - Set to use M4 Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1"]
90pub struct LOW_POWER_MODE_M4_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> LOW_POWER_MODE_M4_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits =
108 (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
109 self.w
110 }
111}
112#[doc = "Field `LOW_POWER_MODE_FFE` reader - Set to use FFE Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1."]
113pub struct LOW_POWER_MODE_FFE_R(crate::FieldReader<bool, bool>);
114impl LOW_POWER_MODE_FFE_R {
115 #[inline(always)]
116 pub(crate) fn new(bits: bool) -> Self {
117 LOW_POWER_MODE_FFE_R(crate::FieldReader::new(bits))
118 }
119}
120impl core::ops::Deref for LOW_POWER_MODE_FFE_R {
121 type Target = crate::FieldReader<bool, bool>;
122 #[inline(always)]
123 fn deref(&self) -> &Self::Target {
124 &self.0
125 }
126}
127#[doc = "Field `LOW_POWER_MODE_FFE` writer - Set to use FFE Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1."]
128pub struct LOW_POWER_MODE_FFE_W<'a> {
129 w: &'a mut W,
130}
131impl<'a> LOW_POWER_MODE_FFE_W<'a> {
132 #[doc = r"Sets the field bit"]
133 #[inline(always)]
134 pub fn set_bit(self) -> &'a mut W {
135 self.bit(true)
136 }
137 #[doc = r"Clears the field bit"]
138 #[inline(always)]
139 pub fn clear_bit(self) -> &'a mut W {
140 self.bit(false)
141 }
142 #[doc = r"Writes raw bits to the field"]
143 #[inline(always)]
144 pub fn bit(self, value: bool) -> &'a mut W {
145 self.w.bits =
146 (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
147 self.w
148 }
149}
150#[doc = "Field `Kickoff_FFE_use_INT` reader - Set to use external INT to wake up FFE."]
151pub struct KICKOFF_FFE_USE_INT_R(crate::FieldReader<bool, bool>);
152impl KICKOFF_FFE_USE_INT_R {
153 #[inline(always)]
154 pub(crate) fn new(bits: bool) -> Self {
155 KICKOFF_FFE_USE_INT_R(crate::FieldReader::new(bits))
156 }
157}
158impl core::ops::Deref for KICKOFF_FFE_USE_INT_R {
159 type Target = crate::FieldReader<bool, bool>;
160 #[inline(always)]
161 fn deref(&self) -> &Self::Target {
162 &self.0
163 }
164}
165#[doc = "Field `Kickoff_FFE_use_INT` writer - Set to use external INT to wake up FFE."]
166pub struct KICKOFF_FFE_USE_INT_W<'a> {
167 w: &'a mut W,
168}
169impl<'a> KICKOFF_FFE_USE_INT_W<'a> {
170 #[doc = r"Sets the field bit"]
171 #[inline(always)]
172 pub fn set_bit(self) -> &'a mut W {
173 self.bit(true)
174 }
175 #[doc = r"Clears the field bit"]
176 #[inline(always)]
177 pub fn clear_bit(self) -> &'a mut W {
178 self.bit(false)
179 }
180 #[doc = r"Writes raw bits to the field"]
181 #[inline(always)]
182 pub fn bit(self, value: bool) -> &'a mut W {
183 self.w.bits =
184 (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
185 self.w
186 }
187}
188#[doc = "Field `General_Purpose` reader - General purpose SFR"]
189pub struct GENERAL_PURPOSE_R(crate::FieldReader<u8, u8>);
190impl GENERAL_PURPOSE_R {
191 #[inline(always)]
192 pub(crate) fn new(bits: u8) -> Self {
193 GENERAL_PURPOSE_R(crate::FieldReader::new(bits))
194 }
195}
196impl core::ops::Deref for GENERAL_PURPOSE_R {
197 type Target = crate::FieldReader<u8, u8>;
198 #[inline(always)]
199 fn deref(&self) -> &Self::Target {
200 &self.0
201 }
202}
203#[doc = "Field `General_Purpose` writer - General purpose SFR"]
204pub struct GENERAL_PURPOSE_W<'a> {
205 w: &'a mut W,
206}
207impl<'a> GENERAL_PURPOSE_W<'a> {
208 #[doc = r"Writes raw bits to the field"]
209 #[inline(always)]
210 pub unsafe fn bits(self, value: u8) -> &'a mut W {
211 self.w.bits =
212 (self.w.bits & !(0x0f << 4)) | ((value as u32 & 0x0f) << 4);
213 self.w
214 }
215}
216impl R {
217 #[doc = "Bit 0 - Set to enable the low power mdoe"]
218 #[inline(always)]
219 pub fn low_power_mode(&self) -> LOW_POWER_MODE_R {
220 LOW_POWER_MODE_R::new((self.bits & 0x01) != 0)
221 }
222 #[doc = "Bit 1 - Set to use M4 Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1"]
223 #[inline(always)]
224 pub fn low_power_mode_m4(&self) -> LOW_POWER_MODE_M4_R {
225 LOW_POWER_MODE_M4_R::new(((self.bits >> 1) & 0x01) != 0)
226 }
227 #[doc = "Bit 2 - Set to use FFE Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1."]
228 #[inline(always)]
229 pub fn low_power_mode_ffe(&self) -> LOW_POWER_MODE_FFE_R {
230 LOW_POWER_MODE_FFE_R::new(((self.bits >> 2) & 0x01) != 0)
231 }
232 #[doc = "Bit 3 - Set to use external INT to wake up FFE."]
233 #[inline(always)]
234 pub fn kickoff_ffe_use_int(&self) -> KICKOFF_FFE_USE_INT_R {
235 KICKOFF_FFE_USE_INT_R::new(((self.bits >> 3) & 0x01) != 0)
236 }
237 #[doc = "Bits 4:7 - General purpose SFR"]
238 #[inline(always)]
239 pub fn general_purpose(&self) -> GENERAL_PURPOSE_R {
240 GENERAL_PURPOSE_R::new(((self.bits >> 4) & 0x0f) as u8)
241 }
242}
243impl W {
244 #[doc = "Bit 0 - Set to enable the low power mdoe"]
245 #[inline(always)]
246 pub fn low_power_mode(&mut self) -> LOW_POWER_MODE_W {
247 LOW_POWER_MODE_W { w: self }
248 }
249 #[doc = "Bit 1 - Set to use M4 Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1"]
250 #[inline(always)]
251 pub fn low_power_mode_m4(&mut self) -> LOW_POWER_MODE_M4_W {
252 LOW_POWER_MODE_M4_W { w: self }
253 }
254 #[doc = "Bit 2 - Set to use FFE Power State to Turn on/off OSC and switching the Clock between OSC and RTC if Bit 0 is 1."]
255 #[inline(always)]
256 pub fn low_power_mode_ffe(&mut self) -> LOW_POWER_MODE_FFE_W {
257 LOW_POWER_MODE_FFE_W { w: self }
258 }
259 #[doc = "Bit 3 - Set to use external INT to wake up FFE."]
260 #[inline(always)]
261 pub fn kickoff_ffe_use_int(&mut self) -> KICKOFF_FFE_USE_INT_W {
262 KICKOFF_FFE_USE_INT_W { w: self }
263 }
264 #[doc = "Bits 4:7 - General purpose SFR"]
265 #[inline(always)]
266 pub fn general_purpose(&mut self) -> GENERAL_PURPOSE_W {
267 GENERAL_PURPOSE_W { w: self }
268 }
269 #[doc = "Writes raw bits to the register."]
270 #[inline(always)]
271 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
272 self.0.bits(bits);
273 self
274 }
275}
276#[doc = "Control for: Wether ext-interrupt can be used to wake up FFE, and clock switching for FFE/M4 power domains\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 [gen_purpose_1](index.html) module"]
277pub struct GEN_PURPOSE_1_SPEC;
278impl crate::RegisterSpec for GEN_PURPOSE_1_SPEC {
279 type Ux = u32;
280}
281#[doc = "`read()` method returns [gen_purpose_1::R](R) reader structure"]
282impl crate::Readable for GEN_PURPOSE_1_SPEC {
283 type Reader = R;
284}
285#[doc = "`write(|w| ..)` method takes [gen_purpose_1::W](W) writer structure"]
286impl crate::Writable for GEN_PURPOSE_1_SPEC {
287 type Writer = W;
288}
289#[doc = "`reset()` method sets GEN_PURPOSE_1 to value 0"]
290impl crate::Resettable for GEN_PURPOSE_1_SPEC {
291 #[inline(always)]
292 fn reset_value() -> Self::Ux {
293 0
294 }
295}