feat: derive defmt::Format for more structs and errors

Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
This commit is contained in:
Lachezar Lechev 2023-03-06 12:54:55 +02:00
commit c3f79c96ed
No known key found for this signature in database
GPG key ID: B2D641D6A2C8E742
12 changed files with 40 additions and 6 deletions

View file

@ -22,7 +22,8 @@ pub use uninitialized_device::UninitializedDevice;
/// Settings for wake on LAN. Allows the W5500 to optionally emit an interrupt upon receiving a packet
#[repr(u8)]
#[derive(Copy, Clone, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum OnWakeOnLan {
InvokeInterrupt = 0b00100000,
Ignore = 0b00000000,
@ -30,7 +31,8 @@ pub enum OnWakeOnLan {
/// Settings for ping. Allows the W5500 to respond to or ignore network ping requests
#[repr(u8)]
#[derive(Copy, Clone, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum OnPingRequest {
Respond = 0b00000000,
Ignore = 0b00010000,
@ -39,20 +41,23 @@ pub enum OnPingRequest {
/// Use [ConnectionType::PPoE] when talking
/// to an ADSL modem. Otherwise use [ConnectionType::Ethernet]
#[repr(u8)]
#[derive(Copy, Clone, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ConnectionType {
PPoE = 0b00001000,
Ethernet = 0b00000000,
}
#[derive(Copy, Clone, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[repr(u8)]
pub enum ArpResponses {
Cache = 0b00000000,
DropAfterUse = 0b00000010,
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Mode {
pub on_wake_on_lan: OnWakeOnLan,
pub on_ping_request: OnPingRequest,