feat: export uninitialized_device & add docs

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
This commit is contained in:
Lachezar Lechev 2023-02-17 17:51:20 +02:00
commit 1b2ba0bfab
No known key found for this signature in database
GPG key ID: B2D641D6A2C8E742
2 changed files with 11 additions and 1 deletions

View file

@ -11,7 +11,7 @@ pub mod register;
mod socket;
pub mod tcp;
pub mod udp;
mod uninitialized_device;
pub mod uninitialized_device;
pub use device::{Device, DeviceRefMut, InactiveDevice};
pub use host::{Dhcp, Host, HostConfig, Manual};

View file

@ -78,6 +78,7 @@ impl UdpSocket {
}
}
/// Sets a new destination before performing the send operation.
fn send_to<SpiBus: Bus>(
&mut self,
bus: &mut SpiBus,
@ -88,6 +89,9 @@ impl UdpSocket {
self.send(bus, send_buffer)
}
/// Receive data and mutate the `receive_buffer`.
///
/// If [`Interrupt::Receive`] is not set, it will always return [`NbError::WouldBlock`].
fn receive<SpiBus: Bus>(
&mut self,
bus: &mut SpiBus,
@ -139,6 +143,12 @@ impl UdpSocket {
self.socket.command(bus, socketn::Command::Close)?;
Ok(())
}
/// returns the index of the socket
#[inline]
pub fn index(&self) -> u8 {
self.socket.index
}
}
#[derive(Debug)]