fmt
This commit is contained in:
parent
71afa40a69
commit
af15b49bfe
@ -1,9 +1,8 @@
|
||||
use core::cell::{RefCell, RefMut};
|
||||
use core::future::poll_fn;
|
||||
use core::marker::PhantomData;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use core::task::Poll;
|
||||
use core::cell::RefMut;
|
||||
use core::cell::RefCell;
|
||||
|
||||
pub use bxcan;
|
||||
use bxcan::{Data, ExtendedId, Frame, Id, StandardId};
|
||||
@ -155,7 +154,11 @@ impl<'d, T: Instance> Can<'d, T> {
|
||||
|
||||
pub fn set_bitrate(&mut self, bitrate: u32) {
|
||||
let bit_timing = Self::calc_bxcan_timings(T::frequency(), bitrate).unwrap();
|
||||
self.can.borrow_mut().modify_config().set_bit_timing(bit_timing).leave_disabled();
|
||||
self.can
|
||||
.borrow_mut()
|
||||
.modify_config()
|
||||
.set_bit_timing(bit_timing)
|
||||
.leave_disabled();
|
||||
}
|
||||
|
||||
/// Queues the message to be sent but exerts backpressure
|
||||
@ -432,19 +435,19 @@ impl<'d, T: Instance> Drop for Can<'d, T> {
|
||||
}
|
||||
}
|
||||
|
||||
// impl<'d, T: Instance> Deref for Can<'d, T> {
|
||||
// type Target = bxcan::Can<BxcanInstance<'d, T>>;
|
||||
impl<'d, T: Instance> Deref for Can<'d, T> {
|
||||
type Target = RefCell<bxcan::Can<BxcanInstance<'d, T>>>;
|
||||
|
||||
// fn deref(&self) -> &Self::Target {
|
||||
// self.can.borrow()
|
||||
// }
|
||||
// }
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.can
|
||||
}
|
||||
}
|
||||
|
||||
// impl<'d, T: Instance> DerefMut for Can<'d, T> {
|
||||
// fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
// self.can.borrow_mut()
|
||||
// }
|
||||
// }
|
||||
impl<'d, T: Instance> DerefMut for Can<'d, T> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.can
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
|
@ -2,15 +2,17 @@
|
||||
#![no_main]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use core::borrow::BorrowMut;
|
||||
use core::borrow::Borrow;
|
||||
use core::borrow::{Borrow, BorrowMut};
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::bind_interrupts;
|
||||
use embassy_stm32::can::bxcan::filter::Mask32;
|
||||
use embassy_stm32::can::bxcan::{Fifo, Frame, StandardId, Data};
|
||||
use embassy_stm32::can::{Can,CanTx,CanRx, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler};
|
||||
use embassy_stm32::can::bxcan::{Data, Fifo, Frame, StandardId};
|
||||
use embassy_stm32::can::{
|
||||
Can, CanRx, CanTx, Rx0InterruptHandler, Rx1InterruptHandler, SceInterruptHandler, TxInterruptHandler,
|
||||
};
|
||||
use embassy_stm32::gpio::{Input, Pull};
|
||||
use embassy_stm32::peripherals::CAN3;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
@ -45,7 +47,9 @@ async fn main(spawner: Spawner) {
|
||||
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().modify_filters().enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
|
||||
CAN.as_mut()
|
||||
.modify_filters()
|
||||
.enable_bank(0, Fifo::Fifo0, Mask32::accept_all());
|
||||
|
||||
CAN.as_mut()
|
||||
.modify_config()
|
||||
|
Loading…
Reference in New Issue
Block a user