#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Chmode {
#[doc = "Normal Mode"]
NORMAL = 0x0,
#[doc = "Automatic Echo"]
AUTOMATIC = 0x01,
#[doc = "Local Loopback"]
LOCAL_LOOPBACK = 0x02,
#[doc = "Remote Loopback"]
REMOTE_LOOPBACK = 0x03,
}
impl Chmode {
#[inline(always)]
pub const fn from_bits(val: u8) -> Chmode {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Chmode {
#[inline(always)]
fn from(val: u8) -> Chmode {
Chmode::from_bits(val)
}
}
impl From<Chmode> for u8 {
#[inline(always)]
fn from(val: Chmode) -> u8 {
Chmode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Par {
#[doc = "Even Parity"]
EVEN = 0x0,
#[doc = "Odd Parity"]
ODD = 0x01,
#[doc = "Space: parity forced to 0"]
SPACE = 0x02,
#[doc = "Mark: parity forced to 1"]
MARK = 0x03,
#[doc = "No Parity"]
NO = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
}
impl Par {
#[inline(always)]
pub const fn from_bits(val: u8) -> Par {
unsafe { core::mem::transmute(val & 0x07) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Par {
#[inline(always)]
fn from(val: u8) -> Par {
Par::from_bits(val)
}
}
impl From<Par> for u8 {
#[inline(always)]
fn from(val: Par) -> u8 {
Par::to_bits(val)
}
}