pub struct NodeMbox { /* private fields */ }Expand description
A data structure to be shared between a receiving thread (e.g. a CAN controller IRQ) and the
Node object.
Incoming messages should be passed to NodeMbox::store_message.
Implementations§
Source§impl NodeMbox
impl NodeMbox
Sourcepub const fn new(
rx_pdos: &'static [Pdo<'_>],
tx_pdos: &'static [Pdo<'_>],
tx_queue: &'static dyn CanMessageQueue,
sdo_buffer: &'static mut [u8],
) -> Self
pub const fn new( rx_pdos: &'static [Pdo<'_>], tx_pdos: &'static [Pdo<'_>], tx_queue: &'static dyn CanMessageQueue, sdo_buffer: &'static mut [u8], ) -> Self
Sourcepub fn set_process_notify_callback(&self, callback: &'static (dyn Fn() + Sync))
pub fn set_process_notify_callback(&self, callback: &'static (dyn Fn() + Sync))
Set a callback for notification when a message is received and requires processing.
It must be static. Usually this will be a static fn, but in some circumstances, it may be desirable to use Box::leak to pass a heap allocated closure instead.
Sourcepub fn set_transmit_notify_callback(&self, callback: &'static (dyn Fn() + Sync))
pub fn set_transmit_notify_callback(&self, callback: &'static (dyn Fn() + Sync))
Set a callback for when new transmit messages are queued
This will be called during process anytime new messages are ready to be queued
Sourcepub fn store_message(&self, msg: CanMessage) -> Result<(), CanMessage>
pub fn store_message(&self, msg: CanMessage) -> Result<(), CanMessage>
Store a received CAN message
Sourcepub fn next_transmit_message(&self) -> Option<CanMessage>
pub fn next_transmit_message(&self) -> Option<CanMessage>
Get the next message ready for transmit
Messages are prioritized as follows:
- TPDOs first, if available, starting with TPDO0
- Other non-SDO messages (SYNC, LSS, NMT)
- SDO server responses
Sourcepub fn queue_transmit_message(&self, msg: CanMessage) -> Result<(), CanMessage>
pub fn queue_transmit_message(&self, msg: CanMessage) -> Result<(), CanMessage>
Store a message for transmission in the general transmit queue
Auto Trait Implementations§
impl !Freeze for NodeMbox
impl !RefUnwindSafe for NodeMbox
impl Send for NodeMbox
impl Sync for NodeMbox
impl Unpin for NodeMbox
impl !UnwindSafe for NodeMbox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more