feat: defmt + derive for some UDP types
Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
This commit is contained in:
parent
747fe0cca4
commit
f2ac8521b1
4 changed files with 8 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ embedded-nal = "0.6.0"
|
||||||
bit_field = "0.10.1"
|
bit_field = "0.10.1"
|
||||||
derive-try-from-primitive = "1"
|
derive-try-from-primitive = "1"
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
defmt = { version = "0.3", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
no-chip-version-assertion = []
|
no-chip-version-assertion = []
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use crate::MacAddress;
|
||||||
|
|
||||||
pub struct Dhcp {
|
pub struct Dhcp {
|
||||||
// settings: HostConfig,
|
// settings: HostConfig,
|
||||||
// current: HostConfig,
|
// current: HostConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dhcp {
|
impl Dhcp {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ use crate::bus::Bus;
|
||||||
use crate::register::socketn;
|
use crate::register::socketn;
|
||||||
use embedded_nal::Ipv4Addr;
|
use embedded_nal::Ipv4Addr;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct Socket {
|
pub struct Socket {
|
||||||
pub index: u8,
|
pub index: u8,
|
||||||
register: u8,
|
register: u8,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ use crate::socket::Socket;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
use embedded_nal::{nb, IpAddr, Ipv4Addr, SocketAddr, SocketAddrV4, UdpClientStack, UdpFullStack};
|
use embedded_nal::{nb, IpAddr, Ipv4Addr, SocketAddr, SocketAddrV4, UdpClientStack, UdpFullStack};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct UdpSocket {
|
pub struct UdpSocket {
|
||||||
socket: Socket,
|
socket: Socket,
|
||||||
}
|
}
|
||||||
|
|
@ -140,10 +142,11 @@ impl UdpSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum UdpSocketError<E: Debug> {
|
pub enum UdpSocketError<E: Debug> {
|
||||||
NoMoreSockets,
|
NoMoreSockets,
|
||||||
UnsupportedAddress,
|
UnsupportedAddress,
|
||||||
Other(E),
|
Other(#[cfg_attr(feature = "defmt", defmt(Debug2Format))] E),
|
||||||
WriteTimeout,
|
WriteTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue