stm32f2/stm32f217/exti/
rtsr.rs

1///Register `RTSR` reader
2pub type R = crate::R<RTSRrs>;
3///Register `RTSR` writer
4pub type W = crate::W<RTSRrs>;
5/**Rising trigger event configuration of line %s
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum RISING_TRIGGER {
11    ///0: Rising edge trigger is disabled
12    Disabled = 0,
13    ///1: Rising edge trigger is enabled
14    Enabled = 1,
15}
16impl From<RISING_TRIGGER> for bool {
17    #[inline(always)]
18    fn from(variant: RISING_TRIGGER) -> Self {
19        variant as u8 != 0
20    }
21}
22///Field `TR(0-22)` reader - Rising trigger event configuration of line %s
23pub type TR_R = crate::BitReader<RISING_TRIGGER>;
24impl TR_R {
25    ///Get enumerated values variant
26    #[inline(always)]
27    pub const fn variant(&self) -> RISING_TRIGGER {
28        match self.bits {
29            false => RISING_TRIGGER::Disabled,
30            true => RISING_TRIGGER::Enabled,
31        }
32    }
33    ///Rising edge trigger is disabled
34    #[inline(always)]
35    pub fn is_disabled(&self) -> bool {
36        *self == RISING_TRIGGER::Disabled
37    }
38    ///Rising edge trigger is enabled
39    #[inline(always)]
40    pub fn is_enabled(&self) -> bool {
41        *self == RISING_TRIGGER::Enabled
42    }
43}
44///Field `TR(0-22)` writer - Rising trigger event configuration of line %s
45pub type TR_W<'a, REG> = crate::BitWriter<'a, REG, RISING_TRIGGER>;
46impl<'a, REG> TR_W<'a, REG>
47where
48    REG: crate::Writable + crate::RegisterSpec,
49{
50    ///Rising edge trigger is disabled
51    #[inline(always)]
52    pub fn disabled(self) -> &'a mut crate::W<REG> {
53        self.variant(RISING_TRIGGER::Disabled)
54    }
55    ///Rising edge trigger is enabled
56    #[inline(always)]
57    pub fn enabled(self) -> &'a mut crate::W<REG> {
58        self.variant(RISING_TRIGGER::Enabled)
59    }
60}
61impl R {
62    ///Rising trigger event configuration of line (0-22)
63    ///
64    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TR0` field.</div>
65    #[inline(always)]
66    pub fn tr(&self, n: u8) -> TR_R {
67        #[allow(clippy::no_effect)]
68        [(); 23][n as usize];
69        TR_R::new(((self.bits >> n) & 1) != 0)
70    }
71    ///Iterator for array of:
72    ///Rising trigger event configuration of line (0-22)
73    #[inline(always)]
74    pub fn tr_iter(&self) -> impl Iterator<Item = TR_R> + '_ {
75        (0..23).map(move |n| TR_R::new(((self.bits >> n) & 1) != 0))
76    }
77    ///Bit 0 - Rising trigger event configuration of line 0
78    #[inline(always)]
79    pub fn tr0(&self) -> TR_R {
80        TR_R::new((self.bits & 1) != 0)
81    }
82    ///Bit 1 - Rising trigger event configuration of line 1
83    #[inline(always)]
84    pub fn tr1(&self) -> TR_R {
85        TR_R::new(((self.bits >> 1) & 1) != 0)
86    }
87    ///Bit 2 - Rising trigger event configuration of line 2
88    #[inline(always)]
89    pub fn tr2(&self) -> TR_R {
90        TR_R::new(((self.bits >> 2) & 1) != 0)
91    }
92    ///Bit 3 - Rising trigger event configuration of line 3
93    #[inline(always)]
94    pub fn tr3(&self) -> TR_R {
95        TR_R::new(((self.bits >> 3) & 1) != 0)
96    }
97    ///Bit 4 - Rising trigger event configuration of line 4
98    #[inline(always)]
99    pub fn tr4(&self) -> TR_R {
100        TR_R::new(((self.bits >> 4) & 1) != 0)
101    }
102    ///Bit 5 - Rising trigger event configuration of line 5
103    #[inline(always)]
104    pub fn tr5(&self) -> TR_R {
105        TR_R::new(((self.bits >> 5) & 1) != 0)
106    }
107    ///Bit 6 - Rising trigger event configuration of line 6
108    #[inline(always)]
109    pub fn tr6(&self) -> TR_R {
110        TR_R::new(((self.bits >> 6) & 1) != 0)
111    }
112    ///Bit 7 - Rising trigger event configuration of line 7
113    #[inline(always)]
114    pub fn tr7(&self) -> TR_R {
115        TR_R::new(((self.bits >> 7) & 1) != 0)
116    }
117    ///Bit 8 - Rising trigger event configuration of line 8
118    #[inline(always)]
119    pub fn tr8(&self) -> TR_R {
120        TR_R::new(((self.bits >> 8) & 1) != 0)
121    }
122    ///Bit 9 - Rising trigger event configuration of line 9
123    #[inline(always)]
124    pub fn tr9(&self) -> TR_R {
125        TR_R::new(((self.bits >> 9) & 1) != 0)
126    }
127    ///Bit 10 - Rising trigger event configuration of line 10
128    #[inline(always)]
129    pub fn tr10(&self) -> TR_R {
130        TR_R::new(((self.bits >> 10) & 1) != 0)
131    }
132    ///Bit 11 - Rising trigger event configuration of line 11
133    #[inline(always)]
134    pub fn tr11(&self) -> TR_R {
135        TR_R::new(((self.bits >> 11) & 1) != 0)
136    }
137    ///Bit 12 - Rising trigger event configuration of line 12
138    #[inline(always)]
139    pub fn tr12(&self) -> TR_R {
140        TR_R::new(((self.bits >> 12) & 1) != 0)
141    }
142    ///Bit 13 - Rising trigger event configuration of line 13
143    #[inline(always)]
144    pub fn tr13(&self) -> TR_R {
145        TR_R::new(((self.bits >> 13) & 1) != 0)
146    }
147    ///Bit 14 - Rising trigger event configuration of line 14
148    #[inline(always)]
149    pub fn tr14(&self) -> TR_R {
150        TR_R::new(((self.bits >> 14) & 1) != 0)
151    }
152    ///Bit 15 - Rising trigger event configuration of line 15
153    #[inline(always)]
154    pub fn tr15(&self) -> TR_R {
155        TR_R::new(((self.bits >> 15) & 1) != 0)
156    }
157    ///Bit 16 - Rising trigger event configuration of line 16
158    #[inline(always)]
159    pub fn tr16(&self) -> TR_R {
160        TR_R::new(((self.bits >> 16) & 1) != 0)
161    }
162    ///Bit 17 - Rising trigger event configuration of line 17
163    #[inline(always)]
164    pub fn tr17(&self) -> TR_R {
165        TR_R::new(((self.bits >> 17) & 1) != 0)
166    }
167    ///Bit 18 - Rising trigger event configuration of line 18
168    #[inline(always)]
169    pub fn tr18(&self) -> TR_R {
170        TR_R::new(((self.bits >> 18) & 1) != 0)
171    }
172    ///Bit 19 - Rising trigger event configuration of line 19
173    #[inline(always)]
174    pub fn tr19(&self) -> TR_R {
175        TR_R::new(((self.bits >> 19) & 1) != 0)
176    }
177    ///Bit 20 - Rising trigger event configuration of line 20
178    #[inline(always)]
179    pub fn tr20(&self) -> TR_R {
180        TR_R::new(((self.bits >> 20) & 1) != 0)
181    }
182    ///Bit 21 - Rising trigger event configuration of line 21
183    #[inline(always)]
184    pub fn tr21(&self) -> TR_R {
185        TR_R::new(((self.bits >> 21) & 1) != 0)
186    }
187    ///Bit 22 - Rising trigger event configuration of line 22
188    #[inline(always)]
189    pub fn tr22(&self) -> TR_R {
190        TR_R::new(((self.bits >> 22) & 1) != 0)
191    }
192}
193impl core::fmt::Debug for R {
194    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
195        f.debug_struct("RTSR")
196            .field("tr0", &self.tr0())
197            .field("tr1", &self.tr1())
198            .field("tr2", &self.tr2())
199            .field("tr3", &self.tr3())
200            .field("tr4", &self.tr4())
201            .field("tr5", &self.tr5())
202            .field("tr6", &self.tr6())
203            .field("tr7", &self.tr7())
204            .field("tr8", &self.tr8())
205            .field("tr9", &self.tr9())
206            .field("tr10", &self.tr10())
207            .field("tr11", &self.tr11())
208            .field("tr12", &self.tr12())
209            .field("tr13", &self.tr13())
210            .field("tr14", &self.tr14())
211            .field("tr15", &self.tr15())
212            .field("tr16", &self.tr16())
213            .field("tr17", &self.tr17())
214            .field("tr18", &self.tr18())
215            .field("tr19", &self.tr19())
216            .field("tr20", &self.tr20())
217            .field("tr21", &self.tr21())
218            .field("tr22", &self.tr22())
219            .finish()
220    }
221}
222impl W {
223    ///Rising trigger event configuration of line (0-22)
224    ///
225    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TR0` field.</div>
226    #[inline(always)]
227    pub fn tr(&mut self, n: u8) -> TR_W<RTSRrs> {
228        #[allow(clippy::no_effect)]
229        [(); 23][n as usize];
230        TR_W::new(self, n)
231    }
232    ///Bit 0 - Rising trigger event configuration of line 0
233    #[inline(always)]
234    pub fn tr0(&mut self) -> TR_W<RTSRrs> {
235        TR_W::new(self, 0)
236    }
237    ///Bit 1 - Rising trigger event configuration of line 1
238    #[inline(always)]
239    pub fn tr1(&mut self) -> TR_W<RTSRrs> {
240        TR_W::new(self, 1)
241    }
242    ///Bit 2 - Rising trigger event configuration of line 2
243    #[inline(always)]
244    pub fn tr2(&mut self) -> TR_W<RTSRrs> {
245        TR_W::new(self, 2)
246    }
247    ///Bit 3 - Rising trigger event configuration of line 3
248    #[inline(always)]
249    pub fn tr3(&mut self) -> TR_W<RTSRrs> {
250        TR_W::new(self, 3)
251    }
252    ///Bit 4 - Rising trigger event configuration of line 4
253    #[inline(always)]
254    pub fn tr4(&mut self) -> TR_W<RTSRrs> {
255        TR_W::new(self, 4)
256    }
257    ///Bit 5 - Rising trigger event configuration of line 5
258    #[inline(always)]
259    pub fn tr5(&mut self) -> TR_W<RTSRrs> {
260        TR_W::new(self, 5)
261    }
262    ///Bit 6 - Rising trigger event configuration of line 6
263    #[inline(always)]
264    pub fn tr6(&mut self) -> TR_W<RTSRrs> {
265        TR_W::new(self, 6)
266    }
267    ///Bit 7 - Rising trigger event configuration of line 7
268    #[inline(always)]
269    pub fn tr7(&mut self) -> TR_W<RTSRrs> {
270        TR_W::new(self, 7)
271    }
272    ///Bit 8 - Rising trigger event configuration of line 8
273    #[inline(always)]
274    pub fn tr8(&mut self) -> TR_W<RTSRrs> {
275        TR_W::new(self, 8)
276    }
277    ///Bit 9 - Rising trigger event configuration of line 9
278    #[inline(always)]
279    pub fn tr9(&mut self) -> TR_W<RTSRrs> {
280        TR_W::new(self, 9)
281    }
282    ///Bit 10 - Rising trigger event configuration of line 10
283    #[inline(always)]
284    pub fn tr10(&mut self) -> TR_W<RTSRrs> {
285        TR_W::new(self, 10)
286    }
287    ///Bit 11 - Rising trigger event configuration of line 11
288    #[inline(always)]
289    pub fn tr11(&mut self) -> TR_W<RTSRrs> {
290        TR_W::new(self, 11)
291    }
292    ///Bit 12 - Rising trigger event configuration of line 12
293    #[inline(always)]
294    pub fn tr12(&mut self) -> TR_W<RTSRrs> {
295        TR_W::new(self, 12)
296    }
297    ///Bit 13 - Rising trigger event configuration of line 13
298    #[inline(always)]
299    pub fn tr13(&mut self) -> TR_W<RTSRrs> {
300        TR_W::new(self, 13)
301    }
302    ///Bit 14 - Rising trigger event configuration of line 14
303    #[inline(always)]
304    pub fn tr14(&mut self) -> TR_W<RTSRrs> {
305        TR_W::new(self, 14)
306    }
307    ///Bit 15 - Rising trigger event configuration of line 15
308    #[inline(always)]
309    pub fn tr15(&mut self) -> TR_W<RTSRrs> {
310        TR_W::new(self, 15)
311    }
312    ///Bit 16 - Rising trigger event configuration of line 16
313    #[inline(always)]
314    pub fn tr16(&mut self) -> TR_W<RTSRrs> {
315        TR_W::new(self, 16)
316    }
317    ///Bit 17 - Rising trigger event configuration of line 17
318    #[inline(always)]
319    pub fn tr17(&mut self) -> TR_W<RTSRrs> {
320        TR_W::new(self, 17)
321    }
322    ///Bit 18 - Rising trigger event configuration of line 18
323    #[inline(always)]
324    pub fn tr18(&mut self) -> TR_W<RTSRrs> {
325        TR_W::new(self, 18)
326    }
327    ///Bit 19 - Rising trigger event configuration of line 19
328    #[inline(always)]
329    pub fn tr19(&mut self) -> TR_W<RTSRrs> {
330        TR_W::new(self, 19)
331    }
332    ///Bit 20 - Rising trigger event configuration of line 20
333    #[inline(always)]
334    pub fn tr20(&mut self) -> TR_W<RTSRrs> {
335        TR_W::new(self, 20)
336    }
337    ///Bit 21 - Rising trigger event configuration of line 21
338    #[inline(always)]
339    pub fn tr21(&mut self) -> TR_W<RTSRrs> {
340        TR_W::new(self, 21)
341    }
342    ///Bit 22 - Rising trigger event configuration of line 22
343    #[inline(always)]
344    pub fn tr22(&mut self) -> TR_W<RTSRrs> {
345        TR_W::new(self, 22)
346    }
347}
348/**Rising Trigger selection register (EXTI_RTSR)
349
350You can [`read`](crate::Reg::read) this register and get [`rtsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rtsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
351
352See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F217.html#EXTI:RTSR)*/
353pub struct RTSRrs;
354impl crate::RegisterSpec for RTSRrs {
355    type Ux = u32;
356}
357///`read()` method returns [`rtsr::R`](R) reader structure
358impl crate::Readable for RTSRrs {}
359///`write(|w| ..)` method takes [`rtsr::W`](W) writer structure
360impl crate::Writable for RTSRrs {
361    type Safety = crate::Unsafe;
362}
363///`reset()` method sets RTSR to value 0
364impl crate::Resettable for RTSRrs {}