stm32f1_staging/stm32f102/exti/
ftsr.rs

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