allow deed code can rx & clippy

This commit is contained in:
Philipp Scheff 2023-07-03 23:48:07 +02:00
parent af15b49bfe
commit a96f30edf4
2 changed files with 8 additions and 7 deletions

View file

@ -387,6 +387,7 @@ impl<'c, 'd, T: Instance> CanTx<'c, 'd, T> {
} }
} }
#[allow(dead_code)]
pub struct CanRx<'c, 'd, T: Instance> { pub struct CanRx<'c, 'd, T: Instance> {
can: &'c RefCell<bxcan::Can<BxcanInstance<'d, T>>>, can: &'c RefCell<bxcan::Can<BxcanInstance<'d, T>>>,
} }

View file

@ -11,7 +11,7 @@ use embassy_stm32::bind_interrupts;
use embassy_stm32::can::bxcan::filter::Mask32; use embassy_stm32::can::bxcan::filter::Mask32;
use embassy_stm32::can::bxcan::{Data, Fifo, Frame, StandardId}; use embassy_stm32::can::bxcan::{Data, Fifo, Frame, StandardId};
use embassy_stm32::can::{ 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::gpio::{Input, Pull};
use embassy_stm32::peripherals::CAN3; use embassy_stm32::peripherals::CAN3;
@ -46,21 +46,21 @@ async fn main(spawner: Spawner) {
let rx_pin = Input::new(&mut p.PA15, Pull::Up); let rx_pin = Input::new(&mut p.PA15, Pull::Up);
core::mem::forget(rx_pin); 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)); let can: &'static mut Can<'static, CAN3> = static_cell::make_static!(Can::new(p.CAN3, p.PA8, p.PA15, Irqs));
CAN.as_mut() can.as_mut()
.modify_filters() .modify_filters()
.enable_bank(0, Fifo::Fifo0, Mask32::accept_all()); .enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
CAN.as_mut() can.as_mut()
.modify_config() .modify_config()
.set_bit_timing(0x001c0001) // http://www.bittiming.can-wiki.info/ .set_bit_timing(0x001c0001) // http://www.bittiming.can-wiki.info/
.set_loopback(true) .set_loopback(true)
.enable(); .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); let tx: &'static mut CanTx<'static, 'static, CAN3> = static_cell::make_static!(tx);
spawner.spawn(send_can_message(TX)).unwrap(); spawner.spawn(send_can_message(tx)).unwrap();
loop { loop {
let frame = rx.read().await.unwrap(); let frame = rx.read().await.unwrap();