1#[doc = "Register `CR` writer"]
2pub type W = crate::W<CrSpec>;
3#[doc = "Voltage Regulator Off"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum Vroff {
6 #[doc = "0: no effect."]
7 NoEffect = 0,
8 #[doc = "1: if KEY is correct, asserts the vddcore_nreset and stops the voltage regulator."]
9 StopVreg = 1,
10}
11impl From<Vroff> for bool {
12 #[inline(always)]
13 fn from(variant: Vroff) -> Self {
14 variant as u8 != 0
15 }
16}
17#[doc = "Field `VROFF` writer - Voltage Regulator Off"]
18pub type VroffW<'a, REG> = crate::BitWriter<'a, REG, Vroff>;
19impl<'a, REG> VroffW<'a, REG>
20where
21 REG: crate::Writable + crate::RegisterSpec,
22{
23 #[doc = "no effect."]
24 #[inline(always)]
25 pub fn no_effect(self) -> &'a mut crate::W<REG> {
26 self.variant(Vroff::NoEffect)
27 }
28 #[doc = "if KEY is correct, asserts the vddcore_nreset and stops the voltage regulator."]
29 #[inline(always)]
30 pub fn stop_vreg(self) -> &'a mut crate::W<REG> {
31 self.variant(Vroff::StopVreg)
32 }
33}
34#[doc = "Crystal Oscillator Select"]
35#[derive(Clone, Copy, Debug, PartialEq, Eq)]
36pub enum Xtalsel {
37 #[doc = "0: no effect."]
38 NoEffect = 0,
39 #[doc = "1: if KEY is correct, switches the slow clock on the crystal oscillator output."]
40 CrystalSel = 1,
41}
42impl From<Xtalsel> for bool {
43 #[inline(always)]
44 fn from(variant: Xtalsel) -> Self {
45 variant as u8 != 0
46 }
47}
48#[doc = "Field `XTALSEL` writer - Crystal Oscillator Select"]
49pub type XtalselW<'a, REG> = crate::BitWriter<'a, REG, Xtalsel>;
50impl<'a, REG> XtalselW<'a, REG>
51where
52 REG: crate::Writable + crate::RegisterSpec,
53{
54 #[doc = "no effect."]
55 #[inline(always)]
56 pub fn no_effect(self) -> &'a mut crate::W<REG> {
57 self.variant(Xtalsel::NoEffect)
58 }
59 #[doc = "if KEY is correct, switches the slow clock on the crystal oscillator output."]
60 #[inline(always)]
61 pub fn crystal_sel(self) -> &'a mut crate::W<REG> {
62 self.variant(Xtalsel::CrystalSel)
63 }
64}
65#[doc = "Password"]
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
67#[repr(u8)]
68pub enum Key {
69 #[doc = "165: Writing any other value in this field aborts the write operation."]
70 Passwd = 165,
71}
72impl From<Key> for u8 {
73 #[inline(always)]
74 fn from(variant: Key) -> Self {
75 variant as _
76 }
77}
78impl crate::FieldSpec for Key {
79 type Ux = u8;
80}
81impl crate::IsEnum for Key {}
82#[doc = "Field `KEY` writer - Password"]
83pub type KeyW<'a, REG> = crate::FieldWriter<'a, REG, 8, Key>;
84impl<'a, REG> KeyW<'a, REG>
85where
86 REG: crate::Writable + crate::RegisterSpec,
87 REG::Ux: From<u8>,
88{
89 #[doc = "Writing any other value in this field aborts the write operation."]
90 #[inline(always)]
91 pub fn passwd(self) -> &'a mut crate::W<REG> {
92 self.variant(Key::Passwd)
93 }
94}
95impl W {
96 #[doc = "Bit 2 - Voltage Regulator Off"]
97 #[inline(always)]
98 #[must_use]
99 pub fn vroff(&mut self) -> VroffW<CrSpec> {
100 VroffW::new(self, 2)
101 }
102 #[doc = "Bit 3 - Crystal Oscillator Select"]
103 #[inline(always)]
104 #[must_use]
105 pub fn xtalsel(&mut self) -> XtalselW<CrSpec> {
106 XtalselW::new(self, 3)
107 }
108 #[doc = "Bits 24:31 - Password"]
109 #[inline(always)]
110 #[must_use]
111 pub fn key(&mut self) -> KeyW<CrSpec> {
112 KeyW::new(self, 24)
113 }
114}
115#[doc = "Supply Controller Control Register\n\nYou can [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`cr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
116pub struct CrSpec;
117impl crate::RegisterSpec for CrSpec {
118 type Ux = u32;
119}
120#[doc = "`write(|w| ..)` method takes [`cr::W`](W) writer structure"]
121impl crate::Writable for CrSpec {
122 type Safety = crate::Unsafe;
123 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
124 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
125}