stm32f4/stm32f407/can1/
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)]
158        [(); 3][n as usize];
159        TME_R::new(((self.bits >> (n + 26)) & 1) != 0)
160    }
161    ///Iterator for array of:
162    ///Lowest priority flag for mailbox (0-2)
163    #[inline(always)]
164    pub fn tme_iter(&self) -> impl Iterator<Item = TME_R> + '_ {
165        (0..3).map(move |n| TME_R::new(((self.bits >> (n + 26)) & 1) != 0))
166    }
167    ///Bit 26 - Lowest priority flag for mailbox 0
168    #[inline(always)]
169    pub fn tme0(&self) -> TME_R {
170        TME_R::new(((self.bits >> 26) & 1) != 0)
171    }
172    ///Bit 27 - Lowest priority flag for mailbox 1
173    #[inline(always)]
174    pub fn tme1(&self) -> TME_R {
175        TME_R::new(((self.bits >> 27) & 1) != 0)
176    }
177    ///Bit 28 - Lowest priority flag for mailbox 2
178    #[inline(always)]
179    pub fn tme2(&self) -> TME_R {
180        TME_R::new(((self.bits >> 28) & 1) != 0)
181    }
182    ///Lowest priority flag for mailbox (0-2)
183    ///
184    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `LOW0` field.</div>
185    #[inline(always)]
186    pub fn low(&self, n: u8) -> LOW_R {
187        #[allow(clippy::no_effect)]
188        [(); 3][n as usize];
189        LOW_R::new(((self.bits >> (n + 29)) & 1) != 0)
190    }
191    ///Iterator for array of:
192    ///Lowest priority flag for mailbox (0-2)
193    #[inline(always)]
194    pub fn low_iter(&self) -> impl Iterator<Item = LOW_R> + '_ {
195        (0..3).map(move |n| LOW_R::new(((self.bits >> (n + 29)) & 1) != 0))
196    }
197    ///Bit 29 - Lowest priority flag for mailbox 0
198    #[inline(always)]
199    pub fn low0(&self) -> LOW_R {
200        LOW_R::new(((self.bits >> 29) & 1) != 0)
201    }
202    ///Bit 30 - Lowest priority flag for mailbox 1
203    #[inline(always)]
204    pub fn low1(&self) -> LOW_R {
205        LOW_R::new(((self.bits >> 30) & 1) != 0)
206    }
207    ///Bit 31 - Lowest priority flag for mailbox 2
208    #[inline(always)]
209    pub fn low2(&self) -> LOW_R {
210        LOW_R::new(((self.bits >> 31) & 1) != 0)
211    }
212}
213impl core::fmt::Debug for R {
214    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
215        f.debug_struct("TSR")
216            .field("low0", &self.low0())
217            .field("low1", &self.low1())
218            .field("low2", &self.low2())
219            .field("tme0", &self.tme0())
220            .field("tme1", &self.tme1())
221            .field("tme2", &self.tme2())
222            .field("code", &self.code())
223            .field("abrq2", &self.abrq2())
224            .field("terr2", &self.terr2())
225            .field("alst2", &self.alst2())
226            .field("txok2", &self.txok2())
227            .field("rqcp2", &self.rqcp2())
228            .field("abrq1", &self.abrq1())
229            .field("terr1", &self.terr1())
230            .field("alst1", &self.alst1())
231            .field("txok1", &self.txok1())
232            .field("rqcp1", &self.rqcp1())
233            .field("abrq0", &self.abrq0())
234            .field("terr0", &self.terr0())
235            .field("alst0", &self.alst0())
236            .field("txok0", &self.txok0())
237            .field("rqcp0", &self.rqcp0())
238            .finish()
239    }
240}
241impl W {
242    ///Bit 0 - RQCP0
243    #[inline(always)]
244    pub fn rqcp0(&mut self) -> RQCP0_W<TSRrs> {
245        RQCP0_W::new(self, 0)
246    }
247    ///Bit 1 - TXOK0
248    #[inline(always)]
249    pub fn txok0(&mut self) -> TXOK0_W<TSRrs> {
250        TXOK0_W::new(self, 1)
251    }
252    ///Bit 2 - ALST0
253    #[inline(always)]
254    pub fn alst0(&mut self) -> ALST0_W<TSRrs> {
255        ALST0_W::new(self, 2)
256    }
257    ///Bit 3 - TERR0
258    #[inline(always)]
259    pub fn terr0(&mut self) -> TERR0_W<TSRrs> {
260        TERR0_W::new(self, 3)
261    }
262    ///Bit 7 - ABRQ0
263    #[inline(always)]
264    pub fn abrq0(&mut self) -> ABRQ0_W<TSRrs> {
265        ABRQ0_W::new(self, 7)
266    }
267    ///Bit 8 - RQCP1
268    #[inline(always)]
269    pub fn rqcp1(&mut self) -> RQCP1_W<TSRrs> {
270        RQCP1_W::new(self, 8)
271    }
272    ///Bit 9 - TXOK1
273    #[inline(always)]
274    pub fn txok1(&mut self) -> TXOK1_W<TSRrs> {
275        TXOK1_W::new(self, 9)
276    }
277    ///Bit 10 - ALST1
278    #[inline(always)]
279    pub fn alst1(&mut self) -> ALST1_W<TSRrs> {
280        ALST1_W::new(self, 10)
281    }
282    ///Bit 11 - TERR1
283    #[inline(always)]
284    pub fn terr1(&mut self) -> TERR1_W<TSRrs> {
285        TERR1_W::new(self, 11)
286    }
287    ///Bit 15 - ABRQ1
288    #[inline(always)]
289    pub fn abrq1(&mut self) -> ABRQ1_W<TSRrs> {
290        ABRQ1_W::new(self, 15)
291    }
292    ///Bit 16 - RQCP2
293    #[inline(always)]
294    pub fn rqcp2(&mut self) -> RQCP2_W<TSRrs> {
295        RQCP2_W::new(self, 16)
296    }
297    ///Bit 17 - TXOK2
298    #[inline(always)]
299    pub fn txok2(&mut self) -> TXOK2_W<TSRrs> {
300        TXOK2_W::new(self, 17)
301    }
302    ///Bit 18 - ALST2
303    #[inline(always)]
304    pub fn alst2(&mut self) -> ALST2_W<TSRrs> {
305        ALST2_W::new(self, 18)
306    }
307    ///Bit 19 - TERR2
308    #[inline(always)]
309    pub fn terr2(&mut self) -> TERR2_W<TSRrs> {
310        TERR2_W::new(self, 19)
311    }
312    ///Bit 23 - ABRQ2
313    #[inline(always)]
314    pub fn abrq2(&mut self) -> ABRQ2_W<TSRrs> {
315        ABRQ2_W::new(self, 23)
316    }
317}
318/**transmit status register
319
320You 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).
321
322See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F407.html#CAN1:TSR)*/
323pub struct TSRrs;
324impl crate::RegisterSpec for TSRrs {
325    type Ux = u32;
326}
327///`read()` method returns [`tsr::R`](R) reader structure
328impl crate::Readable for TSRrs {}
329///`write(|w| ..)` method takes [`tsr::W`](W) writer structure
330impl crate::Writable for TSRrs {
331    type Safety = crate::Unsafe;
332}
333///`reset()` method sets TSR to value 0x1c00_0000
334impl crate::Resettable for TSRrs {
335    const RESET_VALUE: u32 = 0x1c00_0000;
336}