1#[doc = "Register `SCR` reader"]
2pub type R = crate::R<SCR_SPEC>;
3#[doc = "Register `SCR` writer"]
4pub type W = crate::W<SCR_SPEC>;
5#[doc = "Sleep on Exit\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum SLEEPONEXIT_A {
8 #[doc = "0: do not sleep when returning to Thread mode."]
9 VALUE1 = 0,
10 #[doc = "1: enter sleep, or deep sleep, on return from an ISR."]
11 VALUE2 = 1,
12}
13impl From<SLEEPONEXIT_A> for bool {
14 #[inline(always)]
15 fn from(variant: SLEEPONEXIT_A) -> Self {
16 variant as u8 != 0
17 }
18}
19#[doc = "Field `SLEEPONEXIT` reader - Sleep on Exit"]
20pub type SLEEPONEXIT_R = crate::BitReader<SLEEPONEXIT_A>;
21impl SLEEPONEXIT_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> SLEEPONEXIT_A {
25 match self.bits {
26 false => SLEEPONEXIT_A::VALUE1,
27 true => SLEEPONEXIT_A::VALUE2,
28 }
29 }
30 #[doc = "do not sleep when returning to Thread mode."]
31 #[inline(always)]
32 pub fn is_value1(&self) -> bool {
33 *self == SLEEPONEXIT_A::VALUE1
34 }
35 #[doc = "enter sleep, or deep sleep, on return from an ISR."]
36 #[inline(always)]
37 pub fn is_value2(&self) -> bool {
38 *self == SLEEPONEXIT_A::VALUE2
39 }
40}
41#[doc = "Field `SLEEPONEXIT` writer - Sleep on Exit"]
42pub type SLEEPONEXIT_W<'a, REG> = crate::BitWriter<'a, REG, SLEEPONEXIT_A>;
43impl<'a, REG> SLEEPONEXIT_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "do not sleep when returning to Thread mode."]
48 #[inline(always)]
49 pub fn value1(self) -> &'a mut crate::W<REG> {
50 self.variant(SLEEPONEXIT_A::VALUE1)
51 }
52 #[doc = "enter sleep, or deep sleep, on return from an ISR."]
53 #[inline(always)]
54 pub fn value2(self) -> &'a mut crate::W<REG> {
55 self.variant(SLEEPONEXIT_A::VALUE2)
56 }
57}
58#[doc = "Sleep or Deep Sleep\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum SLEEPDEEP_A {
61 #[doc = "0: sleep"]
62 VALUE1 = 0,
63 #[doc = "1: deep sleep"]
64 VALUE2 = 1,
65}
66impl From<SLEEPDEEP_A> for bool {
67 #[inline(always)]
68 fn from(variant: SLEEPDEEP_A) -> Self {
69 variant as u8 != 0
70 }
71}
72#[doc = "Field `SLEEPDEEP` reader - Sleep or Deep Sleep"]
73pub type SLEEPDEEP_R = crate::BitReader<SLEEPDEEP_A>;
74impl SLEEPDEEP_R {
75 #[doc = "Get enumerated values variant"]
76 #[inline(always)]
77 pub const fn variant(&self) -> SLEEPDEEP_A {
78 match self.bits {
79 false => SLEEPDEEP_A::VALUE1,
80 true => SLEEPDEEP_A::VALUE2,
81 }
82 }
83 #[doc = "sleep"]
84 #[inline(always)]
85 pub fn is_value1(&self) -> bool {
86 *self == SLEEPDEEP_A::VALUE1
87 }
88 #[doc = "deep sleep"]
89 #[inline(always)]
90 pub fn is_value2(&self) -> bool {
91 *self == SLEEPDEEP_A::VALUE2
92 }
93}
94#[doc = "Field `SLEEPDEEP` writer - Sleep or Deep Sleep"]
95pub type SLEEPDEEP_W<'a, REG> = crate::BitWriter<'a, REG, SLEEPDEEP_A>;
96impl<'a, REG> SLEEPDEEP_W<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99{
100 #[doc = "sleep"]
101 #[inline(always)]
102 pub fn value1(self) -> &'a mut crate::W<REG> {
103 self.variant(SLEEPDEEP_A::VALUE1)
104 }
105 #[doc = "deep sleep"]
106 #[inline(always)]
107 pub fn value2(self) -> &'a mut crate::W<REG> {
108 self.variant(SLEEPDEEP_A::VALUE2)
109 }
110}
111#[doc = "Send Event on Pending bit:\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum SEVONPEND_A {
114 #[doc = "0: only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded"]
115 VALUE1 = 0,
116 #[doc = "1: enabled events and all interrupts, including disabled interrupts, can wakeup the processor."]
117 VALUE2 = 1,
118}
119impl From<SEVONPEND_A> for bool {
120 #[inline(always)]
121 fn from(variant: SEVONPEND_A) -> Self {
122 variant as u8 != 0
123 }
124}
125#[doc = "Field `SEVONPEND` reader - Send Event on Pending bit:"]
126pub type SEVONPEND_R = crate::BitReader<SEVONPEND_A>;
127impl SEVONPEND_R {
128 #[doc = "Get enumerated values variant"]
129 #[inline(always)]
130 pub const fn variant(&self) -> SEVONPEND_A {
131 match self.bits {
132 false => SEVONPEND_A::VALUE1,
133 true => SEVONPEND_A::VALUE2,
134 }
135 }
136 #[doc = "only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded"]
137 #[inline(always)]
138 pub fn is_value1(&self) -> bool {
139 *self == SEVONPEND_A::VALUE1
140 }
141 #[doc = "enabled events and all interrupts, including disabled interrupts, can wakeup the processor."]
142 #[inline(always)]
143 pub fn is_value2(&self) -> bool {
144 *self == SEVONPEND_A::VALUE2
145 }
146}
147#[doc = "Field `SEVONPEND` writer - Send Event on Pending bit:"]
148pub type SEVONPEND_W<'a, REG> = crate::BitWriter<'a, REG, SEVONPEND_A>;
149impl<'a, REG> SEVONPEND_W<'a, REG>
150where
151 REG: crate::Writable + crate::RegisterSpec,
152{
153 #[doc = "only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded"]
154 #[inline(always)]
155 pub fn value1(self) -> &'a mut crate::W<REG> {
156 self.variant(SEVONPEND_A::VALUE1)
157 }
158 #[doc = "enabled events and all interrupts, including disabled interrupts, can wakeup the processor."]
159 #[inline(always)]
160 pub fn value2(self) -> &'a mut crate::W<REG> {
161 self.variant(SEVONPEND_A::VALUE2)
162 }
163}
164impl R {
165 #[doc = "Bit 1 - Sleep on Exit"]
166 #[inline(always)]
167 pub fn sleeponexit(&self) -> SLEEPONEXIT_R {
168 SLEEPONEXIT_R::new(((self.bits >> 1) & 1) != 0)
169 }
170 #[doc = "Bit 2 - Sleep or Deep Sleep"]
171 #[inline(always)]
172 pub fn sleepdeep(&self) -> SLEEPDEEP_R {
173 SLEEPDEEP_R::new(((self.bits >> 2) & 1) != 0)
174 }
175 #[doc = "Bit 4 - Send Event on Pending bit:"]
176 #[inline(always)]
177 pub fn sevonpend(&self) -> SEVONPEND_R {
178 SEVONPEND_R::new(((self.bits >> 4) & 1) != 0)
179 }
180}
181impl W {
182 #[doc = "Bit 1 - Sleep on Exit"]
183 #[inline(always)]
184 pub fn sleeponexit(&mut self) -> SLEEPONEXIT_W<SCR_SPEC> {
185 SLEEPONEXIT_W::new(self, 1)
186 }
187 #[doc = "Bit 2 - Sleep or Deep Sleep"]
188 #[inline(always)]
189 pub fn sleepdeep(&mut self) -> SLEEPDEEP_W<SCR_SPEC> {
190 SLEEPDEEP_W::new(self, 2)
191 }
192 #[doc = "Bit 4 - Send Event on Pending bit:"]
193 #[inline(always)]
194 pub fn sevonpend(&mut self) -> SEVONPEND_W<SCR_SPEC> {
195 SEVONPEND_W::new(self, 4)
196 }
197}
198#[doc = "System Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`scr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`scr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
199pub struct SCR_SPEC;
200impl crate::RegisterSpec for SCR_SPEC {
201 type Ux = u32;
202}
203#[doc = "`read()` method returns [`scr::R`](R) reader structure"]
204impl crate::Readable for SCR_SPEC {}
205#[doc = "`write(|w| ..)` method takes [`scr::W`](W) writer structure"]
206impl crate::Writable for SCR_SPEC {
207 type Safety = crate::Unsafe;
208 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
209 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
210}
211#[doc = "`reset()` method sets SCR to value 0"]
212impl crate::Resettable for SCR_SPEC {
213 const RESET_VALUE: u32 = 0;
214}