1#[doc = "Register `VD_STAT` reader"]
2pub type R = crate::R<VdStatSpec>;
3#[doc = "Register `VD_STAT` writer"]
4pub type W = crate::W<VdStatSpec>;
5#[doc = "Core Low-Voltage Detect Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum CorevddLvdf {
9 #[doc = "0: Event not detected"]
10 EventNo = 0,
11 #[doc = "1: Event detected"]
12 EventYes = 1,
13}
14impl From<CorevddLvdf> for bool {
15 #[inline(always)]
16 fn from(variant: CorevddLvdf) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `COREVDD_LVDF` reader - Core Low-Voltage Detect Flag"]
21pub type CorevddLvdfR = crate::BitReader<CorevddLvdf>;
22impl CorevddLvdfR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> CorevddLvdf {
26 match self.bits {
27 false => CorevddLvdf::EventNo,
28 true => CorevddLvdf::EventYes,
29 }
30 }
31 #[doc = "Event not detected"]
32 #[inline(always)]
33 pub fn is_event_no(&self) -> bool {
34 *self == CorevddLvdf::EventNo
35 }
36 #[doc = "Event detected"]
37 #[inline(always)]
38 pub fn is_event_yes(&self) -> bool {
39 *self == CorevddLvdf::EventYes
40 }
41}
42#[doc = "Field `COREVDD_LVDF` writer - Core Low-Voltage Detect Flag"]
43pub type CorevddLvdfW<'a, REG> = crate::BitWriter1C<'a, REG, CorevddLvdf>;
44impl<'a, REG> CorevddLvdfW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Event not detected"]
49 #[inline(always)]
50 pub fn event_no(self) -> &'a mut crate::W<REG> {
51 self.variant(CorevddLvdf::EventNo)
52 }
53 #[doc = "Event detected"]
54 #[inline(always)]
55 pub fn event_yes(self) -> &'a mut crate::W<REG> {
56 self.variant(CorevddLvdf::EventYes)
57 }
58}
59#[doc = "System Low-Voltage Detect Flag\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum SysvddLvdf {
63 #[doc = "0: Event not detected"]
64 EventNo = 0,
65 #[doc = "1: Event detected"]
66 EventYes = 1,
67}
68impl From<SysvddLvdf> for bool {
69 #[inline(always)]
70 fn from(variant: SysvddLvdf) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `SYSVDD_LVDF` reader - System Low-Voltage Detect Flag"]
75pub type SysvddLvdfR = crate::BitReader<SysvddLvdf>;
76impl SysvddLvdfR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> SysvddLvdf {
80 match self.bits {
81 false => SysvddLvdf::EventNo,
82 true => SysvddLvdf::EventYes,
83 }
84 }
85 #[doc = "Event not detected"]
86 #[inline(always)]
87 pub fn is_event_no(&self) -> bool {
88 *self == SysvddLvdf::EventNo
89 }
90 #[doc = "Event detected"]
91 #[inline(always)]
92 pub fn is_event_yes(&self) -> bool {
93 *self == SysvddLvdf::EventYes
94 }
95}
96#[doc = "Field `SYSVDD_LVDF` writer - System Low-Voltage Detect Flag"]
97pub type SysvddLvdfW<'a, REG> = crate::BitWriter1C<'a, REG, SysvddLvdf>;
98impl<'a, REG> SysvddLvdfW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Event not detected"]
103 #[inline(always)]
104 pub fn event_no(self) -> &'a mut crate::W<REG> {
105 self.variant(SysvddLvdf::EventNo)
106 }
107 #[doc = "Event detected"]
108 #[inline(always)]
109 pub fn event_yes(self) -> &'a mut crate::W<REG> {
110 self.variant(SysvddLvdf::EventYes)
111 }
112}
113#[doc = "System HVD Flag\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum SysvddHvdf {
117 #[doc = "0: Event not detected"]
118 EventNo = 0,
119 #[doc = "1: Event detected"]
120 EventYes = 1,
121}
122impl From<SysvddHvdf> for bool {
123 #[inline(always)]
124 fn from(variant: SysvddHvdf) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `SYSVDD_HVDF` reader - System HVD Flag"]
129pub type SysvddHvdfR = crate::BitReader<SysvddHvdf>;
130impl SysvddHvdfR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> SysvddHvdf {
134 match self.bits {
135 false => SysvddHvdf::EventNo,
136 true => SysvddHvdf::EventYes,
137 }
138 }
139 #[doc = "Event not detected"]
140 #[inline(always)]
141 pub fn is_event_no(&self) -> bool {
142 *self == SysvddHvdf::EventNo
143 }
144 #[doc = "Event detected"]
145 #[inline(always)]
146 pub fn is_event_yes(&self) -> bool {
147 *self == SysvddHvdf::EventYes
148 }
149}
150#[doc = "Field `SYSVDD_HVDF` writer - System HVD Flag"]
151pub type SysvddHvdfW<'a, REG> = crate::BitWriter1C<'a, REG, SysvddHvdf>;
152impl<'a, REG> SysvddHvdfW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Event not detected"]
157 #[inline(always)]
158 pub fn event_no(self) -> &'a mut crate::W<REG> {
159 self.variant(SysvddHvdf::EventNo)
160 }
161 #[doc = "Event detected"]
162 #[inline(always)]
163 pub fn event_yes(self) -> &'a mut crate::W<REG> {
164 self.variant(SysvddHvdf::EventYes)
165 }
166}
167impl R {
168 #[doc = "Bit 0 - Core Low-Voltage Detect Flag"]
169 #[inline(always)]
170 pub fn corevdd_lvdf(&self) -> CorevddLvdfR {
171 CorevddLvdfR::new((self.bits & 1) != 0)
172 }
173 #[doc = "Bit 1 - System Low-Voltage Detect Flag"]
174 #[inline(always)]
175 pub fn sysvdd_lvdf(&self) -> SysvddLvdfR {
176 SysvddLvdfR::new(((self.bits >> 1) & 1) != 0)
177 }
178 #[doc = "Bit 5 - System HVD Flag"]
179 #[inline(always)]
180 pub fn sysvdd_hvdf(&self) -> SysvddHvdfR {
181 SysvddHvdfR::new(((self.bits >> 5) & 1) != 0)
182 }
183}
184#[cfg(feature = "debug")]
185impl core::fmt::Debug for R {
186 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187 f.debug_struct("VD_STAT")
188 .field("corevdd_lvdf", &self.corevdd_lvdf())
189 .field("sysvdd_lvdf", &self.sysvdd_lvdf())
190 .field("sysvdd_hvdf", &self.sysvdd_hvdf())
191 .finish()
192 }
193}
194impl W {
195 #[doc = "Bit 0 - Core Low-Voltage Detect Flag"]
196 #[inline(always)]
197 pub fn corevdd_lvdf(&mut self) -> CorevddLvdfW<'_, VdStatSpec> {
198 CorevddLvdfW::new(self, 0)
199 }
200 #[doc = "Bit 1 - System Low-Voltage Detect Flag"]
201 #[inline(always)]
202 pub fn sysvdd_lvdf(&mut self) -> SysvddLvdfW<'_, VdStatSpec> {
203 SysvddLvdfW::new(self, 1)
204 }
205 #[doc = "Bit 5 - System HVD Flag"]
206 #[inline(always)]
207 pub fn sysvdd_hvdf(&mut self) -> SysvddHvdfW<'_, VdStatSpec> {
208 SysvddHvdfW::new(self, 5)
209 }
210}
211#[doc = "Voltage Detect Status\n\nYou can [`read`](crate::Reg::read) this register and get [`vd_stat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`vd_stat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
212pub struct VdStatSpec;
213impl crate::RegisterSpec for VdStatSpec {
214 type Ux = u32;
215}
216#[doc = "`read()` method returns [`vd_stat::R`](R) reader structure"]
217impl crate::Readable for VdStatSpec {}
218#[doc = "`write(|w| ..)` method takes [`vd_stat::W`](W) writer structure"]
219impl crate::Writable for VdStatSpec {
220 type Safety = crate::Unsafe;
221 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x23;
222}
223#[doc = "`reset()` method sets VD_STAT to value 0"]
224impl crate::Resettable for VdStatSpec {}