1#[doc = "Register `PCR` reader"]
2pub type R = crate::R<PcrSpec>;
3#[doc = "Register `PCR` writer"]
4pub type W = crate::W<PcrSpec>;
5#[doc = "SD Bus Power\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Sdbpwrselect {
8 #[doc = "0: Power off"]
9 Off = 0,
10 #[doc = "1: Power on"]
11 On = 1,
12}
13impl From<Sdbpwrselect> for bool {
14 #[inline(always)]
15 fn from(variant: Sdbpwrselect) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `SDBPWR` reader - SD Bus Power"]
20pub type SdbpwrR = crate::BitReader<Sdbpwrselect>;
21impl SdbpwrR {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> Sdbpwrselect {
25 match self.bits {
26 false => Sdbpwrselect::Off,
27 true => Sdbpwrselect::On,
28 }
29 }
30 #[doc = "Power off"]
31 #[inline(always)]
32 pub fn is_off(&self) -> bool {
33 *self == Sdbpwrselect::Off
34 }
35 #[doc = "Power on"]
36 #[inline(always)]
37 pub fn is_on(&self) -> bool {
38 *self == Sdbpwrselect::On
39 }
40}
41#[doc = "Field `SDBPWR` writer - SD Bus Power"]
42pub type SdbpwrW<'a, REG> = crate::BitWriter<'a, REG, Sdbpwrselect>;
43impl<'a, REG> SdbpwrW<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "Power off"]
48 #[inline(always)]
49 pub fn off(self) -> &'a mut crate::W<REG> {
50 self.variant(Sdbpwrselect::Off)
51 }
52 #[doc = "Power on"]
53 #[inline(always)]
54 pub fn on(self) -> &'a mut crate::W<REG> {
55 self.variant(Sdbpwrselect::On)
56 }
57}
58#[doc = "SD Bus Voltage Select\n\nValue on reset: 7"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60#[repr(u8)]
61pub enum Sdbvselselect {
62 #[doc = "5: 1.8V (Typ.)"]
63 _1v8 = 5,
64 #[doc = "6: 3.0V (Typ.)"]
65 _3v0 = 6,
66 #[doc = "7: 3.3V (Typ.)"]
67 _3v3 = 7,
68}
69impl From<Sdbvselselect> for u8 {
70 #[inline(always)]
71 fn from(variant: Sdbvselselect) -> Self {
72 variant as _
73 }
74}
75impl crate::FieldSpec for Sdbvselselect {
76 type Ux = u8;
77}
78impl crate::IsEnum for Sdbvselselect {}
79#[doc = "Field `SDBVSEL` reader - SD Bus Voltage Select"]
80pub type SdbvselR = crate::FieldReader<Sdbvselselect>;
81impl SdbvselR {
82 #[doc = "Get enumerated values variant"]
83 #[inline(always)]
84 pub const fn variant(&self) -> Option<Sdbvselselect> {
85 match self.bits {
86 5 => Some(Sdbvselselect::_1v8),
87 6 => Some(Sdbvselselect::_3v0),
88 7 => Some(Sdbvselselect::_3v3),
89 _ => None,
90 }
91 }
92 #[doc = "1.8V (Typ.)"]
93 #[inline(always)]
94 pub fn is_1v8(&self) -> bool {
95 *self == Sdbvselselect::_1v8
96 }
97 #[doc = "3.0V (Typ.)"]
98 #[inline(always)]
99 pub fn is_3v0(&self) -> bool {
100 *self == Sdbvselselect::_3v0
101 }
102 #[doc = "3.3V (Typ.)"]
103 #[inline(always)]
104 pub fn is_3v3(&self) -> bool {
105 *self == Sdbvselselect::_3v3
106 }
107}
108#[doc = "Field `SDBVSEL` writer - SD Bus Voltage Select"]
109pub type SdbvselW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sdbvselselect>;
110impl<'a, REG> SdbvselW<'a, REG>
111where
112 REG: crate::Writable + crate::RegisterSpec,
113 REG::Ux: From<u8>,
114{
115 #[doc = "1.8V (Typ.)"]
116 #[inline(always)]
117 pub fn _1v8(self) -> &'a mut crate::W<REG> {
118 self.variant(Sdbvselselect::_1v8)
119 }
120 #[doc = "3.0V (Typ.)"]
121 #[inline(always)]
122 pub fn _3v0(self) -> &'a mut crate::W<REG> {
123 self.variant(Sdbvselselect::_3v0)
124 }
125 #[doc = "3.3V (Typ.)"]
126 #[inline(always)]
127 pub fn _3v3(self) -> &'a mut crate::W<REG> {
128 self.variant(Sdbvselselect::_3v3)
129 }
130}
131impl R {
132 #[doc = "Bit 0 - SD Bus Power"]
133 #[inline(always)]
134 pub fn sdbpwr(&self) -> SdbpwrR {
135 SdbpwrR::new((self.bits & 1) != 0)
136 }
137 #[doc = "Bits 1:3 - SD Bus Voltage Select"]
138 #[inline(always)]
139 pub fn sdbvsel(&self) -> SdbvselR {
140 SdbvselR::new((self.bits >> 1) & 7)
141 }
142}
143impl W {
144 #[doc = "Bit 0 - SD Bus Power"]
145 #[inline(always)]
146 #[must_use]
147 pub fn sdbpwr(&mut self) -> SdbpwrW<PcrSpec> {
148 SdbpwrW::new(self, 0)
149 }
150 #[doc = "Bits 1:3 - SD Bus Voltage Select"]
151 #[inline(always)]
152 #[must_use]
153 pub fn sdbvsel(&mut self) -> SdbvselW<PcrSpec> {
154 SdbvselW::new(self, 1)
155 }
156}
157#[doc = "Power Control\n\nYou can [`read`](crate::Reg::read) this register and get [`pcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
158pub struct PcrSpec;
159impl crate::RegisterSpec for PcrSpec {
160 type Ux = u8;
161}
162#[doc = "`read()` method returns [`pcr::R`](R) reader structure"]
163impl crate::Readable for PcrSpec {}
164#[doc = "`write(|w| ..)` method takes [`pcr::W`](W) writer structure"]
165impl crate::Writable for PcrSpec {
166 type Safety = crate::Unsafe;
167 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
168 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
169}
170#[doc = "`reset()` method sets PCR to value 0x0e"]
171impl crate::Resettable for PcrSpec {
172 const RESET_VALUE: u8 = 0x0e;
173}