fix rx loop bug
This commit is contained in:
parent
2395014400
commit
e9018111be
2 changed files with 6 additions and 25 deletions
|
@ -50,11 +50,11 @@ pub trait BusBehaviour<B: BusBackend> {
|
|||
|
||||
impl<B: BusBackend, T: BusBehaviour<B>> BusBehaviour<B> for &T {
|
||||
fn get(&self, id: <B as BusBackend>::ID) -> Option<<B as BusBackend>::Data> {
|
||||
self.get(id)
|
||||
(*self).get(id)
|
||||
}
|
||||
|
||||
fn register_waker(&self, id: <B as BusBackend>::ID, waker: &Waker) {
|
||||
self.register_waker(id, waker)
|
||||
(*self).register_waker(id, waker)
|
||||
}
|
||||
|
||||
fn publish(
|
||||
|
@ -62,15 +62,15 @@ impl<B: BusBackend, T: BusBehaviour<B>> BusBehaviour<B> for &T {
|
|||
id: <B as BusBackend>::ID,
|
||||
value: <B as BusBackend>::Data,
|
||||
) -> Result<(), BusError<B>> {
|
||||
self.publish(id, value)
|
||||
(*self).publish(id, value)
|
||||
}
|
||||
|
||||
fn publish_local(&self, id: &<B as BusBackend>::ID, value: <B as BusBackend>::Data) {
|
||||
self.publish_local(id, value)
|
||||
(*self).publish_local(id, value)
|
||||
}
|
||||
|
||||
fn request(&self, id: <B as BusBackend>::ID) -> Result<(), BusError<B>> {
|
||||
self.request(id)
|
||||
(*self).request(id)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,26 +46,7 @@ impl<const TX_CAP: usize> BusBackend for BxCanBus<TX_CAP> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<const TX_CAP: usize> Default for BxCanBus<TX_CAP> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
tx_queue: MpMcQueue::new(),
|
||||
on_publish: &Self::empty_hook,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<const TX_CAP: usize> BxCanBus<TX_CAP> {
|
||||
pub const fn new() -> Self {
|
||||
Self {
|
||||
tx_queue: MpMcQueue::new(),
|
||||
on_publish: &Self::empty_hook,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn empty_hook(&self) {}
|
||||
|
||||
pub const fn new_with_hook(on_publish: &'static (dyn Fn(&Self) + Send + Sync)) -> Self {
|
||||
Self {
|
||||
tx_queue: MpMcQueue::new(),
|
||||
|
@ -118,7 +99,7 @@ impl<const TX_CAP: usize> BxCanBus<TX_CAP> {
|
|||
}
|
||||
}
|
||||
Err(nb::Error::WouldBlock) => break,
|
||||
Err(nb::Error::Other(_)) => {}
|
||||
Err(nb::Error::Other(_)) => break,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue