stm32f1_staging/stm32f103/can/
tsr.rs

1///Register `TSR` reader
2pub type R = crate::R<TSRrs>;
3///Register `TSR` writer
4pub type W = crate::W<TSRrs>;
5///Field `RQCP0` reader - RQCP0
6pub type RQCP0_R = crate::BitReader;
7///Field `RQCP0` writer - RQCP0
8pub type RQCP0_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `TXOK0` reader - TXOK0
10pub type TXOK0_R = crate::BitReader;
11///Field `TXOK0` writer - TXOK0
12pub type TXOK0_W<'a, REG> = crate::BitWriter<'a, REG>;
13///Field `ALST0` reader - ALST0
14pub type ALST0_R = crate::BitReader;
15///Field `ALST0` writer - ALST0
16pub type ALST0_W<'a, REG> = crate::BitWriter<'a, REG>;
17///Field `TERR0` reader - TERR0
18pub type TERR0_R = crate::BitReader;
19///Field `TERR0` writer - TERR0
20pub type TERR0_W<'a, REG> = crate::BitWriter<'a, REG>;
21///Field `ABRQ0` reader - ABRQ0
22pub type ABRQ0_R = crate::BitReader;
23///Field `ABRQ0` writer - ABRQ0
24pub type ABRQ0_W<'a, REG> = crate::BitWriter<'a, REG>;
25///Field `RQCP1` reader - RQCP1
26pub type RQCP1_R = crate::BitReader;
27///Field `RQCP1` writer - RQCP1
28pub type RQCP1_W<'a, REG> = crate::BitWriter<'a, REG>;
29///Field `TXOK1` reader - TXOK1
30pub type TXOK1_R = crate::BitReader;
31///Field `TXOK1` writer - TXOK1
32pub type TXOK1_W<'a, REG> = crate::BitWriter<'a, REG>;
33///Field `ALST1` reader - ALST1
34pub type ALST1_R = crate::BitReader;
35///Field `ALST1` writer - ALST1
36pub type ALST1_W<'a, REG> = crate::BitWriter<'a, REG>;
37///Field `TERR1` reader - TERR1
38pub type TERR1_R = crate::BitReader;
39///Field `TERR1` writer - TERR1
40pub type TERR1_W<'a, REG> = crate::BitWriter<'a, REG>;
41///Field `ABRQ1` reader - ABRQ1
42pub type ABRQ1_R = crate::BitReader;
43///Field `ABRQ1` writer - ABRQ1
44pub type ABRQ1_W<'a, REG> = crate::BitWriter<'a, REG>;
45///Field `RQCP2` reader - RQCP2
46pub type RQCP2_R = crate::BitReader;
47///Field `RQCP2` writer - RQCP2
48pub type RQCP2_W<'a, REG> = crate::BitWriter<'a, REG>;
49///Field `TXOK2` reader - TXOK2
50pub type TXOK2_R = crate::BitReader;
51///Field `TXOK2` writer - TXOK2
52pub type TXOK2_W<'a, REG> = crate::BitWriter<'a, REG>;
53///Field `ALST2` reader - ALST2
54pub type ALST2_R = crate::BitReader;
55///Field `ALST2` writer - ALST2
56pub type ALST2_W<'a, REG> = crate::BitWriter<'a, REG>;
57///Field `TERR2` reader - TERR2
58pub type TERR2_R = crate::BitReader;
59///Field `TERR2` writer - TERR2
60pub type TERR2_W<'a, REG> = crate::BitWriter<'a, REG>;
61///Field `ABRQ2` reader - ABRQ2
62pub type ABRQ2_R = crate::BitReader;
63///Field `ABRQ2` writer - ABRQ2
64pub type ABRQ2_W<'a, REG> = crate::BitWriter<'a, REG>;
65///Field `CODE` reader - CODE
66pub type CODE_R = crate::FieldReader;
67///Field `TME(0-2)` reader - Lowest priority flag for mailbox %s
68pub type TME_R = crate::BitReader;
69///Field `LOW(0-2)` reader - Lowest priority flag for mailbox %s
70pub type LOW_R = crate::BitReader;
71impl R {
72    ///Bit 0 - RQCP0
73    #[inline(always)]
74    pub fn rqcp0(&self) -> RQCP0_R {
75        RQCP0_R::new((self.bits & 1) != 0)
76    }
77    ///Bit 1 - TXOK0
78    #[inline(always)]
79    pub fn txok0(&self) -> TXOK0_R {
80        TXOK0_R::new(((self.bits >> 1) & 1) != 0)
81    }
82    ///Bit 2 - ALST0
83    #[inline(always)]
84    pub fn alst0(&self) -> ALST0_R {
85        ALST0_R::new(((self.bits >> 2) & 1) != 0)
86    }
87    ///Bit 3 - TERR0
88    #[inline(always)]
89    pub fn terr0(&self) -> TERR0_R {
90        TERR0_R::new(((self.bits >> 3) & 1) != 0)
91    }
92    ///Bit 7 - ABRQ0
93    #[inline(always)]
94    pub fn abrq0(&self) -> ABRQ0_R {
95        ABRQ0_R::new(((self.bits >> 7) & 1) != 0)
96    }
97    ///Bit 8 - RQCP1
98    #[inline(always)]
99    pub fn rqcp1(&self) -> RQCP1_R {
100        RQCP1_R::new(((self.bits >> 8) & 1) != 0)
101    }
102    ///Bit 9 - TXOK1
103    #[inline(always)]
104    pub fn txok1(&self) -> TXOK1_R {
105        TXOK1_R::new(((self.bits >> 9) & 1) != 0)
106    }
107    ///Bit 10 - ALST1
108    #[inline(always)]
109    pub fn alst1(&self) -> ALST1_R {
110        ALST1_R::new(((self.bits >> 10) & 1) != 0)
111    }
112    ///Bit 11 - TERR1
113    #[inline(always)]
114    pub fn terr1(&self) -> TERR1_R {
115        TERR1_R::new(((self.bits >> 11) & 1) != 0)
116    }
117    ///Bit 15 - ABRQ1
118    #[inline(always)]
119    pub fn abrq1(&self) -> ABRQ1_R {
120        ABRQ1_R::new(((self.bits >> 15) & 1) != 0)
121    }
122    ///Bit 16 - RQCP2
123    #[inline(always)]
124    pub fn rqcp2(&self) -> RQCP2_R {
125        RQCP2_R::new(((self.bits >> 16) & 1) != 0)
126    }
127    ///Bit 17 - TXOK2
128    #[inline(always)]
129    pub fn txok2(&self) -> TXOK2_R {
130        TXOK2_R::new(((self.bits >> 17) & 1) != 0)
131    }
132    ///Bit 18 - ALST2
133    #[inline(always)]
134    pub fn alst2(&self) -> ALST2_R {
135        ALST2_R::new(((self.bits >> 18) & 1) != 0)
136    }
137    ///Bit 19 - TERR2
138    #[inline(always)]
139    pub fn terr2(&self) -> TERR2_R {
140        TERR2_R::new(((self.bits >> 19) & 1) != 0)
141    }
142    ///Bit 23 - ABRQ2
143    #[inline(always)]
144    pub fn abrq2(&self) -> ABRQ2_R {
145        ABRQ2_R::new(((self.bits >> 23) & 1) != 0)
146    }
147    ///Bits 24:25 - CODE
148    #[inline(always)]
149    pub fn code(&self) -> CODE_R {
150        CODE_R::new(((self.bits >> 24) & 3) as u8)
151    }
152    ///Lowest priority flag for mailbox (0-2)
153    ///
154    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `TME0` field.</div>
155    #[inline(always)]
156    pub fn tme(&self, n: u8) -> TME_R {
157        #[allow(clippy::no_effect)] [(); 3][n as usize];
158        TME_R::new(((self.bits >> (n + 26)) & 1) != 0)
159    }
160    ///Iterator for array of:
161    ///Lowest priority flag for mailbox (0-2)
162    #[inline(always)]
163    pub fn tme_iter(&self) -> impl Iterator<Item = TME_R> + '_ {
164        (0..3).map(move |n| TME_R::new(((self.bits >> (n + 26)) & 1) != 0))
165    }
166    ///Bit 26 - Lowest priority flag for mailbox 0
167    #[inline(always)]
168    pub fn tme0(&self) -> TME_R {
169        TME_R::new(((self.bits >> 26) & 1) != 0)
170    }
171    ///Bit 27 - Lowest priority flag for mailbox 1
172    #[inline(always)]
173    pub fn tme1(&self) -> TME_R {
174        TME_R::new(((self.bits >> 27) & 1) != 0)
175    }
176    ///Bit 28 - Lowest priority flag for mailbox 2
177    #[inline(always)]
178    pub fn tme2(&self) -> TME_R {
179        TME_R::new(((self.bits >> 28) & 1) != 0)
180    }
181    ///Lowest priority flag for mailbox (0-2)
182    ///
183    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `LOW0` field.</div>
184    #[inline(always)]
185    pub fn low(&self, n: u8) -> LOW_R {
186        #[allow(clippy::no_effect)] [(); 3][n as usize];
187        LOW_R::new(((self.bits >> (n + 29)) & 1) != 0)
188    }
189    ///Iterator for array of:
190    ///Lowest priority flag for mailbox (0-2)
191    #[inline(always)]
192    pub fn low_iter(&self) -> impl Iterator<Item = LOW_R> + '_ {
193        (0..3).map(move |n| LOW_R::new(((self.bits >> (n + 29)) & 1) != 0))
194    }
195    ///Bit 29 - Lowest priority flag for mailbox 0
196    #[inline(always)]
197    pub fn low0(&self) -> LOW_R {
198        LOW_R::new(((self.bits >> 29) & 1) != 0)
199    }
200    ///Bit 30 - Lowest priority flag for mailbox 1
201    #[inline(always)]
202    pub fn low1(&self) -> LOW_R {
203        LOW_R::new(((self.bits >> 30) & 1) != 0)
204    }
205    ///Bit 31 - Lowest priority flag for mailbox 2
206    #[inline(always)]
207    pub fn low2(&self) -> LOW_R {
208        LOW_R::new(((self.bits >> 31) & 1) != 0)
209    }
210}
211impl core::fmt::Debug for R {
212    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
213        f.debug_struct("TSR")
214            .field("low0", &self.low0())
215            .field("low1", &self.low1())
216            .field("low2", &self.low2())
217            .field("tme0", &self.tme0())
218            .field("tme1", &self.tme1())
219            .field("tme2", &self.tme2())
220            .field("code", &self.code())
221            .field("abrq2", &self.abrq2())
222            .field("terr2", &self.terr2())
223            .field("alst2", &self.alst2())
224            .field("txok2", &self.txok2())
225            .field("rqcp2", &self.rqcp2())
226            .field("abrq1", &self.abrq1())
227            .field("terr1", &self.terr1())
228            .field("alst1", &self.alst1())
229            .field("txok1", &self.txok1())
230            .field("rqcp1", &self.rqcp1())
231            .field("abrq0", &self.abrq0())
232            .field("terr0", &self.terr0())
233            .field("alst0", &self.alst0())
234            .field("txok0", &self.txok0())
235            .field("rqcp0", &self.rqcp0())
236            .finish()
237    }
238}
239impl W {
240    ///Bit 0 - RQCP0
241    #[inline(always)]
242    pub fn rqcp0(&mut self) -> RQCP0_W<TSRrs> {
243        RQCP0_W::new(self, 0)
244    }
245    ///Bit 1 - TXOK0
246    #[inline(always)]
247    pub fn txok0(&mut self) -> TXOK0_W<TSRrs> {
248        TXOK0_W::new(self, 1)
249    }
250    ///Bit 2 - ALST0
251    #[inline(always)]
252    pub fn alst0(&mut self) -> ALST0_W<TSRrs> {
253        ALST0_W::new(self, 2)
254    }
255    ///Bit 3 - TERR0
256    #[inline(always)]
257    pub fn terr0(&mut self) -> TERR0_W<TSRrs> {
258        TERR0_W::new(self, 3)
259    }
260    ///Bit 7 - ABRQ0
261    #[inline(always)]
262    pub fn abrq0(&mut self) -> ABRQ0_W<TSRrs> {
263        ABRQ0_W::new(self, 7)
264    }
265    ///Bit 8 - RQCP1
266    #[inline(always)]
267    pub fn rqcp1(&mut self) -> RQCP1_W<TSRrs> {
268        RQCP1_W::new(self, 8)
269    }
270    ///Bit 9 - TXOK1
271    #[inline(always)]
272    pub fn txok1(&mut self) -> TXOK1_W<TSRrs> {
273        TXOK1_W::new(self, 9)
274    }
275    ///Bit 10 - ALST1
276    #[inline(always)]
277    pub fn alst1(&mut self) -> ALST1_W<TSRrs> {
278        ALST1_W::new(self, 10)
279    }
280    ///Bit 11 - TERR1
281    #[inline(always)]
282    pub fn terr1(&mut self) -> TERR1_W<TSRrs> {
283        TERR1_W::new(self, 11)
284    }
285    ///Bit 15 - ABRQ1
286    #[inline(always)]
287    pub fn abrq1(&mut self) -> ABRQ1_W<TSRrs> {
288        ABRQ1_W::new(self, 15)
289    }
290    ///Bit 16 - RQCP2
291    #[inline(always)]
292    pub fn rqcp2(&mut self) -> RQCP2_W<TSRrs> {
293        RQCP2_W::new(self, 16)
294    }
295    ///Bit 17 - TXOK2
296    #[inline(always)]
297    pub fn txok2(&mut self) -> TXOK2_W<TSRrs> {
298        TXOK2_W::new(self, 17)
299    }
300    ///Bit 18 - ALST2
301    #[inline(always)]
302    pub fn alst2(&mut self) -> ALST2_W<TSRrs> {
303        ALST2_W::new(self, 18)
304    }
305    ///Bit 19 - TERR2
306    #[inline(always)]
307    pub fn terr2(&mut self) -> TERR2_W<TSRrs> {
308        TERR2_W::new(self, 19)
309    }
310    ///Bit 23 - ABRQ2
311    #[inline(always)]
312    pub fn abrq2(&mut self) -> ABRQ2_W<TSRrs> {
313        ABRQ2_W::new(self, 23)
314    }
315}
316/**CAN_TSR
317
318You can [`read`](crate::Reg::read) this register and get [`tsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
319
320See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:TSR)*/
321pub struct TSRrs;
322impl crate::RegisterSpec for TSRrs {
323    type Ux = u32;
324}
325///`read()` method returns [`tsr::R`](R) reader structure
326impl crate::Readable for TSRrs {}
327///`write(|w| ..)` method takes [`tsr::W`](W) writer structure
328impl crate::Writable for TSRrs {
329    type Safety = crate::Unsafe;
330}
331///`reset()` method sets TSR to value 0
332impl crate::Resettable for TSRrs {}