1#[doc = "Register `CR` writer"]
2pub struct W(crate::W<CR_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<CR_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<CR_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<CR_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Voltage Regulator Off"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24pub enum VROFF_AW {
25 #[doc = "0: no effect."]
26 NO_EFFECT = 0,
27 #[doc = "1: if KEY is correct, asserts the vddcore_nreset and stops the voltage regulator."]
28 STOP_VREG = 1,
29}
30impl From<VROFF_AW> for bool {
31 #[inline(always)]
32 fn from(variant: VROFF_AW) -> Self {
33 variant as u8 != 0
34 }
35}
36#[doc = "Field `VROFF` writer - Voltage Regulator Off"]
37pub type VROFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, VROFF_AW, O>;
38impl<'a, const O: u8> VROFF_W<'a, O> {
39 #[doc = "no effect."]
40 #[inline(always)]
41 pub fn no_effect(self) -> &'a mut W {
42 self.variant(VROFF_AW::NO_EFFECT)
43 }
44 #[doc = "if KEY is correct, asserts the vddcore_nreset and stops the voltage regulator."]
45 #[inline(always)]
46 pub fn stop_vreg(self) -> &'a mut W {
47 self.variant(VROFF_AW::STOP_VREG)
48 }
49}
50#[doc = "Crystal Oscillator Select"]
51#[derive(Clone, Copy, Debug, PartialEq, Eq)]
52pub enum XTALSEL_AW {
53 #[doc = "0: no effect."]
54 NO_EFFECT = 0,
55 #[doc = "1: if KEY is correct, switches the slow clock on the crystal oscillator output."]
56 CRYSTAL_SEL = 1,
57}
58impl From<XTALSEL_AW> for bool {
59 #[inline(always)]
60 fn from(variant: XTALSEL_AW) -> Self {
61 variant as u8 != 0
62 }
63}
64#[doc = "Field `XTALSEL` writer - Crystal Oscillator Select"]
65pub type XTALSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, XTALSEL_AW, O>;
66impl<'a, const O: u8> XTALSEL_W<'a, O> {
67 #[doc = "no effect."]
68 #[inline(always)]
69 pub fn no_effect(self) -> &'a mut W {
70 self.variant(XTALSEL_AW::NO_EFFECT)
71 }
72 #[doc = "if KEY is correct, switches the slow clock on the crystal oscillator output."]
73 #[inline(always)]
74 pub fn crystal_sel(self) -> &'a mut W {
75 self.variant(XTALSEL_AW::CRYSTAL_SEL)
76 }
77}
78#[doc = "Password"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum KEY_AW {
82 #[doc = "165: Writing any other value in this field aborts the write operation."]
83 PASSWD = 165,
84}
85impl From<KEY_AW> for u8 {
86 #[inline(always)]
87 fn from(variant: KEY_AW) -> Self {
88 variant as _
89 }
90}
91#[doc = "Field `KEY` writer - Password"]
92pub type KEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, KEY_AW, 8, O>;
93impl<'a, const O: u8> KEY_W<'a, O> {
94 #[doc = "Writing any other value in this field aborts the write operation."]
95 #[inline(always)]
96 pub fn passwd(self) -> &'a mut W {
97 self.variant(KEY_AW::PASSWD)
98 }
99}
100impl W {
101 #[doc = "Bit 2 - Voltage Regulator Off"]
102 #[inline(always)]
103 #[must_use]
104 pub fn vroff(&mut self) -> VROFF_W<2> {
105 VROFF_W::new(self)
106 }
107 #[doc = "Bit 3 - Crystal Oscillator Select"]
108 #[inline(always)]
109 #[must_use]
110 pub fn xtalsel(&mut self) -> XTALSEL_W<3> {
111 XTALSEL_W::new(self)
112 }
113 #[doc = "Bits 24:31 - Password"]
114 #[inline(always)]
115 #[must_use]
116 pub fn key(&mut self) -> KEY_W<24> {
117 KEY_W::new(self)
118 }
119 #[doc = "Writes raw bits to the register."]
120 #[inline(always)]
121 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
122 self.0.bits(bits);
123 self
124 }
125}
126#[doc = "Supply Controller Control Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr](index.html) module"]
127pub struct CR_SPEC;
128impl crate::RegisterSpec for CR_SPEC {
129 type Ux = u32;
130}
131#[doc = "`write(|w| ..)` method takes [cr::W](W) writer structure"]
132impl crate::Writable for CR_SPEC {
133 type Writer = W;
134 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
135 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
136}