Added register_dump function to show the contents of a socket register
This commit is contained in:
parent
adc7005255
commit
4ff4bc95c9
2 changed files with 15 additions and 0 deletions
|
|
@ -168,6 +168,17 @@ pub trait Socket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn dump_register<SpiBus: ActiveBus>(&self, bus: &mut SpiBus) -> Result<[u8; 0x30], SpiBus::Error> {
|
||||||
|
let mut register = [0u8; 0x30];
|
||||||
|
block!(bus.transfer_frame(
|
||||||
|
self.register(),
|
||||||
|
0u16,
|
||||||
|
false,
|
||||||
|
&mut register
|
||||||
|
))?;
|
||||||
|
Ok(register)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type OwnedSockets = (
|
pub type OwnedSockets = (
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,10 @@ impl<SpiBus: ActiveBus, NetworkImpl: Network, SocketImpl: Socket>
|
||||||
Ok(UdpSocket { w5500, socket })
|
Ok(UdpSocket { w5500, socket })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn dump_register(&mut self) -> Result<[u8; 0x30], SpiBus::Error> {
|
||||||
|
Ok(self.socket.dump_register(&mut self.w5500.bus)?)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns a UDP packet if one is available. Will return `None` if no UDP packets are in the socket's buffer
|
/// Returns a UDP packet if one is available. Will return `None` if no UDP packets are in the socket's buffer
|
||||||
pub fn receive(mut self) -> Result<Option<IncomingPacket<Self>>, SpiBus::Error> {
|
pub fn receive(mut self) -> Result<Option<IncomingPacket<Self>>, SpiBus::Error> {
|
||||||
if !self
|
if !self
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue