k510_pac/sysctl/
soc_wakup_src.rs1#[doc = "Register `SOC_WAKUP_SRC` reader"]
2pub struct R(crate::R<SOC_WAKUP_SRC_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SOC_WAKUP_SRC_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SOC_WAKUP_SRC_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SOC_WAKUP_SRC_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "The cause of SoC waking up from DEEPSLEEP mode.\n\nValue on reset: 0"]
17#[derive(Clone, Copy, Debug, PartialEq)]
18#[repr(u8)]
19pub enum DSLP_WAKUP_CAUSE_A {
20 #[doc = "1: SoC is woken up by RTC generate event"]
21 RTC = 1,
22 #[doc = "4: SoC is woken up by TIMER generate event"]
23 TIMER = 4,
24 #[doc = "8: SoC is woken up by GPIO key pressing event"]
25 GPIO = 8,
26}
27impl From<DSLP_WAKUP_CAUSE_A> for u8 {
28 #[inline(always)]
29 fn from(variant: DSLP_WAKUP_CAUSE_A) -> Self {
30 variant as _
31 }
32}
33#[doc = "Field `dslp_wakup_cause` reader - The cause of SoC waking up from DEEPSLEEP mode."]
34pub type DSLP_WAKUP_CAUSE_R = crate::FieldReader<u8, DSLP_WAKUP_CAUSE_A>;
35impl DSLP_WAKUP_CAUSE_R {
36 #[doc = "Get enumerated values variant"]
37 #[inline(always)]
38 pub fn variant(&self) -> Option<DSLP_WAKUP_CAUSE_A> {
39 match self.bits {
40 1 => Some(DSLP_WAKUP_CAUSE_A::RTC),
41 4 => Some(DSLP_WAKUP_CAUSE_A::TIMER),
42 8 => Some(DSLP_WAKUP_CAUSE_A::GPIO),
43 _ => None,
44 }
45 }
46 #[doc = "Checks if the value of the field is `RTC`"]
47 #[inline(always)]
48 pub fn is_rtc(&self) -> bool {
49 *self == DSLP_WAKUP_CAUSE_A::RTC
50 }
51 #[doc = "Checks if the value of the field is `TIMER`"]
52 #[inline(always)]
53 pub fn is_timer(&self) -> bool {
54 *self == DSLP_WAKUP_CAUSE_A::TIMER
55 }
56 #[doc = "Checks if the value of the field is `GPIO`"]
57 #[inline(always)]
58 pub fn is_gpio(&self) -> bool {
59 *self == DSLP_WAKUP_CAUSE_A::GPIO
60 }
61}
62#[doc = "The cause of SoC waking up from SLEEP1 mode.\n\nValue on reset: 0"]
63#[derive(Clone, Copy, Debug, PartialEq)]
64#[repr(u8)]
65pub enum SLP1_WAKUP_CAUSE_A {
66 #[doc = "1: SoC is woken up by RTC generate event"]
67 RTC = 1,
68 #[doc = "2: SoC is woken up by VAD generate event"]
69 VAD = 2,
70 #[doc = "4: SoC is woken up by TIMER generate event"]
71 TIMER = 4,
72 #[doc = "8: SoC is woken up by GPIO key pressing event"]
73 GPIO = 8,
74}
75impl From<SLP1_WAKUP_CAUSE_A> for u8 {
76 #[inline(always)]
77 fn from(variant: SLP1_WAKUP_CAUSE_A) -> Self {
78 variant as _
79 }
80}
81#[doc = "Field `slp1_wakup_cause` reader - The cause of SoC waking up from SLEEP1 mode."]
82pub type SLP1_WAKUP_CAUSE_R = crate::FieldReader<u8, SLP1_WAKUP_CAUSE_A>;
83impl SLP1_WAKUP_CAUSE_R {
84 #[doc = "Get enumerated values variant"]
85 #[inline(always)]
86 pub fn variant(&self) -> Option<SLP1_WAKUP_CAUSE_A> {
87 match self.bits {
88 1 => Some(SLP1_WAKUP_CAUSE_A::RTC),
89 2 => Some(SLP1_WAKUP_CAUSE_A::VAD),
90 4 => Some(SLP1_WAKUP_CAUSE_A::TIMER),
91 8 => Some(SLP1_WAKUP_CAUSE_A::GPIO),
92 _ => None,
93 }
94 }
95 #[doc = "Checks if the value of the field is `RTC`"]
96 #[inline(always)]
97 pub fn is_rtc(&self) -> bool {
98 *self == SLP1_WAKUP_CAUSE_A::RTC
99 }
100 #[doc = "Checks if the value of the field is `VAD`"]
101 #[inline(always)]
102 pub fn is_vad(&self) -> bool {
103 *self == SLP1_WAKUP_CAUSE_A::VAD
104 }
105 #[doc = "Checks if the value of the field is `TIMER`"]
106 #[inline(always)]
107 pub fn is_timer(&self) -> bool {
108 *self == SLP1_WAKUP_CAUSE_A::TIMER
109 }
110 #[doc = "Checks if the value of the field is `GPIO`"]
111 #[inline(always)]
112 pub fn is_gpio(&self) -> bool {
113 *self == SLP1_WAKUP_CAUSE_A::GPIO
114 }
115}
116#[doc = "The cause of SoC waking up from SLEEP0 mode.\n\nValue on reset: 0"]
117#[derive(Clone, Copy, Debug, PartialEq)]
118#[repr(u8)]
119pub enum SLP0_WAKUP_CAUSE_A {
120 #[doc = "1: SoC is woken up by RTC generate event"]
121 RTC = 1,
122 #[doc = "2: SoC is woken up by VAD generate event"]
123 VAD = 2,
124 #[doc = "4: SoC is woken up by TIMER generate event"]
125 TIMER = 4,
126 #[doc = "8: SoC is woken up by GPIO key pressing event"]
127 GPIO = 8,
128}
129impl From<SLP0_WAKUP_CAUSE_A> for u8 {
130 #[inline(always)]
131 fn from(variant: SLP0_WAKUP_CAUSE_A) -> Self {
132 variant as _
133 }
134}
135#[doc = "Field `slp0_wakup_cause` reader - The cause of SoC waking up from SLEEP0 mode."]
136pub type SLP0_WAKUP_CAUSE_R = crate::FieldReader<u8, SLP0_WAKUP_CAUSE_A>;
137impl SLP0_WAKUP_CAUSE_R {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub fn variant(&self) -> Option<SLP0_WAKUP_CAUSE_A> {
141 match self.bits {
142 1 => Some(SLP0_WAKUP_CAUSE_A::RTC),
143 2 => Some(SLP0_WAKUP_CAUSE_A::VAD),
144 4 => Some(SLP0_WAKUP_CAUSE_A::TIMER),
145 8 => Some(SLP0_WAKUP_CAUSE_A::GPIO),
146 _ => None,
147 }
148 }
149 #[doc = "Checks if the value of the field is `RTC`"]
150 #[inline(always)]
151 pub fn is_rtc(&self) -> bool {
152 *self == SLP0_WAKUP_CAUSE_A::RTC
153 }
154 #[doc = "Checks if the value of the field is `VAD`"]
155 #[inline(always)]
156 pub fn is_vad(&self) -> bool {
157 *self == SLP0_WAKUP_CAUSE_A::VAD
158 }
159 #[doc = "Checks if the value of the field is `TIMER`"]
160 #[inline(always)]
161 pub fn is_timer(&self) -> bool {
162 *self == SLP0_WAKUP_CAUSE_A::TIMER
163 }
164 #[doc = "Checks if the value of the field is `GPIO`"]
165 #[inline(always)]
166 pub fn is_gpio(&self) -> bool {
167 *self == SLP0_WAKUP_CAUSE_A::GPIO
168 }
169}
170impl R {
171 #[doc = "Bits 8:11 - The cause of SoC waking up from DEEPSLEEP mode."]
172 #[inline(always)]
173 pub fn dslp_wakup_cause(&self) -> DSLP_WAKUP_CAUSE_R {
174 DSLP_WAKUP_CAUSE_R::new(((self.bits >> 8) & 0x0f) as u8)
175 }
176 #[doc = "Bits 4:7 - The cause of SoC waking up from SLEEP1 mode."]
177 #[inline(always)]
178 pub fn slp1_wakup_cause(&self) -> SLP1_WAKUP_CAUSE_R {
179 SLP1_WAKUP_CAUSE_R::new(((self.bits >> 4) & 0x0f) as u8)
180 }
181 #[doc = "Bits 0:3 - The cause of SoC waking up from SLEEP0 mode."]
182 #[inline(always)]
183 pub fn slp0_wakup_cause(&self) -> SLP0_WAKUP_CAUSE_R {
184 SLP0_WAKUP_CAUSE_R::new((self.bits & 0x0f) as u8)
185 }
186}
187#[doc = "SoC wake-up cause status register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [soc_wakup_src](index.html) module"]
188pub struct SOC_WAKUP_SRC_SPEC;
189impl crate::RegisterSpec for SOC_WAKUP_SRC_SPEC {
190 type Ux = u32;
191}
192#[doc = "`read()` method returns [soc_wakup_src::R](R) reader structure"]
193impl crate::Readable for SOC_WAKUP_SRC_SPEC {
194 type Reader = R;
195}
196#[doc = "`reset()` method sets SOC_WAKUP_SRC to value 0"]
197impl crate::Resettable for SOC_WAKUP_SRC_SPEC {
198 #[inline(always)]
199 fn reset_value() -> Self::Ux {
200 0
201 }
202}