From a96f30edf45533cb0e41711556106d1583977081 Mon Sep 17 00:00:00 2001 From: Philipp Scheff Date: Mon, 3 Jul 2023 23:48:07 +0200 Subject: [PATCH] allow deed code can rx & clippy --- embassy-stm32/src/can/bxcan.rs | 1 + examples/stm32f7/src/bin/can.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index 260f567b..fbb4113e 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs @@ -387,6 +387,7 @@ impl<'c, 'd, T: Instance> CanTx<'c, 'd, T> { } } +#[allow(dead_code)] pub struct CanRx<'c, 'd, T: Instance> { can: &'c RefCell>>, } diff --git a/examples/stm32f7/src/bin/can.rs b/examples/stm32f7/src/bin/can.rs index 65af9845..2383c23d 100644 --- a/examples/stm32f7/src/bin/can.rs +++ b/examples/stm32f7/src/bin/can.rs @@ -11,7 +11,7 @@ use embassy_stm32::bind_interrupts; use embassy_stm32::can::bxcan::filter::Mask32; use embassy_stm32::can::bxcan::{Data, Fifo, Frame, StandardId}; use embassy_stm32::can::{ - Can, CanRx, CanTx, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler, + Can, CanTx, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler, }; use embassy_stm32::gpio::{Input, Pull}; use embassy_stm32::peripherals::CAN3; @@ -46,21 +46,21 @@ async fn main(spawner: Spawner) { let rx_pin = Input::new(&mut p.PA15, Pull::Up); core::mem::forget(rx_pin); - let CAN: &'static mut Can<'static, CAN3> = static_cell::make_static!(Can::new(p.CAN3, p.PA8, p.PA15, Irqs)); - CAN.as_mut() + let can: &'static mut Can<'static, CAN3> = static_cell::make_static!(Can::new(p.CAN3, p.PA8, p.PA15, Irqs)); + can.as_mut() .modify_filters() .enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); - CAN.as_mut() + can.as_mut() .modify_config() .set_bit_timing(0x001c0001) // http://www.bittiming.can-wiki.info/ .set_loopback(true) .enable(); - let (tx, mut rx) = CAN.split(); + let (tx, mut rx) = can.split(); - let TX: &'static mut CanTx<'static, 'static, CAN3> = static_cell::make_static!(tx); - spawner.spawn(send_can_message(TX)).unwrap(); + let tx: &'static mut CanTx<'static, 'static, CAN3> = static_cell::make_static!(tx); + spawner.spawn(send_can_message(tx)).unwrap(); loop { let frame = rx.read().await.unwrap();