1#[doc = "Register `DPSBYCR` reader"]
2pub struct R(crate::R<DPSBYCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DPSBYCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DPSBYCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DPSBYCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DPSBYCR` writer"]
17pub struct W(crate::W<DPSBYCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DPSBYCR_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<DPSBYCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DPSBYCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DEEPCUT` reader - Power-Supply Control"]
38pub type DEEPCUT_R = crate::FieldReader<u8, DEEPCUT_A>;
39#[doc = "Power-Supply Control\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum DEEPCUT_A {
43 #[doc = "0: Power to the standby RAM, Low-speed on-chip oscillator, AGTn (n = 0 to 3), and USBFS resume detecting unit is supplied in Deep Software Standby mode."]
44 _00 = 0,
45 #[doc = "1: Power to the standby RAM, Low-speed on-chip oscillator, AGT, and USBFS resume detecting unit is not supplied in Deep Software Standby mode."]
46 _01 = 1,
47 #[doc = "2: Setting prohibited"]
48 _10 = 2,
49 #[doc = "3: Power to the standby RAM, Low-speed on-chip oscillator, AGT, and USBFS resume detecting unit is not supplied in Deep Software Standby mode. In addition, LVD is disabled and the low power function in a power-on reset circuit is enabled."]
50 _11 = 3,
51}
52impl From<DEEPCUT_A> for u8 {
53 #[inline(always)]
54 fn from(variant: DEEPCUT_A) -> Self {
55 variant as _
56 }
57}
58impl DEEPCUT_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> DEEPCUT_A {
62 match self.bits {
63 0 => DEEPCUT_A::_00,
64 1 => DEEPCUT_A::_01,
65 2 => DEEPCUT_A::_10,
66 3 => DEEPCUT_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == DEEPCUT_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == DEEPCUT_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == DEEPCUT_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == DEEPCUT_A::_11
89 }
90}
91#[doc = "Field `DEEPCUT` writer - Power-Supply Control"]
92pub type DEEPCUT_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u8, DPSBYCR_SPEC, u8, DEEPCUT_A, 2, O>;
94impl<'a, const O: u8> DEEPCUT_W<'a, O> {
95 #[doc = "Power to the standby RAM, Low-speed on-chip oscillator, AGTn (n = 0 to 3), and USBFS resume detecting unit is supplied in Deep Software Standby mode."]
96 #[inline(always)]
97 pub fn _00(self) -> &'a mut W {
98 self.variant(DEEPCUT_A::_00)
99 }
100 #[doc = "Power to the standby RAM, Low-speed on-chip oscillator, AGT, and USBFS resume detecting unit is not supplied in Deep Software Standby mode."]
101 #[inline(always)]
102 pub fn _01(self) -> &'a mut W {
103 self.variant(DEEPCUT_A::_01)
104 }
105 #[doc = "Setting prohibited"]
106 #[inline(always)]
107 pub fn _10(self) -> &'a mut W {
108 self.variant(DEEPCUT_A::_10)
109 }
110 #[doc = "Power to the standby RAM, Low-speed on-chip oscillator, AGT, and USBFS resume detecting unit is not supplied in Deep Software Standby mode. In addition, LVD is disabled and the low power function in a power-on reset circuit is enabled."]
111 #[inline(always)]
112 pub fn _11(self) -> &'a mut W {
113 self.variant(DEEPCUT_A::_11)
114 }
115}
116#[doc = "Field `IOKEEP` reader - I/O Port Rentention"]
117pub type IOKEEP_R = crate::BitReader<IOKEEP_A>;
118#[doc = "I/O Port Rentention\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120pub enum IOKEEP_A {
121 #[doc = "0: When the Deep Software Standby mode is canceled, the I/O ports are in the reset state."]
122 _0 = 0,
123 #[doc = "1: When the Deep Software Standby mode is canceled, the I/O ports are in the same state as in the Deep Software Standby mode."]
124 _1 = 1,
125}
126impl From<IOKEEP_A> for bool {
127 #[inline(always)]
128 fn from(variant: IOKEEP_A) -> Self {
129 variant as u8 != 0
130 }
131}
132impl IOKEEP_R {
133 #[doc = "Get enumerated values variant"]
134 #[inline(always)]
135 pub fn variant(&self) -> IOKEEP_A {
136 match self.bits {
137 false => IOKEEP_A::_0,
138 true => IOKEEP_A::_1,
139 }
140 }
141 #[doc = "Checks if the value of the field is `_0`"]
142 #[inline(always)]
143 pub fn is_0(&self) -> bool {
144 *self == IOKEEP_A::_0
145 }
146 #[doc = "Checks if the value of the field is `_1`"]
147 #[inline(always)]
148 pub fn is_1(&self) -> bool {
149 *self == IOKEEP_A::_1
150 }
151}
152#[doc = "Field `IOKEEP` writer - I/O Port Rentention"]
153pub type IOKEEP_W<'a, const O: u8> = crate::BitWriter<'a, u8, DPSBYCR_SPEC, IOKEEP_A, O>;
154impl<'a, const O: u8> IOKEEP_W<'a, O> {
155 #[doc = "When the Deep Software Standby mode is canceled, the I/O ports are in the reset state."]
156 #[inline(always)]
157 pub fn _0(self) -> &'a mut W {
158 self.variant(IOKEEP_A::_0)
159 }
160 #[doc = "When the Deep Software Standby mode is canceled, the I/O ports are in the same state as in the Deep Software Standby mode."]
161 #[inline(always)]
162 pub fn _1(self) -> &'a mut W {
163 self.variant(IOKEEP_A::_1)
164 }
165}
166#[doc = "Field `DPSBY` reader - Deep Software Standby"]
167pub type DPSBY_R = crate::BitReader<DPSBY_A>;
168#[doc = "Deep Software Standby\n\nValue on reset: 0"]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum DPSBY_A {
171 #[doc = "0: Sleep mode (SBYCR.SSBY=0) / Software Standby mode (SBYCR.SSBY=1)"]
172 _0 = 0,
173 #[doc = "1: Sleep mode (SBYCR.SSBY=0) / Deep Software Standby mode (SBYCR.SSBY=1)"]
174 _1 = 1,
175}
176impl From<DPSBY_A> for bool {
177 #[inline(always)]
178 fn from(variant: DPSBY_A) -> Self {
179 variant as u8 != 0
180 }
181}
182impl DPSBY_R {
183 #[doc = "Get enumerated values variant"]
184 #[inline(always)]
185 pub fn variant(&self) -> DPSBY_A {
186 match self.bits {
187 false => DPSBY_A::_0,
188 true => DPSBY_A::_1,
189 }
190 }
191 #[doc = "Checks if the value of the field is `_0`"]
192 #[inline(always)]
193 pub fn is_0(&self) -> bool {
194 *self == DPSBY_A::_0
195 }
196 #[doc = "Checks if the value of the field is `_1`"]
197 #[inline(always)]
198 pub fn is_1(&self) -> bool {
199 *self == DPSBY_A::_1
200 }
201}
202#[doc = "Field `DPSBY` writer - Deep Software Standby"]
203pub type DPSBY_W<'a, const O: u8> = crate::BitWriter<'a, u8, DPSBYCR_SPEC, DPSBY_A, O>;
204impl<'a, const O: u8> DPSBY_W<'a, O> {
205 #[doc = "Sleep mode (SBYCR.SSBY=0) / Software Standby mode (SBYCR.SSBY=1)"]
206 #[inline(always)]
207 pub fn _0(self) -> &'a mut W {
208 self.variant(DPSBY_A::_0)
209 }
210 #[doc = "Sleep mode (SBYCR.SSBY=0) / Deep Software Standby mode (SBYCR.SSBY=1)"]
211 #[inline(always)]
212 pub fn _1(self) -> &'a mut W {
213 self.variant(DPSBY_A::_1)
214 }
215}
216impl R {
217 #[doc = "Bits 0:1 - Power-Supply Control"]
218 #[inline(always)]
219 pub fn deepcut(&self) -> DEEPCUT_R {
220 DEEPCUT_R::new(self.bits & 3)
221 }
222 #[doc = "Bit 6 - I/O Port Rentention"]
223 #[inline(always)]
224 pub fn iokeep(&self) -> IOKEEP_R {
225 IOKEEP_R::new(((self.bits >> 6) & 1) != 0)
226 }
227 #[doc = "Bit 7 - Deep Software Standby"]
228 #[inline(always)]
229 pub fn dpsby(&self) -> DPSBY_R {
230 DPSBY_R::new(((self.bits >> 7) & 1) != 0)
231 }
232}
233impl W {
234 #[doc = "Bits 0:1 - Power-Supply Control"]
235 #[inline(always)]
236 #[must_use]
237 pub fn deepcut(&mut self) -> DEEPCUT_W<0> {
238 DEEPCUT_W::new(self)
239 }
240 #[doc = "Bit 6 - I/O Port Rentention"]
241 #[inline(always)]
242 #[must_use]
243 pub fn iokeep(&mut self) -> IOKEEP_W<6> {
244 IOKEEP_W::new(self)
245 }
246 #[doc = "Bit 7 - Deep Software Standby"]
247 #[inline(always)]
248 #[must_use]
249 pub fn dpsby(&mut self) -> DPSBY_W<7> {
250 DPSBY_W::new(self)
251 }
252 #[doc = "Writes raw bits to the register."]
253 #[inline(always)]
254 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
255 self.0.bits(bits);
256 self
257 }
258}
259#[doc = "Deep Standby 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 [dpsbycr](index.html) module"]
260pub struct DPSBYCR_SPEC;
261impl crate::RegisterSpec for DPSBYCR_SPEC {
262 type Ux = u8;
263}
264#[doc = "`read()` method returns [dpsbycr::R](R) reader structure"]
265impl crate::Readable for DPSBYCR_SPEC {
266 type Reader = R;
267}
268#[doc = "`write(|w| ..)` method takes [dpsbycr::W](W) writer structure"]
269impl crate::Writable for DPSBYCR_SPEC {
270 type Writer = W;
271 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
272 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
273}
274#[doc = "`reset()` method sets DPSBYCR to value 0x01"]
275impl crate::Resettable for DPSBYCR_SPEC {
276 const RESET_VALUE: Self::Ux = 0x01;
277}