1#[doc = "Register `GICHR` reader"]
2pub type R = crate::R<GichrSpec>;
3#[doc = "Register `GICHR` writer"]
4pub type W = crate::W<GichrSpec>;
5#[doc = "Global Interrupt Write Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Giwe {
9 #[doc = "0: Not updated."]
10 Giwe0 = 0,
11 #[doc = "1: Updated"]
12 Giwe1 = 1,
13}
14impl From<Giwe> for bool {
15 #[inline(always)]
16 fn from(variant: Giwe) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `GIWE(16-31)` reader - Global Interrupt Write Enable"]
21pub type GiweR = crate::BitReader<Giwe>;
22impl GiweR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Giwe {
26 match self.bits {
27 false => Giwe::Giwe0,
28 true => Giwe::Giwe1,
29 }
30 }
31 #[doc = "Not updated."]
32 #[inline(always)]
33 pub fn is_giwe0(&self) -> bool {
34 *self == Giwe::Giwe0
35 }
36 #[doc = "Updated"]
37 #[inline(always)]
38 pub fn is_giwe1(&self) -> bool {
39 *self == Giwe::Giwe1
40 }
41}
42#[doc = "Field `GIWE(16-31)` writer - Global Interrupt Write Enable"]
43pub type GiweW<'a, REG> = crate::BitWriter<'a, REG, Giwe>;
44impl<'a, REG> GiweW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Not updated."]
49 #[inline(always)]
50 pub fn giwe0(self) -> &'a mut crate::W<REG> {
51 self.variant(Giwe::Giwe0)
52 }
53 #[doc = "Updated"]
54 #[inline(always)]
55 pub fn giwe1(self) -> &'a mut crate::W<REG> {
56 self.variant(Giwe::Giwe1)
57 }
58}
59#[doc = "Field `GIWD` reader - Global Interrupt Write Data"]
60pub type GiwdR = crate::FieldReader<u16>;
61#[doc = "Field `GIWD` writer - Global Interrupt Write Data"]
62pub type GiwdW<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
63impl R {
64 #[doc = "Global Interrupt Write Enable"]
65 #[doc = ""]
66 #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `GIWE16` field.</div>"]
67 #[inline(always)]
68 pub fn giwe(&self, n: u8) -> GiweR {
69 #[allow(clippy::no_effect)]
70 [(); 16][n as usize];
71 GiweR::new(((self.bits >> n) & 1) != 0)
72 }
73 #[doc = "Iterator for array of:"]
74 #[doc = "Global Interrupt Write Enable"]
75 #[inline(always)]
76 pub fn giwe_iter(&self) -> impl Iterator<Item = GiweR> + '_ {
77 (0..16).map(move |n| GiweR::new(((self.bits >> n) & 1) != 0))
78 }
79 #[doc = "Bit 0 - Global Interrupt Write Enable"]
80 #[inline(always)]
81 pub fn giwe16(&self) -> GiweR {
82 GiweR::new((self.bits & 1) != 0)
83 }
84 #[doc = "Bit 1 - Global Interrupt Write Enable"]
85 #[inline(always)]
86 pub fn giwe17(&self) -> GiweR {
87 GiweR::new(((self.bits >> 1) & 1) != 0)
88 }
89 #[doc = "Bit 2 - Global Interrupt Write Enable"]
90 #[inline(always)]
91 pub fn giwe18(&self) -> GiweR {
92 GiweR::new(((self.bits >> 2) & 1) != 0)
93 }
94 #[doc = "Bit 3 - Global Interrupt Write Enable"]
95 #[inline(always)]
96 pub fn giwe19(&self) -> GiweR {
97 GiweR::new(((self.bits >> 3) & 1) != 0)
98 }
99 #[doc = "Bit 4 - Global Interrupt Write Enable"]
100 #[inline(always)]
101 pub fn giwe20(&self) -> GiweR {
102 GiweR::new(((self.bits >> 4) & 1) != 0)
103 }
104 #[doc = "Bit 5 - Global Interrupt Write Enable"]
105 #[inline(always)]
106 pub fn giwe21(&self) -> GiweR {
107 GiweR::new(((self.bits >> 5) & 1) != 0)
108 }
109 #[doc = "Bit 6 - Global Interrupt Write Enable"]
110 #[inline(always)]
111 pub fn giwe22(&self) -> GiweR {
112 GiweR::new(((self.bits >> 6) & 1) != 0)
113 }
114 #[doc = "Bit 7 - Global Interrupt Write Enable"]
115 #[inline(always)]
116 pub fn giwe23(&self) -> GiweR {
117 GiweR::new(((self.bits >> 7) & 1) != 0)
118 }
119 #[doc = "Bit 8 - Global Interrupt Write Enable"]
120 #[inline(always)]
121 pub fn giwe24(&self) -> GiweR {
122 GiweR::new(((self.bits >> 8) & 1) != 0)
123 }
124 #[doc = "Bit 9 - Global Interrupt Write Enable"]
125 #[inline(always)]
126 pub fn giwe25(&self) -> GiweR {
127 GiweR::new(((self.bits >> 9) & 1) != 0)
128 }
129 #[doc = "Bit 10 - Global Interrupt Write Enable"]
130 #[inline(always)]
131 pub fn giwe26(&self) -> GiweR {
132 GiweR::new(((self.bits >> 10) & 1) != 0)
133 }
134 #[doc = "Bit 11 - Global Interrupt Write Enable"]
135 #[inline(always)]
136 pub fn giwe27(&self) -> GiweR {
137 GiweR::new(((self.bits >> 11) & 1) != 0)
138 }
139 #[doc = "Bit 12 - Global Interrupt Write Enable"]
140 #[inline(always)]
141 pub fn giwe28(&self) -> GiweR {
142 GiweR::new(((self.bits >> 12) & 1) != 0)
143 }
144 #[doc = "Bit 13 - Global Interrupt Write Enable"]
145 #[inline(always)]
146 pub fn giwe29(&self) -> GiweR {
147 GiweR::new(((self.bits >> 13) & 1) != 0)
148 }
149 #[doc = "Bit 14 - Global Interrupt Write Enable"]
150 #[inline(always)]
151 pub fn giwe30(&self) -> GiweR {
152 GiweR::new(((self.bits >> 14) & 1) != 0)
153 }
154 #[doc = "Bit 15 - Global Interrupt Write Enable"]
155 #[inline(always)]
156 pub fn giwe31(&self) -> GiweR {
157 GiweR::new(((self.bits >> 15) & 1) != 0)
158 }
159 #[doc = "Bits 16:31 - Global Interrupt Write Data"]
160 #[inline(always)]
161 pub fn giwd(&self) -> GiwdR {
162 GiwdR::new(((self.bits >> 16) & 0xffff) as u16)
163 }
164}
165#[cfg(feature = "debug")]
166impl core::fmt::Debug for R {
167 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
168 f.debug_struct("GICHR")
169 .field("giwe16", &self.giwe16())
170 .field("giwe17", &self.giwe17())
171 .field("giwe18", &self.giwe18())
172 .field("giwe19", &self.giwe19())
173 .field("giwe20", &self.giwe20())
174 .field("giwe21", &self.giwe21())
175 .field("giwe22", &self.giwe22())
176 .field("giwe23", &self.giwe23())
177 .field("giwe24", &self.giwe24())
178 .field("giwe25", &self.giwe25())
179 .field("giwe26", &self.giwe26())
180 .field("giwe27", &self.giwe27())
181 .field("giwe28", &self.giwe28())
182 .field("giwe29", &self.giwe29())
183 .field("giwe30", &self.giwe30())
184 .field("giwe31", &self.giwe31())
185 .field("giwd", &self.giwd())
186 .finish()
187 }
188}
189impl W {
190 #[doc = "Global Interrupt Write Enable"]
191 #[doc = ""]
192 #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `GIWE16` field.</div>"]
193 #[inline(always)]
194 pub fn giwe(&mut self, n: u8) -> GiweW<'_, GichrSpec> {
195 #[allow(clippy::no_effect)]
196 [(); 16][n as usize];
197 GiweW::new(self, n)
198 }
199 #[doc = "Bit 0 - Global Interrupt Write Enable"]
200 #[inline(always)]
201 pub fn giwe16(&mut self) -> GiweW<'_, GichrSpec> {
202 GiweW::new(self, 0)
203 }
204 #[doc = "Bit 1 - Global Interrupt Write Enable"]
205 #[inline(always)]
206 pub fn giwe17(&mut self) -> GiweW<'_, GichrSpec> {
207 GiweW::new(self, 1)
208 }
209 #[doc = "Bit 2 - Global Interrupt Write Enable"]
210 #[inline(always)]
211 pub fn giwe18(&mut self) -> GiweW<'_, GichrSpec> {
212 GiweW::new(self, 2)
213 }
214 #[doc = "Bit 3 - Global Interrupt Write Enable"]
215 #[inline(always)]
216 pub fn giwe19(&mut self) -> GiweW<'_, GichrSpec> {
217 GiweW::new(self, 3)
218 }
219 #[doc = "Bit 4 - Global Interrupt Write Enable"]
220 #[inline(always)]
221 pub fn giwe20(&mut self) -> GiweW<'_, GichrSpec> {
222 GiweW::new(self, 4)
223 }
224 #[doc = "Bit 5 - Global Interrupt Write Enable"]
225 #[inline(always)]
226 pub fn giwe21(&mut self) -> GiweW<'_, GichrSpec> {
227 GiweW::new(self, 5)
228 }
229 #[doc = "Bit 6 - Global Interrupt Write Enable"]
230 #[inline(always)]
231 pub fn giwe22(&mut self) -> GiweW<'_, GichrSpec> {
232 GiweW::new(self, 6)
233 }
234 #[doc = "Bit 7 - Global Interrupt Write Enable"]
235 #[inline(always)]
236 pub fn giwe23(&mut self) -> GiweW<'_, GichrSpec> {
237 GiweW::new(self, 7)
238 }
239 #[doc = "Bit 8 - Global Interrupt Write Enable"]
240 #[inline(always)]
241 pub fn giwe24(&mut self) -> GiweW<'_, GichrSpec> {
242 GiweW::new(self, 8)
243 }
244 #[doc = "Bit 9 - Global Interrupt Write Enable"]
245 #[inline(always)]
246 pub fn giwe25(&mut self) -> GiweW<'_, GichrSpec> {
247 GiweW::new(self, 9)
248 }
249 #[doc = "Bit 10 - Global Interrupt Write Enable"]
250 #[inline(always)]
251 pub fn giwe26(&mut self) -> GiweW<'_, GichrSpec> {
252 GiweW::new(self, 10)
253 }
254 #[doc = "Bit 11 - Global Interrupt Write Enable"]
255 #[inline(always)]
256 pub fn giwe27(&mut self) -> GiweW<'_, GichrSpec> {
257 GiweW::new(self, 11)
258 }
259 #[doc = "Bit 12 - Global Interrupt Write Enable"]
260 #[inline(always)]
261 pub fn giwe28(&mut self) -> GiweW<'_, GichrSpec> {
262 GiweW::new(self, 12)
263 }
264 #[doc = "Bit 13 - Global Interrupt Write Enable"]
265 #[inline(always)]
266 pub fn giwe29(&mut self) -> GiweW<'_, GichrSpec> {
267 GiweW::new(self, 13)
268 }
269 #[doc = "Bit 14 - Global Interrupt Write Enable"]
270 #[inline(always)]
271 pub fn giwe30(&mut self) -> GiweW<'_, GichrSpec> {
272 GiweW::new(self, 14)
273 }
274 #[doc = "Bit 15 - Global Interrupt Write Enable"]
275 #[inline(always)]
276 pub fn giwe31(&mut self) -> GiweW<'_, GichrSpec> {
277 GiweW::new(self, 15)
278 }
279 #[doc = "Bits 16:31 - Global Interrupt Write Data"]
280 #[inline(always)]
281 pub fn giwd(&mut self) -> GiwdW<'_, GichrSpec> {
282 GiwdW::new(self, 16)
283 }
284}
285#[doc = "Global Interrupt Control High\n\nYou can [`read`](crate::Reg::read) this register and get [`gichr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gichr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
286pub struct GichrSpec;
287impl crate::RegisterSpec for GichrSpec {
288 type Ux = u32;
289}
290#[doc = "`read()` method returns [`gichr::R`](R) reader structure"]
291impl crate::Readable for GichrSpec {}
292#[doc = "`write(|w| ..)` method takes [`gichr::W`](W) writer structure"]
293impl crate::Writable for GichrSpec {
294 type Safety = crate::Unsafe;
295}
296#[doc = "`reset()` method sets GICHR to value 0"]
297impl crate::Resettable for GichrSpec {}