stm32f1_staging/stm32f103/
can.rs

1#[repr(C)]
2#[derive(Debug)]
3///Register block
4pub struct RegisterBlock {
5    mcr: MCR,
6    msr: MSR,
7    tsr: TSR,
8    rfr: [RFR; 2],
9    ier: IER,
10    esr: ESR,
11    btr: BTR,
12    _reserved7: [u8; 0x0160],
13    tx: [TX; 3],
14    rx: [RX; 2],
15    _reserved9: [u8; 0x30],
16    fmr: FMR,
17    fm1r: FM1R,
18    _reserved11: [u8; 0x04],
19    fs1r: FS1R,
20    _reserved12: [u8; 0x04],
21    ffa1r: FFA1R,
22    _reserved13: [u8; 0x04],
23    fa1r: FA1R,
24    _reserved14: [u8; 0x20],
25    fb: [FB; 14],
26}
27impl RegisterBlock {
28    ///0x00 - CAN_MCR
29    #[inline(always)]
30    pub const fn mcr(&self) -> &MCR {
31        &self.mcr
32    }
33    ///0x04 - CAN_MSR
34    #[inline(always)]
35    pub const fn msr(&self) -> &MSR {
36        &self.msr
37    }
38    ///0x08 - CAN_TSR
39    #[inline(always)]
40    pub const fn tsr(&self) -> &TSR {
41        &self.tsr
42    }
43    ///0x0c..0x14 - CAN_RF%sR
44    #[inline(always)]
45    pub const fn rfr(&self, n: usize) -> &RFR {
46        &self.rfr[n]
47    }
48    ///Iterator for array of:
49    ///0x0c..0x14 - CAN_RF%sR
50    #[inline(always)]
51    pub fn rfr_iter(&self) -> impl Iterator<Item = &RFR> {
52        self.rfr.iter()
53    }
54    ///0x0c - CAN_RF0R
55    #[inline(always)]
56    pub const fn rf0r(&self) -> &RFR {
57        self.rfr(0)
58    }
59    ///0x10 - CAN_RF1R
60    #[inline(always)]
61    pub const fn rf1r(&self) -> &RFR {
62        self.rfr(1)
63    }
64    ///0x14 - CAN_IER
65    #[inline(always)]
66    pub const fn ier(&self) -> &IER {
67        &self.ier
68    }
69    ///0x18 - CAN_ESR
70    #[inline(always)]
71    pub const fn esr(&self) -> &ESR {
72        &self.esr
73    }
74    ///0x1c - CAN_BTR
75    #[inline(always)]
76    pub const fn btr(&self) -> &BTR {
77        &self.btr
78    }
79    ///0x180..0x1b0 - CAN Transmit cluster
80    #[inline(always)]
81    pub const fn tx(&self, n: usize) -> &TX {
82        &self.tx[n]
83    }
84    ///Iterator for array of:
85    ///0x180..0x1b0 - CAN Transmit cluster
86    #[inline(always)]
87    pub fn tx_iter(&self) -> impl Iterator<Item = &TX> {
88        self.tx.iter()
89    }
90    ///0x1b0..0x1d0 - CAN Receive cluster
91    #[inline(always)]
92    pub const fn rx(&self, n: usize) -> &RX {
93        &self.rx[n]
94    }
95    ///Iterator for array of:
96    ///0x1b0..0x1d0 - CAN Receive cluster
97    #[inline(always)]
98    pub fn rx_iter(&self) -> impl Iterator<Item = &RX> {
99        self.rx.iter()
100    }
101    ///0x200 - CAN_FMR
102    #[inline(always)]
103    pub const fn fmr(&self) -> &FMR {
104        &self.fmr
105    }
106    ///0x204 - CAN_FM1R
107    #[inline(always)]
108    pub const fn fm1r(&self) -> &FM1R {
109        &self.fm1r
110    }
111    ///0x20c - CAN_FS1R
112    #[inline(always)]
113    pub const fn fs1r(&self) -> &FS1R {
114        &self.fs1r
115    }
116    ///0x214 - CAN_FFA1R
117    #[inline(always)]
118    pub const fn ffa1r(&self) -> &FFA1R {
119        &self.ffa1r
120    }
121    ///0x21c - CAN_FA1R
122    #[inline(always)]
123    pub const fn fa1r(&self) -> &FA1R {
124        &self.fa1r
125    }
126    ///0x240..0x2b0 - CAN Filter Bank cluster
127    #[inline(always)]
128    pub const fn fb(&self, n: usize) -> &FB {
129        &self.fb[n]
130    }
131    ///Iterator for array of:
132    ///0x240..0x2b0 - CAN Filter Bank cluster
133    #[inline(always)]
134    pub fn fb_iter(&self) -> impl Iterator<Item = &FB> {
135        self.fb.iter()
136    }
137}
138/**MCR (rw) register accessor: CAN_MCR
139
140You can [`read`](crate::Reg::read) this register and get [`mcr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mcr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
141
142See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:MCR)
143
144For information about available fields see [`mod@mcr`] module*/
145pub type MCR = crate::Reg<mcr::MCRrs>;
146///CAN_MCR
147pub mod mcr;
148/**MSR (rw) register accessor: CAN_MSR
149
150You can [`read`](crate::Reg::read) this register and get [`msr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`msr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
151
152See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:MSR)
153
154For information about available fields see [`mod@msr`] module*/
155pub type MSR = crate::Reg<msr::MSRrs>;
156///CAN_MSR
157pub mod msr;
158/**TSR (rw) register accessor: CAN_TSR
159
160You can [`read`](crate::Reg::read) this register and get [`tsr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tsr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
161
162See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:TSR)
163
164For information about available fields see [`mod@tsr`] module*/
165pub type TSR = crate::Reg<tsr::TSRrs>;
166///CAN_TSR
167pub mod tsr;
168/**RFR (rw) register accessor: CAN_RF%sR
169
170You can [`read`](crate::Reg::read) this register and get [`rfr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`rfr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
171
172See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:RF[0]R)
173
174For information about available fields see [`mod@rfr`] module*/
175pub type RFR = crate::Reg<rfr::RFRrs>;
176///CAN_RF%sR
177pub mod rfr;
178/**IER (rw) register accessor: CAN_IER
179
180You can [`read`](crate::Reg::read) this register and get [`ier::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ier::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
181
182See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:IER)
183
184For information about available fields see [`mod@ier`] module*/
185pub type IER = crate::Reg<ier::IERrs>;
186///CAN_IER
187pub mod ier;
188/**ESR (rw) register accessor: CAN_ESR
189
190You can [`read`](crate::Reg::read) this register and get [`esr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`esr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
191
192See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:ESR)
193
194For information about available fields see [`mod@esr`] module*/
195pub type ESR = crate::Reg<esr::ESRrs>;
196///CAN_ESR
197pub mod esr;
198/**BTR (rw) register accessor: CAN_BTR
199
200You can [`read`](crate::Reg::read) this register and get [`btr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`btr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
201
202See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:BTR)
203
204For information about available fields see [`mod@btr`] module*/
205pub type BTR = crate::Reg<btr::BTRrs>;
206///CAN_BTR
207pub mod btr;
208///CAN Transmit cluster
209pub use self::tx::TX;
210///Cluster
211///CAN Transmit cluster
212pub mod tx;
213///CAN Receive cluster
214pub use self::rx::RX;
215///Cluster
216///CAN Receive cluster
217pub mod rx;
218/**FMR (rw) register accessor: CAN_FMR
219
220You can [`read`](crate::Reg::read) this register and get [`fmr::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fmr::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
221
222See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:FMR)
223
224For information about available fields see [`mod@fmr`] module*/
225pub type FMR = crate::Reg<fmr::FMRrs>;
226///CAN_FMR
227pub mod fmr;
228/**FM1R (rw) register accessor: CAN_FM1R
229
230You can [`read`](crate::Reg::read) this register and get [`fm1r::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fm1r::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
231
232See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:FM1R)
233
234For information about available fields see [`mod@fm1r`] module*/
235pub type FM1R = crate::Reg<fm1r::FM1Rrs>;
236///CAN_FM1R
237pub mod fm1r;
238/**FS1R (rw) register accessor: CAN_FS1R
239
240You can [`read`](crate::Reg::read) this register and get [`fs1r::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fs1r::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
241
242See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:FS1R)
243
244For information about available fields see [`mod@fs1r`] module*/
245pub type FS1R = crate::Reg<fs1r::FS1Rrs>;
246///CAN_FS1R
247pub mod fs1r;
248/**FFA1R (rw) register accessor: CAN_FFA1R
249
250You can [`read`](crate::Reg::read) this register and get [`ffa1r::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ffa1r::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
251
252See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:FFA1R)
253
254For information about available fields see [`mod@ffa1r`] module*/
255pub type FFA1R = crate::Reg<ffa1r::FFA1Rrs>;
256///CAN_FFA1R
257pub mod ffa1r;
258/**FA1R (rw) register accessor: CAN_FA1R
259
260You can [`read`](crate::Reg::read) this register and get [`fa1r::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fa1r::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
261
262See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F103.html#CAN:FA1R)
263
264For information about available fields see [`mod@fa1r`] module*/
265pub type FA1R = crate::Reg<fa1r::FA1Rrs>;
266///CAN_FA1R
267pub mod fa1r;
268///CAN Filter Bank cluster
269pub use self::fb::FB;
270///Cluster
271///CAN Filter Bank cluster
272pub mod fb;