aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Schuhen <[email protected]>2024-06-02 21:45:35 +1000
committerCorey Schuhen <[email protected]>2024-06-02 21:47:14 +1000
commit900b1048606989bd3c8aba69b1488611d15ed64d (patch)
tree3d2994783c74b7b5e0f3b8d8cfebb1516253057e
parent5f8f867eae57ca313157f2df60d9c0b5355907ce (diff)
Remove generic argument from CanBuilder.
-rw-r--r--embassy-stm32/src/can/fd/peripheral.rs53
-rw-r--r--embassy-stm32/src/can/fdcan.rs50
2 files changed, 46 insertions, 57 deletions
diff --git a/embassy-stm32/src/can/fd/peripheral.rs b/embassy-stm32/src/can/fd/peripheral.rs
index 7321ab230..07e3dddad 100644
--- a/embassy-stm32/src/can/fd/peripheral.rs
+++ b/embassy-stm32/src/can/fd/peripheral.rs
@@ -73,7 +73,6 @@ impl Registers {
73 73
74 pub fn put_tx_frame(&self, bufidx: usize, header: &Header, buffer: &[u8]) { 74 pub fn put_tx_frame(&self, bufidx: usize, header: &Header, buffer: &[u8]) {
75 let mailbox = self.tx_buffer_element(bufidx); 75 let mailbox = self.tx_buffer_element(bufidx);
76
77 mailbox.reset(); 76 mailbox.reset();
78 put_tx_header(mailbox, header); 77 put_tx_header(mailbox, header);
79 put_tx_data(mailbox, &buffer[..header.len() as usize]); 78 put_tx_data(mailbox, &buffer[..header.len() as usize]);
@@ -245,12 +244,12 @@ impl Registers {
245 } 244 }
246 245
247 #[inline] 246 #[inline]
248 fn reset_msg_ram(&mut self) { 247 fn reset_msg_ram(&self) {
249 self.msg_ram_mut().reset(); 248 self.msg_ram_mut().reset();
250 } 249 }
251 250
252 #[inline] 251 #[inline]
253 fn enter_init_mode(&mut self) { 252 fn enter_init_mode(&self) {
254 self.regs.cccr().modify(|w| w.set_init(true)); 253 self.regs.cccr().modify(|w| w.set_init(true));
255 while false == self.regs.cccr().read().init() {} 254 while false == self.regs.cccr().read().init() {}
256 self.regs.cccr().modify(|w| w.set_cce(true)); 255 self.regs.cccr().modify(|w| w.set_cce(true));
@@ -259,7 +258,7 @@ impl Registers {
259 /// Enables or disables loopback mode: Internally connects the TX and RX 258 /// Enables or disables loopback mode: Internally connects the TX and RX
260 /// signals together. 259 /// signals together.
261 #[inline] 260 #[inline]
262 fn set_loopback_mode(&mut self, mode: LoopbackMode) { 261 fn set_loopback_mode(&self, mode: LoopbackMode) {
263 let (test, mon, lbck) = match mode { 262 let (test, mon, lbck) = match mode {
264 LoopbackMode::None => (false, false, false), 263 LoopbackMode::None => (false, false, false),
265 LoopbackMode::Internal => (true, true, true), 264 LoopbackMode::Internal => (true, true, true),
@@ -274,34 +273,34 @@ impl Registers {
274 273
275 /// Enables or disables silent mode: Disconnects the TX signal from the pin. 274 /// Enables or disables silent mode: Disconnects the TX signal from the pin.
276 #[inline] 275 #[inline]
277 fn set_bus_monitoring_mode(&mut self, enabled: bool) { 276 fn set_bus_monitoring_mode(&self, enabled: bool) {
278 self.regs.cccr().modify(|w| w.set_mon(enabled)); 277 self.regs.cccr().modify(|w| w.set_mon(enabled));
279 } 278 }
280 279
281 #[inline] 280 #[inline]
282 fn set_restricted_operations(&mut self, enabled: bool) { 281 fn set_restricted_operations(&self, enabled: bool) {
283 self.regs.cccr().modify(|w| w.set_asm(enabled)); 282 self.regs.cccr().modify(|w| w.set_asm(enabled));
284 } 283 }
285 284
286 #[inline] 285 #[inline]
287 fn set_normal_operations(&mut self, _enabled: bool) { 286 fn set_normal_operations(&self, _enabled: bool) {
288 self.set_loopback_mode(LoopbackMode::None); 287 self.set_loopback_mode(LoopbackMode::None);
289 } 288 }
290 289
291 #[inline] 290 #[inline]
292 fn set_test_mode(&mut self, enabled: bool) { 291 fn set_test_mode(&self, enabled: bool) {
293 self.regs.cccr().modify(|w| w.set_test(enabled)); 292 self.regs.cccr().modify(|w| w.set_test(enabled));
294 } 293 }
295 294
296 #[inline] 295 #[inline]
297 fn set_power_down_mode(&mut self, enabled: bool) { 296 fn set_power_down_mode(&self, enabled: bool) {
298 self.regs.cccr().modify(|w| w.set_csr(enabled)); 297 self.regs.cccr().modify(|w| w.set_csr(enabled));
299 while self.regs.cccr().read().csa() != enabled {} 298 while self.regs.cccr().read().csa() != enabled {}
300 } 299 }
301 300
302 /// Moves out of PoweredDownMode and into ConfigMode 301 /// Moves out of PoweredDownMode and into ConfigMode
303 #[inline] 302 #[inline]
304 pub fn into_config_mode(mut self, _config: FdCanConfig) { 303 pub fn into_config_mode(self, _config: FdCanConfig) {
305 self.set_power_down_mode(false); 304 self.set_power_down_mode(false);
306 self.enter_init_mode(); 305 self.enter_init_mode();
307 self.reset_msg_ram(); 306 self.reset_msg_ram();
@@ -328,7 +327,7 @@ impl Registers {
328 327
329 /// Applies the settings of a new FdCanConfig See [`FdCanConfig`] 328 /// Applies the settings of a new FdCanConfig See [`FdCanConfig`]
330 #[inline] 329 #[inline]
331 pub fn apply_config(&mut self, config: FdCanConfig) { 330 pub fn apply_config(&self, config: FdCanConfig) {
332 self.set_tx_buffer_mode(config.tx_buffer_mode); 331 self.set_tx_buffer_mode(config.tx_buffer_mode);
333 332
334 // set standard filters list size to 28 333 // set standard filters list size to 28
@@ -389,7 +388,7 @@ impl Registers {
389 } 388 }
390 389
391 #[inline] 390 #[inline]
392 fn leave_init_mode(&mut self, config: FdCanConfig) { 391 fn leave_init_mode(&self, config: FdCanConfig) {
393 self.apply_config(config); 392 self.apply_config(config);
394 393
395 self.regs.cccr().modify(|w| w.set_cce(false)); 394 self.regs.cccr().modify(|w| w.set_cce(false));
@@ -399,7 +398,7 @@ impl Registers {
399 398
400 /// Moves out of ConfigMode and into specified mode 399 /// Moves out of ConfigMode and into specified mode
401 #[inline] 400 #[inline]
402 pub fn into_mode(mut self, config: FdCanConfig, mode: crate::can::_version::OperatingMode) { 401 pub fn into_mode(&self, config: FdCanConfig, mode: crate::can::_version::OperatingMode) {
403 match mode { 402 match mode {
404 crate::can::OperatingMode::InternalLoopbackMode => self.set_loopback_mode(LoopbackMode::Internal), 403 crate::can::OperatingMode::InternalLoopbackMode => self.set_loopback_mode(LoopbackMode::Internal),
405 crate::can::OperatingMode::ExternalLoopbackMode => self.set_loopback_mode(LoopbackMode::External), 404 crate::can::OperatingMode::ExternalLoopbackMode => self.set_loopback_mode(LoopbackMode::External),
@@ -423,7 +422,7 @@ impl Registers {
423 /// Then copy the `CAN_BUS_TIME` register value from the table and pass it as the `btr` 422 /// Then copy the `CAN_BUS_TIME` register value from the table and pass it as the `btr`
424 /// parameter to this method. 423 /// parameter to this method.
425 #[inline] 424 #[inline]
426 pub fn set_nominal_bit_timing(&mut self, btr: NominalBitTiming) { 425 pub fn set_nominal_bit_timing(&self, btr: NominalBitTiming) {
427 self.regs.nbtp().write(|w| { 426 self.regs.nbtp().write(|w| {
428 w.set_nbrp(btr.nbrp() - 1); 427 w.set_nbrp(btr.nbrp() - 1);
429 w.set_ntseg1(btr.ntseg1() - 1); 428 w.set_ntseg1(btr.ntseg1() - 1);
@@ -435,7 +434,7 @@ impl Registers {
435 /// Configures the data bit timings for the FdCan Variable Bitrates. 434 /// Configures the data bit timings for the FdCan Variable Bitrates.
436 /// This is not used when frame_transmit is set to anything other than AllowFdCanAndBRS. 435 /// This is not used when frame_transmit is set to anything other than AllowFdCanAndBRS.
437 #[inline] 436 #[inline]
438 pub fn set_data_bit_timing(&mut self, btr: DataBitTiming) { 437 pub fn set_data_bit_timing(&self, btr: DataBitTiming) {
439 self.regs.dbtp().write(|w| { 438 self.regs.dbtp().write(|w| {
440 w.set_dbrp(btr.dbrp() - 1); 439 w.set_dbrp(btr.dbrp() - 1);
441 w.set_dtseg1(btr.dtseg1() - 1); 440 w.set_dtseg1(btr.dtseg1() - 1);
@@ -451,39 +450,39 @@ impl Registers {
451 /// 450 ///
452 /// Automatic retransmission is enabled by default. 451 /// Automatic retransmission is enabled by default.
453 #[inline] 452 #[inline]
454 pub fn set_automatic_retransmit(&mut self, enabled: bool) { 453 pub fn set_automatic_retransmit(&self, enabled: bool) {
455 self.regs.cccr().modify(|w| w.set_dar(!enabled)); 454 self.regs.cccr().modify(|w| w.set_dar(!enabled));
456 } 455 }
457 456
458 /// Configures the transmit pause feature. See 457 /// Configures the transmit pause feature. See
459 /// [`FdCanConfig::set_transmit_pause`] 458 /// [`FdCanConfig::set_transmit_pause`]
460 #[inline] 459 #[inline]
461 pub fn set_transmit_pause(&mut self, enabled: bool) { 460 pub fn set_transmit_pause(&self, enabled: bool) {
462 self.regs.cccr().modify(|w| w.set_txp(!enabled)); 461 self.regs.cccr().modify(|w| w.set_txp(!enabled));
463 } 462 }
464 463
465 /// Configures non-iso mode. See [`FdCanConfig::set_non_iso_mode`] 464 /// Configures non-iso mode. See [`FdCanConfig::set_non_iso_mode`]
466 #[inline] 465 #[inline]
467 pub fn set_non_iso_mode(&mut self, enabled: bool) { 466 pub fn set_non_iso_mode(&self, enabled: bool) {
468 self.regs.cccr().modify(|w| w.set_niso(enabled)); 467 self.regs.cccr().modify(|w| w.set_niso(enabled));
469 } 468 }
470 469
471 /// Configures edge filtering. See [`FdCanConfig::set_edge_filtering`] 470 /// Configures edge filtering. See [`FdCanConfig::set_edge_filtering`]
472 #[inline] 471 #[inline]
473 pub fn set_edge_filtering(&mut self, enabled: bool) { 472 pub fn set_edge_filtering(&self, enabled: bool) {
474 self.regs.cccr().modify(|w| w.set_efbi(enabled)); 473 self.regs.cccr().modify(|w| w.set_efbi(enabled));
475 } 474 }
476 475
477 /// Configures TX Buffer Mode 476 /// Configures TX Buffer Mode
478 #[inline] 477 #[inline]
479 pub fn set_tx_buffer_mode(&mut self, tbm: TxBufferMode) { 478 pub fn set_tx_buffer_mode(&self, tbm: TxBufferMode) {
480 self.regs.txbc().write(|w| w.set_tfqm(tbm.into())); 479 self.regs.txbc().write(|w| w.set_tfqm(tbm.into()));
481 } 480 }
482 481
483 /// Configures frame transmission mode. See 482 /// Configures frame transmission mode. See
484 /// [`FdCanConfig::set_frame_transmit`] 483 /// [`FdCanConfig::set_frame_transmit`]
485 #[inline] 484 #[inline]
486 pub fn set_frame_transmit(&mut self, fts: FrameTransmissionConfig) { 485 pub fn set_frame_transmit(&self, fts: FrameTransmissionConfig) {
487 let (fdoe, brse) = match fts { 486 let (fdoe, brse) = match fts {
488 FrameTransmissionConfig::ClassicCanOnly => (false, false), 487 FrameTransmissionConfig::ClassicCanOnly => (false, false),
489 FrameTransmissionConfig::AllowFdCan => (true, false), 488 FrameTransmissionConfig::AllowFdCan => (true, false),
@@ -501,14 +500,14 @@ impl Registers {
501 500
502 /// Sets the protocol exception handling on/off 501 /// Sets the protocol exception handling on/off
503 #[inline] 502 #[inline]
504 pub fn set_protocol_exception_handling(&mut self, enabled: bool) { 503 pub fn set_protocol_exception_handling(&self, enabled: bool) {
505 self.regs.cccr().modify(|w| w.set_pxhd(!enabled)); 504 self.regs.cccr().modify(|w| w.set_pxhd(!enabled));
506 } 505 }
507 506
508 /// Configures and resets the timestamp counter 507 /// Configures and resets the timestamp counter
509 #[inline] 508 #[inline]
510 #[allow(unused)] 509 #[allow(unused)]
511 pub fn set_timestamp_counter_source(&mut self, select: TimestampSource) { 510 pub fn set_timestamp_counter_source(&self, select: TimestampSource) {
512 #[cfg(can_fdcan_h7)] 511 #[cfg(can_fdcan_h7)]
513 let (tcp, tss) = match select { 512 let (tcp, tss) = match select {
514 TimestampSource::None => (0, 0), 513 TimestampSource::None => (0, 0),
@@ -532,7 +531,7 @@ impl Registers {
532 #[cfg(not(can_fdcan_h7))] 531 #[cfg(not(can_fdcan_h7))]
533 /// Configures the global filter settings 532 /// Configures the global filter settings
534 #[inline] 533 #[inline]
535 pub fn set_global_filter(&mut self, filter: GlobalFilter) { 534 pub fn set_global_filter(&self, filter: GlobalFilter) {
536 let anfs = match filter.handle_standard_frames { 535 let anfs = match filter.handle_standard_frames {
537 crate::can::fd::config::NonMatchingFilter::IntoRxFifo0 => stm32_metapac::can::vals::Anfs::ACCEPT_FIFO_0, 536 crate::can::fd::config::NonMatchingFilter::IntoRxFifo0 => stm32_metapac::can::vals::Anfs::ACCEPT_FIFO_0,
538 crate::can::fd::config::NonMatchingFilter::IntoRxFifo1 => stm32_metapac::can::vals::Anfs::ACCEPT_FIFO_1, 537 crate::can::fd::config::NonMatchingFilter::IntoRxFifo1 => stm32_metapac::can::vals::Anfs::ACCEPT_FIFO_1,
@@ -555,7 +554,7 @@ impl Registers {
555 #[cfg(can_fdcan_h7)] 554 #[cfg(can_fdcan_h7)]
556 /// Configures the global filter settings 555 /// Configures the global filter settings
557 #[inline] 556 #[inline]
558 pub fn set_global_filter(&mut self, filter: GlobalFilter) { 557 pub fn set_global_filter(&self, filter: GlobalFilter) {
559 let anfs = match filter.handle_standard_frames { 558 let anfs = match filter.handle_standard_frames {
560 crate::can::fd::config::NonMatchingFilter::IntoRxFifo0 => 0, 559 crate::can::fd::config::NonMatchingFilter::IntoRxFifo0 => 0,
561 crate::can::fd::config::NonMatchingFilter::IntoRxFifo1 => 1, 560 crate::can::fd::config::NonMatchingFilter::IntoRxFifo1 => 1,
@@ -577,10 +576,10 @@ impl Registers {
577 } 576 }
578 577
579 #[cfg(not(can_fdcan_h7))] 578 #[cfg(not(can_fdcan_h7))]
580 fn configure_msg_ram(&mut self) {} 579 fn configure_msg_ram(&self) {}
581 580
582 #[cfg(can_fdcan_h7)] 581 #[cfg(can_fdcan_h7)]
583 fn configure_msg_ram(&mut self) { 582 fn configure_msg_ram(&self) {
584 let r = self.regs; 583 let r = self.regs;
585 584
586 use crate::can::fd::message_ram::*; 585 use crate::can::fd::message_ram::*;
diff --git a/embassy-stm32/src/can/fdcan.rs b/embassy-stm32/src/can/fdcan.rs
index a838d0412..f3ad718ae 100644
--- a/embassy-stm32/src/can/fdcan.rs
+++ b/embassy-stm32/src/can/fdcan.rs
@@ -141,13 +141,16 @@ pub enum OperatingMode {
141 //TestMode, 141 //TestMode,
142} 142}
143 143
144fn calc_ns_per_timer_tick<T: Instance>(mode: crate::can::fd::config::FrameTransmissionConfig) -> u64 { 144fn calc_ns_per_timer_tick(
145 info: &'static Info,
146 freq: crate::time::Hertz,
147 mode: crate::can::fd::config::FrameTransmissionConfig,
148) -> u64 {
145 match mode { 149 match mode {
146 // Use timestamp from Rx FIFO to adjust timestamp reported to user 150 // Use timestamp from Rx FIFO to adjust timestamp reported to user
147 crate::can::fd::config::FrameTransmissionConfig::ClassicCanOnly => { 151 crate::can::fd::config::FrameTransmissionConfig::ClassicCanOnly => {
148 let freq = T::frequency(); 152 let prescale: u64 = ({ info.regs.regs.nbtp().read().nbrp() } + 1) as u64
149 let prescale: u64 = ({ T::registers().regs.nbtp().read().nbrp() } + 1) as u64 153 * ({ info.regs.regs.tscc().read().tcp() } + 1) as u64;
150 * ({ T::registers().regs.tscc().read().tcp() } + 1) as u64;
151 1_000_000_000 as u64 / (freq.0 as u64 * prescale) 154 1_000_000_000 as u64 / (freq.0 as u64 * prescale)
152 } 155 }
153 // For VBR this is too hard because the FDCAN timer switches clock rate you need to configure to use 156 // For VBR this is too hard because the FDCAN timer switches clock rate you need to configure to use
@@ -158,28 +161,28 @@ fn calc_ns_per_timer_tick<T: Instance>(mode: crate::can::fd::config::FrameTransm
158 161
159/// FDCAN Configuration instance instance 162/// FDCAN Configuration instance instance
160/// Create instance of this first 163/// Create instance of this first
161pub struct CanConfigurator<'d, T: Instance> { 164pub struct CanConfigurator<'d> {
165 _phantom: PhantomData<&'d ()>,
162 config: crate::can::fd::config::FdCanConfig, 166 config: crate::can::fd::config::FdCanConfig,
163 info: &'static Info, 167 info: &'static Info,
164 state: &'static State, 168 state: &'static State,
165 /// Reference to internals. 169 /// Reference to internals.
166 _instance: FdcanInstance<'d, T>,
167 properties: Properties, 170 properties: Properties,
168 periph_clock: crate::time::Hertz, 171 periph_clock: crate::time::Hertz,
169} 172}
170 173
171impl<'d, T: Instance> CanConfigurator<'d, T> { 174impl<'d> CanConfigurator<'d> {
172 /// Creates a new Fdcan instance, keeping the peripheral in sleep mode. 175 /// Creates a new Fdcan instance, keeping the peripheral in sleep mode.
173 /// You must call [Fdcan::enable_non_blocking] to use the peripheral. 176 /// You must call [Fdcan::enable_non_blocking] to use the peripheral.
174 pub fn new( 177 pub fn new<T: Instance>(
175 peri: impl Peripheral<P = T> + 'd, 178 _peri: impl Peripheral<P = T> + 'd,
176 rx: impl Peripheral<P = impl RxPin<T>> + 'd, 179 rx: impl Peripheral<P = impl RxPin<T>> + 'd,
177 tx: impl Peripheral<P = impl TxPin<T>> + 'd, 180 tx: impl Peripheral<P = impl TxPin<T>> + 'd,
178 _irqs: impl interrupt::typelevel::Binding<T::IT0Interrupt, IT0InterruptHandler<T>> 181 _irqs: impl interrupt::typelevel::Binding<T::IT0Interrupt, IT0InterruptHandler<T>>
179 + interrupt::typelevel::Binding<T::IT1Interrupt, IT1InterruptHandler<T>> 182 + interrupt::typelevel::Binding<T::IT1Interrupt, IT1InterruptHandler<T>>
180 + 'd, 183 + 'd,
181 ) -> CanConfigurator<'d, T> { 184 ) -> CanConfigurator<'d> {
182 into_ref!(peri, rx, tx); 185 into_ref!(_peri, rx, tx);
183 186
184 rx.set_as_af(rx.af_num(), AFType::Input); 187 rx.set_as_af(rx.af_num(), AFType::Input);
185 tx.set_as_af(tx.af_num(), AFType::OutputPushPull); 188 tx.set_as_af(tx.af_num(), AFType::OutputPushPull);
@@ -201,10 +204,10 @@ impl<'d, T: Instance> CanConfigurator<'d, T> {
201 T::IT1Interrupt::enable(); 204 T::IT1Interrupt::enable();
202 } 205 }
203 Self { 206 Self {
207 _phantom: PhantomData,
204 config, 208 config,
205 info: T::info(), 209 info: T::info(),
206 state: T::state(), 210 state: T::state(),
207 _instance: FdcanInstance(peri),
208 properties: Properties::new(T::info()), 211 properties: Properties::new(T::info()),
209 periph_clock: T::frequency(), 212 periph_clock: T::frequency(),
210 } 213 }
@@ -255,7 +258,7 @@ impl<'d, T: Instance> CanConfigurator<'d, T> {
255 258
256 /// Start in mode. 259 /// Start in mode.
257 pub fn start(self, mode: OperatingMode) -> Can<'d> { 260 pub fn start(self, mode: OperatingMode) -> Can<'d> {
258 let ns_per_timer_tick = calc_ns_per_timer_tick::<T>(self.config.frame_transmit); 261 let ns_per_timer_tick = calc_ns_per_timer_tick(self.info, self.periph_clock, self.config.frame_transmit);
259 critical_section::with(|_| { 262 critical_section::with(|_| {
260 let state = self.state as *const State; 263 let state = self.state as *const State;
261 unsafe { 264 unsafe {
@@ -263,15 +266,14 @@ impl<'d, T: Instance> CanConfigurator<'d, T> {
263 (*mut_state).ns_per_timer_tick = ns_per_timer_tick; 266 (*mut_state).ns_per_timer_tick = ns_per_timer_tick;
264 } 267 }
265 }); 268 });
266 T::registers().into_mode(self.config, mode); 269 self.info.regs.into_mode(self.config, mode);
267 Can { 270 Can {
268 _phantom: PhantomData, 271 _phantom: PhantomData,
269 config: self.config, 272 config: self.config,
270 info: self.info, 273 info: self.info,
271 state: self.state, 274 state: self.state,
272 instance: T::info().regs.regs,
273 _mode: mode, 275 _mode: mode,
274 properties: Properties::new(T::info()), 276 properties: Properties::new(self.info),
275 } 277 }
276 } 278 }
277 279
@@ -297,7 +299,6 @@ pub struct Can<'d> {
297 config: crate::can::fd::config::FdCanConfig, 299 config: crate::can::fd::config::FdCanConfig,
298 info: &'static Info, 300 info: &'static Info,
299 state: &'static State, 301 state: &'static State,
300 instance: crate::pac::can::Fdcan,
301 _mode: OperatingMode, 302 _mode: OperatingMode,
302 properties: Properties, 303 properties: Properties,
303} 304}
@@ -360,14 +361,12 @@ impl<'d> Can<'d> {
360 info: self.info, 361 info: self.info,
361 state: self.state, 362 state: self.state,
362 config: self.config, 363 config: self.config,
363 _instance: self.instance,
364 _mode: self._mode, 364 _mode: self._mode,
365 }, 365 },
366 CanRx { 366 CanRx {
367 _phantom: PhantomData, 367 _phantom: PhantomData,
368 info: self.info, 368 info: self.info,
369 state: self.state, 369 state: self.state,
370 _instance: self.instance,
371 _mode: self._mode, 370 _mode: self._mode,
372 }, 371 },
373 self.properties, 372 self.properties,
@@ -380,7 +379,6 @@ impl<'d> Can<'d> {
380 config: tx.config, 379 config: tx.config,
381 info: tx.info, 380 info: tx.info,
382 state: tx.state, 381 state: tx.state,
383 instance: tx._instance,
384 _mode: rx._mode, 382 _mode: rx._mode,
385 properties: Properties::new(tx.info), 383 properties: Properties::new(tx.info),
386 } 384 }
@@ -392,7 +390,7 @@ impl<'d> Can<'d> {
392 tx_buf: &'static mut TxBuf<TX_BUF_SIZE>, 390 tx_buf: &'static mut TxBuf<TX_BUF_SIZE>,
393 rxb: &'static mut RxBuf<RX_BUF_SIZE>, 391 rxb: &'static mut RxBuf<RX_BUF_SIZE>,
394 ) -> BufferedCan<'d, TX_BUF_SIZE, RX_BUF_SIZE> { 392 ) -> BufferedCan<'d, TX_BUF_SIZE, RX_BUF_SIZE> {
395 BufferedCan::new(self.info, self.state, self.info.regs.regs, self._mode, tx_buf, rxb) 393 BufferedCan::new(self.info, self.state, self._mode, tx_buf, rxb)
396 } 394 }
397 395
398 /// Return a buffered instance of driver with CAN FD support. User must supply Buffers 396 /// Return a buffered instance of driver with CAN FD support. User must supply Buffers
@@ -401,7 +399,7 @@ impl<'d> Can<'d> {
401 tx_buf: &'static mut TxFdBuf<TX_BUF_SIZE>, 399 tx_buf: &'static mut TxFdBuf<TX_BUF_SIZE>,
402 rxb: &'static mut RxFdBuf<RX_BUF_SIZE>, 400 rxb: &'static mut RxFdBuf<RX_BUF_SIZE>,
403 ) -> BufferedCanFd<'d, TX_BUF_SIZE, RX_BUF_SIZE> { 401 ) -> BufferedCanFd<'d, TX_BUF_SIZE, RX_BUF_SIZE> {
404 BufferedCanFd::new(self.info, self.state, self.info.regs.regs, self._mode, tx_buf, rxb) 402 BufferedCanFd::new(self.info, self.state, self._mode, tx_buf, rxb)
405 } 403 }
406} 404}
407 405
@@ -416,7 +414,6 @@ pub struct BufferedCan<'d, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> {
416 _phantom: PhantomData<&'d ()>, 414 _phantom: PhantomData<&'d ()>,
417 info: &'static Info, 415 info: &'static Info,
418 state: &'static State, 416 state: &'static State,
419 _instance: crate::pac::can::Fdcan,
420 _mode: OperatingMode, 417 _mode: OperatingMode,
421 tx_buf: &'static TxBuf<TX_BUF_SIZE>, 418 tx_buf: &'static TxBuf<TX_BUF_SIZE>,
422 rx_buf: &'static RxBuf<RX_BUF_SIZE>, 419 rx_buf: &'static RxBuf<RX_BUF_SIZE>,
@@ -427,7 +424,6 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCan<'d,
427 fn new( 424 fn new(
428 info: &'static Info, 425 info: &'static Info,
429 state: &'static State, 426 state: &'static State,
430 _instance: crate::pac::can::Fdcan,
431 _mode: OperatingMode, 427 _mode: OperatingMode,
432 tx_buf: &'static TxBuf<TX_BUF_SIZE>, 428 tx_buf: &'static TxBuf<TX_BUF_SIZE>,
433 rx_buf: &'static RxBuf<RX_BUF_SIZE>, 429 rx_buf: &'static RxBuf<RX_BUF_SIZE>,
@@ -436,7 +432,6 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCan<'d,
436 _phantom: PhantomData, 432 _phantom: PhantomData,
437 info, 433 info,
438 state, 434 state,
439 _instance,
440 _mode, 435 _mode,
441 tx_buf, 436 tx_buf,
442 rx_buf, 437 rx_buf,
@@ -549,7 +544,6 @@ pub struct BufferedCanFd<'d, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize>
549 _phantom: PhantomData<&'d ()>, 544 _phantom: PhantomData<&'d ()>,
550 info: &'static Info, 545 info: &'static Info,
551 state: &'static State, 546 state: &'static State,
552 _instance: crate::pac::can::Fdcan,
553 _mode: OperatingMode, 547 _mode: OperatingMode,
554 tx_buf: &'static TxFdBuf<TX_BUF_SIZE>, 548 tx_buf: &'static TxFdBuf<TX_BUF_SIZE>,
555 rx_buf: &'static RxFdBuf<RX_BUF_SIZE>, 549 rx_buf: &'static RxFdBuf<RX_BUF_SIZE>,
@@ -560,7 +554,6 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCanFd<'
560 fn new( 554 fn new(
561 info: &'static Info, 555 info: &'static Info,
562 state: &'static State, 556 state: &'static State,
563 _instance: crate::pac::can::Fdcan,
564 _mode: OperatingMode, 557 _mode: OperatingMode,
565 tx_buf: &'static TxFdBuf<TX_BUF_SIZE>, 558 tx_buf: &'static TxFdBuf<TX_BUF_SIZE>,
566 rx_buf: &'static RxFdBuf<RX_BUF_SIZE>, 559 rx_buf: &'static RxFdBuf<RX_BUF_SIZE>,
@@ -569,7 +562,6 @@ impl<'c, 'd, const TX_BUF_SIZE: usize, const RX_BUF_SIZE: usize> BufferedCanFd<'
569 _phantom: PhantomData, 562 _phantom: PhantomData,
570 info, 563 info,
571 state, 564 state,
572 _instance,
573 _mode, 565 _mode,
574 tx_buf, 566 tx_buf,
575 rx_buf, 567 rx_buf,
@@ -646,7 +638,6 @@ pub struct CanRx<'d> {
646 _phantom: PhantomData<&'d ()>, 638 _phantom: PhantomData<&'d ()>,
647 info: &'static Info, 639 info: &'static Info,
648 state: &'static State, 640 state: &'static State,
649 _instance: crate::pac::can::Fdcan,
650 _mode: OperatingMode, 641 _mode: OperatingMode,
651} 642}
652 643
@@ -668,7 +659,6 @@ pub struct CanTx<'d> {
668 info: &'static Info, 659 info: &'static Info,
669 state: &'static State, 660 state: &'static State,
670 config: crate::can::fd::config::FdCanConfig, 661 config: crate::can::fd::config::FdCanConfig,
671 _instance: crate::pac::can::Fdcan,
672 _mode: OperatingMode, 662 _mode: OperatingMode,
673} 663}
674 664