mcxa_pac/gpio0/
giclr.rs

1#[doc = "Register `GICLR` reader"]
2pub type R = crate::R<GiclrSpec>;
3#[doc = "Register `GICLR` writer"]
4pub type W = crate::W<GiclrSpec>;
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(0-15)` 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(0-15)` 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 `GIWE0` 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 giwe0(&self) -> GiweR {
82        GiweR::new((self.bits & 1) != 0)
83    }
84    #[doc = "Bit 1 - Global Interrupt Write Enable"]
85    #[inline(always)]
86    pub fn giwe1(&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 giwe2(&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 giwe3(&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 giwe4(&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 giwe5(&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 giwe6(&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 giwe7(&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 giwe8(&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 giwe9(&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 giwe10(&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 giwe11(&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 giwe12(&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 giwe13(&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 giwe14(&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 giwe15(&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("GICLR")
169            .field("giwe0", &self.giwe0())
170            .field("giwe1", &self.giwe1())
171            .field("giwe2", &self.giwe2())
172            .field("giwe3", &self.giwe3())
173            .field("giwe4", &self.giwe4())
174            .field("giwe5", &self.giwe5())
175            .field("giwe6", &self.giwe6())
176            .field("giwe7", &self.giwe7())
177            .field("giwe8", &self.giwe8())
178            .field("giwe9", &self.giwe9())
179            .field("giwe10", &self.giwe10())
180            .field("giwe11", &self.giwe11())
181            .field("giwe12", &self.giwe12())
182            .field("giwe13", &self.giwe13())
183            .field("giwe14", &self.giwe14())
184            .field("giwe15", &self.giwe15())
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 `GIWE0` field.</div>"]
193    #[inline(always)]
194    pub fn giwe(&mut self, n: u8) -> GiweW<'_, GiclrSpec> {
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 giwe0(&mut self) -> GiweW<'_, GiclrSpec> {
202        GiweW::new(self, 0)
203    }
204    #[doc = "Bit 1 - Global Interrupt Write Enable"]
205    #[inline(always)]
206    pub fn giwe1(&mut self) -> GiweW<'_, GiclrSpec> {
207        GiweW::new(self, 1)
208    }
209    #[doc = "Bit 2 - Global Interrupt Write Enable"]
210    #[inline(always)]
211    pub fn giwe2(&mut self) -> GiweW<'_, GiclrSpec> {
212        GiweW::new(self, 2)
213    }
214    #[doc = "Bit 3 - Global Interrupt Write Enable"]
215    #[inline(always)]
216    pub fn giwe3(&mut self) -> GiweW<'_, GiclrSpec> {
217        GiweW::new(self, 3)
218    }
219    #[doc = "Bit 4 - Global Interrupt Write Enable"]
220    #[inline(always)]
221    pub fn giwe4(&mut self) -> GiweW<'_, GiclrSpec> {
222        GiweW::new(self, 4)
223    }
224    #[doc = "Bit 5 - Global Interrupt Write Enable"]
225    #[inline(always)]
226    pub fn giwe5(&mut self) -> GiweW<'_, GiclrSpec> {
227        GiweW::new(self, 5)
228    }
229    #[doc = "Bit 6 - Global Interrupt Write Enable"]
230    #[inline(always)]
231    pub fn giwe6(&mut self) -> GiweW<'_, GiclrSpec> {
232        GiweW::new(self, 6)
233    }
234    #[doc = "Bit 7 - Global Interrupt Write Enable"]
235    #[inline(always)]
236    pub fn giwe7(&mut self) -> GiweW<'_, GiclrSpec> {
237        GiweW::new(self, 7)
238    }
239    #[doc = "Bit 8 - Global Interrupt Write Enable"]
240    #[inline(always)]
241    pub fn giwe8(&mut self) -> GiweW<'_, GiclrSpec> {
242        GiweW::new(self, 8)
243    }
244    #[doc = "Bit 9 - Global Interrupt Write Enable"]
245    #[inline(always)]
246    pub fn giwe9(&mut self) -> GiweW<'_, GiclrSpec> {
247        GiweW::new(self, 9)
248    }
249    #[doc = "Bit 10 - Global Interrupt Write Enable"]
250    #[inline(always)]
251    pub fn giwe10(&mut self) -> GiweW<'_, GiclrSpec> {
252        GiweW::new(self, 10)
253    }
254    #[doc = "Bit 11 - Global Interrupt Write Enable"]
255    #[inline(always)]
256    pub fn giwe11(&mut self) -> GiweW<'_, GiclrSpec> {
257        GiweW::new(self, 11)
258    }
259    #[doc = "Bit 12 - Global Interrupt Write Enable"]
260    #[inline(always)]
261    pub fn giwe12(&mut self) -> GiweW<'_, GiclrSpec> {
262        GiweW::new(self, 12)
263    }
264    #[doc = "Bit 13 - Global Interrupt Write Enable"]
265    #[inline(always)]
266    pub fn giwe13(&mut self) -> GiweW<'_, GiclrSpec> {
267        GiweW::new(self, 13)
268    }
269    #[doc = "Bit 14 - Global Interrupt Write Enable"]
270    #[inline(always)]
271    pub fn giwe14(&mut self) -> GiweW<'_, GiclrSpec> {
272        GiweW::new(self, 14)
273    }
274    #[doc = "Bit 15 - Global Interrupt Write Enable"]
275    #[inline(always)]
276    pub fn giwe15(&mut self) -> GiweW<'_, GiclrSpec> {
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<'_, GiclrSpec> {
282        GiwdW::new(self, 16)
283    }
284}
285#[doc = "Global Interrupt Control Low\n\nYou can [`read`](crate::Reg::read) this register and get [`giclr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`giclr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
286pub struct GiclrSpec;
287impl crate::RegisterSpec for GiclrSpec {
288    type Ux = u32;
289}
290#[doc = "`read()` method returns [`giclr::R`](R) reader structure"]
291impl crate::Readable for GiclrSpec {}
292#[doc = "`write(|w| ..)` method takes [`giclr::W`](W) writer structure"]
293impl crate::Writable for GiclrSpec {
294    type Safety = crate::Unsafe;
295}
296#[doc = "`reset()` method sets GICLR to value 0"]
297impl crate::Resettable for GiclrSpec {}