1#[doc = "Register `PWR_SSV_CTL` reader"]
2pub struct R(crate::R<PWR_SSV_CTL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PWR_SSV_CTL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PWR_SSV_CTL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PWR_SSV_CTL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PWR_SSV_CTL` writer"]
17pub struct W(crate::W<PWR_SSV_CTL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PWR_SSV_CTL_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<PWR_SSV_CTL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PWR_SSV_CTL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `BODVDDD_VSEL` reader - Selects the voltage threshold for BOD on vddd. The BOD does not reliably monitor the supply during the transition. 0: vddd<2.7V 1: vddd<3.0V"]
38pub type BODVDDD_VSEL_R = crate::BitReader<bool>;
39#[doc = "Field `BODVDDD_VSEL` writer - Selects the voltage threshold for BOD on vddd. The BOD does not reliably monitor the supply during the transition. 0: vddd<2.7V 1: vddd<3.0V"]
40pub type BODVDDD_VSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
41#[doc = "Field `BODVDDD_ENABLE` reader - Enable for BOD on vddd. This cannot be disabled during normal operation."]
42pub type BODVDDD_ENABLE_R = crate::BitReader<bool>;
43#[doc = "Field `BODVDDD_ENABLE` writer - Enable for BOD on vddd. This cannot be disabled during normal operation."]
44pub type BODVDDD_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
45#[doc = "Field `BODVDDA_VSEL` reader - Selects the voltage threshold for BOD on vdda. Ensure BODVDDA_ENABLE==0 before changing this setting to prevent false triggers. 0: vdda<2.7V 1: vdda<3.0V"]
46pub type BODVDDA_VSEL_R = crate::BitReader<bool>;
47#[doc = "Field `BODVDDA_VSEL` writer - Selects the voltage threshold for BOD on vdda. Ensure BODVDDA_ENABLE==0 before changing this setting to prevent false triggers. 0: vdda<2.7V 1: vdda<3.0V"]
48pub type BODVDDA_VSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
49#[doc = "Field `BODVDDA_ACTION` reader - Action taken when the BOD on vdda triggers."]
50pub type BODVDDA_ACTION_R = crate::FieldReader<u8, BODVDDA_ACTION_A>;
51#[doc = "Action taken when the BOD on vdda triggers.\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum BODVDDA_ACTION_A {
55 #[doc = "0: No action"]
56 NOTHING = 0,
57 #[doc = "1: Generate a fault"]
58 FAULT = 1,
59 #[doc = "2: Reset the chip"]
60 RESET = 2,
61}
62impl From<BODVDDA_ACTION_A> for u8 {
63 #[inline(always)]
64 fn from(variant: BODVDDA_ACTION_A) -> Self {
65 variant as _
66 }
67}
68impl BODVDDA_ACTION_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> Option<BODVDDA_ACTION_A> {
72 match self.bits {
73 0 => Some(BODVDDA_ACTION_A::NOTHING),
74 1 => Some(BODVDDA_ACTION_A::FAULT),
75 2 => Some(BODVDDA_ACTION_A::RESET),
76 _ => None,
77 }
78 }
79 #[doc = "Checks if the value of the field is `NOTHING`"]
80 #[inline(always)]
81 pub fn is_nothing(&self) -> bool {
82 *self == BODVDDA_ACTION_A::NOTHING
83 }
84 #[doc = "Checks if the value of the field is `FAULT`"]
85 #[inline(always)]
86 pub fn is_fault(&self) -> bool {
87 *self == BODVDDA_ACTION_A::FAULT
88 }
89 #[doc = "Checks if the value of the field is `RESET`"]
90 #[inline(always)]
91 pub fn is_reset(&self) -> bool {
92 *self == BODVDDA_ACTION_A::RESET
93 }
94}
95#[doc = "Field `BODVDDA_ACTION` writer - Action taken when the BOD on vdda triggers."]
96pub type BODVDDA_ACTION_W<'a, const O: u8> =
97 crate::FieldWriter<'a, u32, PWR_SSV_CTL_SPEC, u8, BODVDDA_ACTION_A, 2, O>;
98impl<'a, const O: u8> BODVDDA_ACTION_W<'a, O> {
99 #[doc = "No action"]
100 #[inline(always)]
101 pub fn nothing(self) -> &'a mut W {
102 self.variant(BODVDDA_ACTION_A::NOTHING)
103 }
104 #[doc = "Generate a fault"]
105 #[inline(always)]
106 pub fn fault(self) -> &'a mut W {
107 self.variant(BODVDDA_ACTION_A::FAULT)
108 }
109 #[doc = "Reset the chip"]
110 #[inline(always)]
111 pub fn reset(self) -> &'a mut W {
112 self.variant(BODVDDA_ACTION_A::RESET)
113 }
114}
115#[doc = "Field `BODVDDA_ENABLE` reader - Enable for BOD on vdda. BODVDDA_ACTION will be triggered when the BOD is disabled. If no action is desired when disabling, firmware must first write BODVDDA_ACTION=NOTHING in a separate write cycle."]
116pub type BODVDDA_ENABLE_R = crate::BitReader<bool>;
117#[doc = "Field `BODVDDA_ENABLE` writer - Enable for BOD on vdda. BODVDDA_ACTION will be triggered when the BOD is disabled. If no action is desired when disabling, firmware must first write BODVDDA_ACTION=NOTHING in a separate write cycle."]
118pub type BODVDDA_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
119#[doc = "Field `BODVCCD_ENABLE` reader - Enable for BOD on vccd. This cannot be disabled during normal operation."]
120pub type BODVCCD_ENABLE_R = crate::BitReader<bool>;
121#[doc = "Field `BODVCCD_ENABLE` writer - Enable for BOD on vccd. This cannot be disabled during normal operation."]
122pub type BODVCCD_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
123#[doc = "Field `OVDVDDD_VSEL` reader - Selects the voltage threshold for OVD on vddd. The OVD does not reliably monitor the supply during the transition. 0: vddd>5.5V 1: vddd>5.0V"]
124pub type OVDVDDD_VSEL_R = crate::BitReader<bool>;
125#[doc = "Field `OVDVDDD_VSEL` writer - Selects the voltage threshold for OVD on vddd. The OVD does not reliably monitor the supply during the transition. 0: vddd>5.5V 1: vddd>5.0V"]
126pub type OVDVDDD_VSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
127#[doc = "Field `OVDVDDD_ENABLE` reader - Enable for OVD on vddd. This cannot be disabled during normal operation."]
128pub type OVDVDDD_ENABLE_R = crate::BitReader<bool>;
129#[doc = "Field `OVDVDDD_ENABLE` writer - Enable for OVD on vddd. This cannot be disabled during normal operation."]
130pub type OVDVDDD_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
131#[doc = "Field `OVDVDDA_VSEL` reader - Selects the voltage threshold for OVD on vdda. Ensure OVDVDDA_ENABLE==0 before changing this setting to prevent false triggers 0: vddd>5.5V 1: vddd>5.0V"]
132pub type OVDVDDA_VSEL_R = crate::BitReader<bool>;
133#[doc = "Field `OVDVDDA_VSEL` writer - Selects the voltage threshold for OVD on vdda. Ensure OVDVDDA_ENABLE==0 before changing this setting to prevent false triggers 0: vddd>5.5V 1: vddd>5.0V"]
134pub type OVDVDDA_VSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
135#[doc = "Field `OVDVDDA_ACTION` reader - Action taken when the OVD on vdda triggers."]
136pub type OVDVDDA_ACTION_R = crate::FieldReader<u8, OVDVDDA_ACTION_A>;
137#[doc = "Action taken when the OVD on vdda triggers.\n\nValue on reset: 0"]
138#[derive(Clone, Copy, Debug, PartialEq, Eq)]
139#[repr(u8)]
140pub enum OVDVDDA_ACTION_A {
141 #[doc = "0: No action"]
142 NOTHING = 0,
143 #[doc = "1: Generate a fault"]
144 FAULT = 1,
145 #[doc = "2: Reset the chip"]
146 RESET = 2,
147}
148impl From<OVDVDDA_ACTION_A> for u8 {
149 #[inline(always)]
150 fn from(variant: OVDVDDA_ACTION_A) -> Self {
151 variant as _
152 }
153}
154impl OVDVDDA_ACTION_R {
155 #[doc = "Get enumerated values variant"]
156 #[inline(always)]
157 pub fn variant(&self) -> Option<OVDVDDA_ACTION_A> {
158 match self.bits {
159 0 => Some(OVDVDDA_ACTION_A::NOTHING),
160 1 => Some(OVDVDDA_ACTION_A::FAULT),
161 2 => Some(OVDVDDA_ACTION_A::RESET),
162 _ => None,
163 }
164 }
165 #[doc = "Checks if the value of the field is `NOTHING`"]
166 #[inline(always)]
167 pub fn is_nothing(&self) -> bool {
168 *self == OVDVDDA_ACTION_A::NOTHING
169 }
170 #[doc = "Checks if the value of the field is `FAULT`"]
171 #[inline(always)]
172 pub fn is_fault(&self) -> bool {
173 *self == OVDVDDA_ACTION_A::FAULT
174 }
175 #[doc = "Checks if the value of the field is `RESET`"]
176 #[inline(always)]
177 pub fn is_reset(&self) -> bool {
178 *self == OVDVDDA_ACTION_A::RESET
179 }
180}
181#[doc = "Field `OVDVDDA_ACTION` writer - Action taken when the OVD on vdda triggers."]
182pub type OVDVDDA_ACTION_W<'a, const O: u8> =
183 crate::FieldWriter<'a, u32, PWR_SSV_CTL_SPEC, u8, OVDVDDA_ACTION_A, 2, O>;
184impl<'a, const O: u8> OVDVDDA_ACTION_W<'a, O> {
185 #[doc = "No action"]
186 #[inline(always)]
187 pub fn nothing(self) -> &'a mut W {
188 self.variant(OVDVDDA_ACTION_A::NOTHING)
189 }
190 #[doc = "Generate a fault"]
191 #[inline(always)]
192 pub fn fault(self) -> &'a mut W {
193 self.variant(OVDVDDA_ACTION_A::FAULT)
194 }
195 #[doc = "Reset the chip"]
196 #[inline(always)]
197 pub fn reset(self) -> &'a mut W {
198 self.variant(OVDVDDA_ACTION_A::RESET)
199 }
200}
201#[doc = "Field `OVDVDDA_ENABLE` reader - Enable for OVD on vdda."]
202pub type OVDVDDA_ENABLE_R = crate::BitReader<bool>;
203#[doc = "Field `OVDVDDA_ENABLE` writer - Enable for OVD on vdda."]
204pub type OVDVDDA_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
205#[doc = "Field `OVDVCCD_ENABLE` reader - Enable for OVD on vccd. This cannot be disabled during normal operation."]
206pub type OVDVCCD_ENABLE_R = crate::BitReader<bool>;
207#[doc = "Field `OVDVCCD_ENABLE` writer - Enable for OVD on vccd. This cannot be disabled during normal operation."]
208pub type OVDVCCD_ENABLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, PWR_SSV_CTL_SPEC, bool, O>;
209impl R {
210 #[doc = "Bit 0 - Selects the voltage threshold for BOD on vddd. The BOD does not reliably monitor the supply during the transition. 0: vddd<2.7V 1: vddd<3.0V"]
211 #[inline(always)]
212 pub fn bodvddd_vsel(&self) -> BODVDDD_VSEL_R {
213 BODVDDD_VSEL_R::new((self.bits & 1) != 0)
214 }
215 #[doc = "Bit 3 - Enable for BOD on vddd. This cannot be disabled during normal operation."]
216 #[inline(always)]
217 pub fn bodvddd_enable(&self) -> BODVDDD_ENABLE_R {
218 BODVDDD_ENABLE_R::new(((self.bits >> 3) & 1) != 0)
219 }
220 #[doc = "Bit 4 - Selects the voltage threshold for BOD on vdda. Ensure BODVDDA_ENABLE==0 before changing this setting to prevent false triggers. 0: vdda<2.7V 1: vdda<3.0V"]
221 #[inline(always)]
222 pub fn bodvdda_vsel(&self) -> BODVDDA_VSEL_R {
223 BODVDDA_VSEL_R::new(((self.bits >> 4) & 1) != 0)
224 }
225 #[doc = "Bits 6:7 - Action taken when the BOD on vdda triggers."]
226 #[inline(always)]
227 pub fn bodvdda_action(&self) -> BODVDDA_ACTION_R {
228 BODVDDA_ACTION_R::new(((self.bits >> 6) & 3) as u8)
229 }
230 #[doc = "Bit 8 - Enable for BOD on vdda. BODVDDA_ACTION will be triggered when the BOD is disabled. If no action is desired when disabling, firmware must first write BODVDDA_ACTION=NOTHING in a separate write cycle."]
231 #[inline(always)]
232 pub fn bodvdda_enable(&self) -> BODVDDA_ENABLE_R {
233 BODVDDA_ENABLE_R::new(((self.bits >> 8) & 1) != 0)
234 }
235 #[doc = "Bit 11 - Enable for BOD on vccd. This cannot be disabled during normal operation."]
236 #[inline(always)]
237 pub fn bodvccd_enable(&self) -> BODVCCD_ENABLE_R {
238 BODVCCD_ENABLE_R::new(((self.bits >> 11) & 1) != 0)
239 }
240 #[doc = "Bit 16 - Selects the voltage threshold for OVD on vddd. The OVD does not reliably monitor the supply during the transition. 0: vddd>5.5V 1: vddd>5.0V"]
241 #[inline(always)]
242 pub fn ovdvddd_vsel(&self) -> OVDVDDD_VSEL_R {
243 OVDVDDD_VSEL_R::new(((self.bits >> 16) & 1) != 0)
244 }
245 #[doc = "Bit 19 - Enable for OVD on vddd. This cannot be disabled during normal operation."]
246 #[inline(always)]
247 pub fn ovdvddd_enable(&self) -> OVDVDDD_ENABLE_R {
248 OVDVDDD_ENABLE_R::new(((self.bits >> 19) & 1) != 0)
249 }
250 #[doc = "Bit 20 - Selects the voltage threshold for OVD on vdda. Ensure OVDVDDA_ENABLE==0 before changing this setting to prevent false triggers 0: vddd>5.5V 1: vddd>5.0V"]
251 #[inline(always)]
252 pub fn ovdvdda_vsel(&self) -> OVDVDDA_VSEL_R {
253 OVDVDDA_VSEL_R::new(((self.bits >> 20) & 1) != 0)
254 }
255 #[doc = "Bits 22:23 - Action taken when the OVD on vdda triggers."]
256 #[inline(always)]
257 pub fn ovdvdda_action(&self) -> OVDVDDA_ACTION_R {
258 OVDVDDA_ACTION_R::new(((self.bits >> 22) & 3) as u8)
259 }
260 #[doc = "Bit 24 - Enable for OVD on vdda."]
261 #[inline(always)]
262 pub fn ovdvdda_enable(&self) -> OVDVDDA_ENABLE_R {
263 OVDVDDA_ENABLE_R::new(((self.bits >> 24) & 1) != 0)
264 }
265 #[doc = "Bit 27 - Enable for OVD on vccd. This cannot be disabled during normal operation."]
266 #[inline(always)]
267 pub fn ovdvccd_enable(&self) -> OVDVCCD_ENABLE_R {
268 OVDVCCD_ENABLE_R::new(((self.bits >> 27) & 1) != 0)
269 }
270}
271impl W {
272 #[doc = "Bit 0 - Selects the voltage threshold for BOD on vddd. The BOD does not reliably monitor the supply during the transition. 0: vddd<2.7V 1: vddd<3.0V"]
273 #[inline(always)]
274 #[must_use]
275 pub fn bodvddd_vsel(&mut self) -> BODVDDD_VSEL_W<0> {
276 BODVDDD_VSEL_W::new(self)
277 }
278 #[doc = "Bit 3 - Enable for BOD on vddd. This cannot be disabled during normal operation."]
279 #[inline(always)]
280 #[must_use]
281 pub fn bodvddd_enable(&mut self) -> BODVDDD_ENABLE_W<3> {
282 BODVDDD_ENABLE_W::new(self)
283 }
284 #[doc = "Bit 4 - Selects the voltage threshold for BOD on vdda. Ensure BODVDDA_ENABLE==0 before changing this setting to prevent false triggers. 0: vdda<2.7V 1: vdda<3.0V"]
285 #[inline(always)]
286 #[must_use]
287 pub fn bodvdda_vsel(&mut self) -> BODVDDA_VSEL_W<4> {
288 BODVDDA_VSEL_W::new(self)
289 }
290 #[doc = "Bits 6:7 - Action taken when the BOD on vdda triggers."]
291 #[inline(always)]
292 #[must_use]
293 pub fn bodvdda_action(&mut self) -> BODVDDA_ACTION_W<6> {
294 BODVDDA_ACTION_W::new(self)
295 }
296 #[doc = "Bit 8 - Enable for BOD on vdda. BODVDDA_ACTION will be triggered when the BOD is disabled. If no action is desired when disabling, firmware must first write BODVDDA_ACTION=NOTHING in a separate write cycle."]
297 #[inline(always)]
298 #[must_use]
299 pub fn bodvdda_enable(&mut self) -> BODVDDA_ENABLE_W<8> {
300 BODVDDA_ENABLE_W::new(self)
301 }
302 #[doc = "Bit 11 - Enable for BOD on vccd. This cannot be disabled during normal operation."]
303 #[inline(always)]
304 #[must_use]
305 pub fn bodvccd_enable(&mut self) -> BODVCCD_ENABLE_W<11> {
306 BODVCCD_ENABLE_W::new(self)
307 }
308 #[doc = "Bit 16 - Selects the voltage threshold for OVD on vddd. The OVD does not reliably monitor the supply during the transition. 0: vddd>5.5V 1: vddd>5.0V"]
309 #[inline(always)]
310 #[must_use]
311 pub fn ovdvddd_vsel(&mut self) -> OVDVDDD_VSEL_W<16> {
312 OVDVDDD_VSEL_W::new(self)
313 }
314 #[doc = "Bit 19 - Enable for OVD on vddd. This cannot be disabled during normal operation."]
315 #[inline(always)]
316 #[must_use]
317 pub fn ovdvddd_enable(&mut self) -> OVDVDDD_ENABLE_W<19> {
318 OVDVDDD_ENABLE_W::new(self)
319 }
320 #[doc = "Bit 20 - Selects the voltage threshold for OVD on vdda. Ensure OVDVDDA_ENABLE==0 before changing this setting to prevent false triggers 0: vddd>5.5V 1: vddd>5.0V"]
321 #[inline(always)]
322 #[must_use]
323 pub fn ovdvdda_vsel(&mut self) -> OVDVDDA_VSEL_W<20> {
324 OVDVDDA_VSEL_W::new(self)
325 }
326 #[doc = "Bits 22:23 - Action taken when the OVD on vdda triggers."]
327 #[inline(always)]
328 #[must_use]
329 pub fn ovdvdda_action(&mut self) -> OVDVDDA_ACTION_W<22> {
330 OVDVDDA_ACTION_W::new(self)
331 }
332 #[doc = "Bit 24 - Enable for OVD on vdda."]
333 #[inline(always)]
334 #[must_use]
335 pub fn ovdvdda_enable(&mut self) -> OVDVDDA_ENABLE_W<24> {
336 OVDVDDA_ENABLE_W::new(self)
337 }
338 #[doc = "Bit 27 - Enable for OVD on vccd. This cannot be disabled during normal operation."]
339 #[inline(always)]
340 #[must_use]
341 pub fn ovdvccd_enable(&mut self) -> OVDVCCD_ENABLE_W<27> {
342 OVDVCCD_ENABLE_W::new(self)
343 }
344 #[doc = "Writes raw bits to the register."]
345 #[inline(always)]
346 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
347 self.0.bits(bits);
348 self
349 }
350}
351#[doc = "Supply Supervision 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 [pwr_ssv_ctl](index.html) module"]
352pub struct PWR_SSV_CTL_SPEC;
353impl crate::RegisterSpec for PWR_SSV_CTL_SPEC {
354 type Ux = u32;
355}
356#[doc = "`read()` method returns [pwr_ssv_ctl::R](R) reader structure"]
357impl crate::Readable for PWR_SSV_CTL_SPEC {
358 type Reader = R;
359}
360#[doc = "`write(|w| ..)` method takes [pwr_ssv_ctl::W](W) writer structure"]
361impl crate::Writable for PWR_SSV_CTL_SPEC {
362 type Writer = W;
363 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
364 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
365}
366#[doc = "`reset()` method sets PWR_SSV_CTL to value 0x0808_0808"]
367impl crate::Resettable for PWR_SSV_CTL_SPEC {
368 const RESET_VALUE: Self::Ux = 0x0808_0808;
369}