stm32f1_staging/stm32f107/exti/
swier.rs

1///Register `SWIER` reader
2pub type R = crate::R<SWIERrs>;
3///Register `SWIER` writer
4pub type W = crate::W<SWIERrs>;
5/**Software Interrupt on line %s
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum SOFTWARE_INTERRUPT {
11    ///1: Generates an interrupt request
12    Pend = 1,
13}
14impl From<SOFTWARE_INTERRUPT> for bool {
15    #[inline(always)]
16    fn from(variant: SOFTWARE_INTERRUPT) -> Self {
17        variant as u8 != 0
18    }
19}
20///Field `SWIER(0-19)` reader - Software Interrupt on line %s
21pub type SWIER_R = crate::BitReader<SOFTWARE_INTERRUPT>;
22impl SWIER_R {
23    ///Get enumerated values variant
24    #[inline(always)]
25    pub const fn variant(&self) -> Option<SOFTWARE_INTERRUPT> {
26        match self.bits {
27            true => Some(SOFTWARE_INTERRUPT::Pend),
28            _ => None,
29        }
30    }
31    ///Generates an interrupt request
32    #[inline(always)]
33    pub fn is_pend(&self) -> bool {
34        *self == SOFTWARE_INTERRUPT::Pend
35    }
36}
37///Field `SWIER(0-19)` writer - Software Interrupt on line %s
38pub type SWIER_W<'a, REG> = crate::BitWriter<'a, REG, SOFTWARE_INTERRUPT>;
39impl<'a, REG> SWIER_W<'a, REG>
40where
41    REG: crate::Writable + crate::RegisterSpec,
42{
43    ///Generates an interrupt request
44    #[inline(always)]
45    pub fn pend(self) -> &'a mut crate::W<REG> {
46        self.variant(SOFTWARE_INTERRUPT::Pend)
47    }
48}
49impl R {
50    ///Software Interrupt on line (0-19)
51    ///
52    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `SWIER0` field.</div>
53    #[inline(always)]
54    pub fn swier(&self, n: u8) -> SWIER_R {
55        #[allow(clippy::no_effect)] [(); 20][n as usize];
56        SWIER_R::new(((self.bits >> n) & 1) != 0)
57    }
58    ///Iterator for array of:
59    ///Software Interrupt on line (0-19)
60    #[inline(always)]
61    pub fn swier_iter(&self) -> impl Iterator<Item = SWIER_R> + '_ {
62        (0..20).map(move |n| SWIER_R::new(((self.bits >> n) & 1) != 0))
63    }
64    ///Bit 0 - Software Interrupt on line 0
65    #[inline(always)]
66    pub fn swier0(&self) -> SWIER_R {
67        SWIER_R::new((self.bits & 1) != 0)
68    }
69    ///Bit 1 - Software Interrupt on line 1
70    #[inline(always)]
71    pub fn swier1(&self) -> SWIER_R {
72        SWIER_R::new(((self.bits >> 1) & 1) != 0)
73    }
74    ///Bit 2 - Software Interrupt on line 2
75    #[inline(always)]
76    pub fn swier2(&self) -> SWIER_R {
77        SWIER_R::new(((self.bits >> 2) & 1) != 0)
78    }
79    ///Bit 3 - Software Interrupt on line 3
80    #[inline(always)]
81    pub fn swier3(&self) -> SWIER_R {
82        SWIER_R::new(((self.bits >> 3) & 1) != 0)
83    }
84    ///Bit 4 - Software Interrupt on line 4
85    #[inline(always)]
86    pub fn swier4(&self) -> SWIER_R {
87        SWIER_R::new(((self.bits >> 4) & 1) != 0)
88    }
89    ///Bit 5 - Software Interrupt on line 5
90    #[inline(always)]
91    pub fn swier5(&self) -> SWIER_R {
92        SWIER_R::new(((self.bits >> 5) & 1) != 0)
93    }
94    ///Bit 6 - Software Interrupt on line 6
95    #[inline(always)]
96    pub fn swier6(&self) -> SWIER_R {
97        SWIER_R::new(((self.bits >> 6) & 1) != 0)
98    }
99    ///Bit 7 - Software Interrupt on line 7
100    #[inline(always)]
101    pub fn swier7(&self) -> SWIER_R {
102        SWIER_R::new(((self.bits >> 7) & 1) != 0)
103    }
104    ///Bit 8 - Software Interrupt on line 8
105    #[inline(always)]
106    pub fn swier8(&self) -> SWIER_R {
107        SWIER_R::new(((self.bits >> 8) & 1) != 0)
108    }
109    ///Bit 9 - Software Interrupt on line 9
110    #[inline(always)]
111    pub fn swier9(&self) -> SWIER_R {
112        SWIER_R::new(((self.bits >> 9) & 1) != 0)
113    }
114    ///Bit 10 - Software Interrupt on line 10
115    #[inline(always)]
116    pub fn swier10(&self) -> SWIER_R {
117        SWIER_R::new(((self.bits >> 10) & 1) != 0)
118    }
119    ///Bit 11 - Software Interrupt on line 11
120    #[inline(always)]
121    pub fn swier11(&self) -> SWIER_R {
122        SWIER_R::new(((self.bits >> 11) & 1) != 0)
123    }
124    ///Bit 12 - Software Interrupt on line 12
125    #[inline(always)]
126    pub fn swier12(&self) -> SWIER_R {
127        SWIER_R::new(((self.bits >> 12) & 1) != 0)
128    }
129    ///Bit 13 - Software Interrupt on line 13
130    #[inline(always)]
131    pub fn swier13(&self) -> SWIER_R {
132        SWIER_R::new(((self.bits >> 13) & 1) != 0)
133    }
134    ///Bit 14 - Software Interrupt on line 14
135    #[inline(always)]
136    pub fn swier14(&self) -> SWIER_R {
137        SWIER_R::new(((self.bits >> 14) & 1) != 0)
138    }
139    ///Bit 15 - Software Interrupt on line 15
140    #[inline(always)]
141    pub fn swier15(&self) -> SWIER_R {
142        SWIER_R::new(((self.bits >> 15) & 1) != 0)
143    }
144    ///Bit 16 - Software Interrupt on line 16
145    #[inline(always)]
146    pub fn swier16(&self) -> SWIER_R {
147        SWIER_R::new(((self.bits >> 16) & 1) != 0)
148    }
149    ///Bit 17 - Software Interrupt on line 17
150    #[inline(always)]
151    pub fn swier17(&self) -> SWIER_R {
152        SWIER_R::new(((self.bits >> 17) & 1) != 0)
153    }
154    ///Bit 18 - Software Interrupt on line 18
155    #[inline(always)]
156    pub fn swier18(&self) -> SWIER_R {
157        SWIER_R::new(((self.bits >> 18) & 1) != 0)
158    }
159    ///Bit 19 - Software Interrupt on line 19
160    #[inline(always)]
161    pub fn swier19(&self) -> SWIER_R {
162        SWIER_R::new(((self.bits >> 19) & 1) != 0)
163    }
164}
165impl core::fmt::Debug for R {
166    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
167        f.debug_struct("SWIER")
168            .field("swier0", &self.swier0())
169            .field("swier1", &self.swier1())
170            .field("swier2", &self.swier2())
171            .field("swier3", &self.swier3())
172            .field("swier4", &self.swier4())
173            .field("swier5", &self.swier5())
174            .field("swier6", &self.swier6())
175            .field("swier7", &self.swier7())
176            .field("swier8", &self.swier8())
177            .field("swier9", &self.swier9())
178            .field("swier10", &self.swier10())
179            .field("swier11", &self.swier11())
180            .field("swier12", &self.swier12())
181            .field("swier13", &self.swier13())
182            .field("swier14", &self.swier14())
183            .field("swier15", &self.swier15())
184            .field("swier16", &self.swier16())
185            .field("swier17", &self.swier17())
186            .field("swier18", &self.swier18())
187            .field("swier19", &self.swier19())
188            .finish()
189    }
190}
191impl W {
192    ///Software Interrupt on line (0-19)
193    ///
194    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `SWIER0` field.</div>
195    #[inline(always)]
196    pub fn swier(&mut self, n: u8) -> SWIER_W<SWIERrs> {
197        #[allow(clippy::no_effect)] [(); 20][n as usize];
198        SWIER_W::new(self, n)
199    }
200    ///Bit 0 - Software Interrupt on line 0
201    #[inline(always)]
202    pub fn swier0(&mut self) -> SWIER_W<SWIERrs> {
203        SWIER_W::new(self, 0)
204    }
205    ///Bit 1 - Software Interrupt on line 1
206    #[inline(always)]
207    pub fn swier1(&mut self) -> SWIER_W<SWIERrs> {
208        SWIER_W::new(self, 1)
209    }
210    ///Bit 2 - Software Interrupt on line 2
211    #[inline(always)]
212    pub fn swier2(&mut self) -> SWIER_W<SWIERrs> {
213        SWIER_W::new(self, 2)
214    }
215    ///Bit 3 - Software Interrupt on line 3
216    #[inline(always)]
217    pub fn swier3(&mut self) -> SWIER_W<SWIERrs> {
218        SWIER_W::new(self, 3)
219    }
220    ///Bit 4 - Software Interrupt on line 4
221    #[inline(always)]
222    pub fn swier4(&mut self) -> SWIER_W<SWIERrs> {
223        SWIER_W::new(self, 4)
224    }
225    ///Bit 5 - Software Interrupt on line 5
226    #[inline(always)]
227    pub fn swier5(&mut self) -> SWIER_W<SWIERrs> {
228        SWIER_W::new(self, 5)
229    }
230    ///Bit 6 - Software Interrupt on line 6
231    #[inline(always)]
232    pub fn swier6(&mut self) -> SWIER_W<SWIERrs> {
233        SWIER_W::new(self, 6)
234    }
235    ///Bit 7 - Software Interrupt on line 7
236    #[inline(always)]
237    pub fn swier7(&mut self) -> SWIER_W<SWIERrs> {
238        SWIER_W::new(self, 7)
239    }
240    ///Bit 8 - Software Interrupt on line 8
241    #[inline(always)]
242    pub fn swier8(&mut self) -> SWIER_W<SWIERrs> {
243        SWIER_W::new(self, 8)
244    }
245    ///Bit 9 - Software Interrupt on line 9
246    #[inline(always)]
247    pub fn swier9(&mut self) -> SWIER_W<SWIERrs> {
248        SWIER_W::new(self, 9)
249    }
250    ///Bit 10 - Software Interrupt on line 10
251    #[inline(always)]
252    pub fn swier10(&mut self) -> SWIER_W<SWIERrs> {
253        SWIER_W::new(self, 10)
254    }
255    ///Bit 11 - Software Interrupt on line 11
256    #[inline(always)]
257    pub fn swier11(&mut self) -> SWIER_W<SWIERrs> {
258        SWIER_W::new(self, 11)
259    }
260    ///Bit 12 - Software Interrupt on line 12
261    #[inline(always)]
262    pub fn swier12(&mut self) -> SWIER_W<SWIERrs> {
263        SWIER_W::new(self, 12)
264    }
265    ///Bit 13 - Software Interrupt on line 13
266    #[inline(always)]
267    pub fn swier13(&mut self) -> SWIER_W<SWIERrs> {
268        SWIER_W::new(self, 13)
269    }
270    ///Bit 14 - Software Interrupt on line 14
271    #[inline(always)]
272    pub fn swier14(&mut self) -> SWIER_W<SWIERrs> {
273        SWIER_W::new(self, 14)
274    }
275    ///Bit 15 - Software Interrupt on line 15
276    #[inline(always)]
277    pub fn swier15(&mut self) -> SWIER_W<SWIERrs> {
278        SWIER_W::new(self, 15)
279    }
280    ///Bit 16 - Software Interrupt on line 16
281    #[inline(always)]
282    pub fn swier16(&mut self) -> SWIER_W<SWIERrs> {
283        SWIER_W::new(self, 16)
284    }
285    ///Bit 17 - Software Interrupt on line 17
286    #[inline(always)]
287    pub fn swier17(&mut self) -> SWIER_W<SWIERrs> {
288        SWIER_W::new(self, 17)
289    }
290    ///Bit 18 - Software Interrupt on line 18
291    #[inline(always)]
292    pub fn swier18(&mut self) -> SWIER_W<SWIERrs> {
293        SWIER_W::new(self, 18)
294    }
295    ///Bit 19 - Software Interrupt on line 19
296    #[inline(always)]
297    pub fn swier19(&mut self) -> SWIER_W<SWIERrs> {
298        SWIER_W::new(self, 19)
299    }
300}
301/**Software interrupt event register (EXTI_SWIER)
302
303You can [`read`](crate::Reg::read) this register and get [`swier::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`swier::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
304
305See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F107.html#EXTI:SWIER)*/
306pub struct SWIERrs;
307impl crate::RegisterSpec for SWIERrs {
308    type Ux = u32;
309}
310///`read()` method returns [`swier::R`](R) reader structure
311impl crate::Readable for SWIERrs {}
312///`write(|w| ..)` method takes [`swier::W`](W) writer structure
313impl crate::Writable for SWIERrs {
314    type Safety = crate::Unsafe;
315}
316///`reset()` method sets SWIER to value 0
317impl crate::Resettable for SWIERrs {}