fix rx loop bug

This commit is contained in:
Paul Zinselmeyer 2024-05-03 17:26:32 +02:00
parent 2395014400
commit e9018111be
Signed by: pfzetto
GPG Key ID: B471A1AF06C895FD
2 changed files with 6 additions and 25 deletions

View File

@ -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)
}
}

View File

@ -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,
}
}