#[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. Receiver input is connected to the TXD pin."]
AUTOMATIC = 0x01,
#[doc = "Local Loopback. Transmitter output is connected to the Receiver Input."]
LOCAL_LOOPBACK = 0x02,
#[doc = "Remote Loopback. RXD pin is internally connected to the TXD pin."]
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 MrChrl {
#[doc = "Character length is 5 bits"]
_5_BIT = 0x0,
#[doc = "Character length is 6 bits"]
_6_BIT = 0x01,
#[doc = "Character length is 7 bits"]
_7_BIT = 0x02,
#[doc = "Character length is 8 bits"]
_8_BIT = 0x03,
}
impl MrChrl {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrChrl {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrChrl {
#[inline(always)]
fn from(val: u8) -> MrChrl {
MrChrl::from_bits(val)
}
}
impl From<MrChrl> for u8 {
#[inline(always)]
fn from(val: MrChrl) -> u8 {
MrChrl::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MrSpiModeChrl {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Character length is 8 bits"]
_8_BIT = 0x03,
}
impl MrSpiModeChrl {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrSpiModeChrl {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrSpiModeChrl {
#[inline(always)]
fn from(val: u8) -> MrSpiModeChrl {
MrSpiModeChrl::from_bits(val)
}
}
impl From<MrSpiModeChrl> for u8 {
#[inline(always)]
fn from(val: MrSpiModeChrl) -> u8 {
MrSpiModeChrl::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MrSpiModeUsartMode {
_RESERVED_0 = 0x0,
_RESERVED_1 = 0x01,
_RESERVED_2 = 0x02,
_RESERVED_3 = 0x03,
_RESERVED_4 = 0x04,
_RESERVED_5 = 0x05,
_RESERVED_6 = 0x06,
_RESERVED_7 = 0x07,
_RESERVED_8 = 0x08,
_RESERVED_9 = 0x09,
_RESERVED_a = 0x0a,
_RESERVED_b = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
#[doc = "SPI master"]
SPI_MASTER = 0x0e,
#[doc = "SPI Slave"]
SPI_SLAVE = 0x0f,
}
impl MrSpiModeUsartMode {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrSpiModeUsartMode {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrSpiModeUsartMode {
#[inline(always)]
fn from(val: u8) -> MrSpiModeUsartMode {
MrSpiModeUsartMode::from_bits(val)
}
}
impl From<MrSpiModeUsartMode> for u8 {
#[inline(always)]
fn from(val: MrSpiModeUsartMode) -> u8 {
MrSpiModeUsartMode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MrSpiModeUsclks {
#[doc = "master Clock MCK is selected"]
MCK = 0x0,
#[doc = "Internal Clock Divided MCK/DIV (DIV=8) is selected"]
DIV = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Serial Clock SLK is selected"]
SCK = 0x03,
}
impl MrSpiModeUsclks {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrSpiModeUsclks {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrSpiModeUsclks {
#[inline(always)]
fn from(val: u8) -> MrSpiModeUsclks {
MrSpiModeUsclks::from_bits(val)
}
}
impl From<MrSpiModeUsclks> for u8 {
#[inline(always)]
fn from(val: MrSpiModeUsclks) -> u8 {
MrSpiModeUsclks::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MrUsartMode {
#[doc = "Normal mode"]
NORMAL = 0x0,
#[doc = "RS485"]
RS485 = 0x01,
#[doc = "Hardware Handshaking"]
HW_HANDSHAKING = 0x02,
_RESERVED_3 = 0x03,
#[doc = "IS07816 Protocol: T = 0"]
IS07816_T_0 = 0x04,
_RESERVED_5 = 0x05,
#[doc = "IS07816 Protocol: T = 1"]
IS07816_T_1 = 0x06,
_RESERVED_7 = 0x07,
#[doc = "IrDA"]
IRDA = 0x08,
_RESERVED_9 = 0x09,
#[doc = "LIN master"]
LIN_MASTER = 0x0a,
#[doc = "LIN Slave"]
LIN_SLAVE = 0x0b,
_RESERVED_c = 0x0c,
_RESERVED_d = 0x0d,
#[doc = "SPI master"]
SPI_MASTER = 0x0e,
#[doc = "SPI Slave"]
SPI_SLAVE = 0x0f,
}
impl MrUsartMode {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrUsartMode {
unsafe { core::mem::transmute(val & 0x0f) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrUsartMode {
#[inline(always)]
fn from(val: u8) -> MrUsartMode {
MrUsartMode::from_bits(val)
}
}
impl From<MrUsartMode> for u8 {
#[inline(always)]
fn from(val: MrUsartMode) -> u8 {
MrUsartMode::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MrUsclks {
#[doc = "master Clock MCK is selected"]
MCK = 0x0,
#[doc = "Internal Clock Divided MCK/DIV (DIV=8) is selected"]
DIV = 0x01,
_RESERVED_2 = 0x02,
#[doc = "Serial Clock SLK is selected"]
SCK = 0x03,
}
impl MrUsclks {
#[inline(always)]
pub const fn from_bits(val: u8) -> MrUsclks {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for MrUsclks {
#[inline(always)]
fn from(val: u8) -> MrUsclks {
MrUsclks::from_bits(val)
}
}
impl From<MrUsclks> for u8 {
#[inline(always)]
fn from(val: MrUsclks) -> u8 {
MrUsclks::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Nact {
#[doc = "The USART transmits the response."]
PUBLISH = 0x0,
#[doc = "The USART receives the response."]
SUBSCRIBE = 0x01,
#[doc = "The USART does not transmit and does not receive the response."]
IGNORE = 0x02,
_RESERVED_3 = 0x03,
}
impl Nact {
#[inline(always)]
pub const fn from_bits(val: u8) -> Nact {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Nact {
#[inline(always)]
fn from(val: u8) -> Nact {
Nact::from_bits(val)
}
}
impl From<Nact> for u8 {
#[inline(always)]
fn from(val: Nact) -> u8 {
Nact::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Nbstop {
#[doc = "1 stop bit"]
_1_BIT = 0x0,
#[doc = "1.5 stop bit (SYNC = 0) or reserved (SYNC = 1)"]
_1_5_BIT = 0x01,
#[doc = "2 stop bits"]
_2_BIT = 0x02,
_RESERVED_3 = 0x03,
}
impl Nbstop {
#[inline(always)]
pub const fn from_bits(val: u8) -> Nbstop {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for Nbstop {
#[inline(always)]
fn from(val: u8) -> Nbstop {
Nbstop::from_bits(val)
}
}
impl From<Nbstop> for u8 {
#[inline(always)]
fn from(val: Nbstop) -> u8 {
Nbstop::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 = "Parity forced to 0 (Space)"]
SPACE = 0x02,
#[doc = "Parity forced to 1 (Mark)"]
MARK = 0x03,
#[doc = "No parity"]
NO = 0x04,
_RESERVED_5 = 0x05,
#[doc = "Multidrop mode"]
MULTIDROP = 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)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RxPp {
#[doc = "The preamble is composed of '1's"]
ALL_ONE = 0x0,
#[doc = "The preamble is composed of '0's"]
ALL_ZERO = 0x01,
#[doc = "The preamble is composed of '01's"]
ZERO_ONE = 0x02,
#[doc = "The preamble is composed of '10's"]
ONE_ZERO = 0x03,
}
impl RxPp {
#[inline(always)]
pub const fn from_bits(val: u8) -> RxPp {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for RxPp {
#[inline(always)]
fn from(val: u8) -> RxPp {
RxPp::from_bits(val)
}
}
impl From<RxPp> for u8 {
#[inline(always)]
fn from(val: RxPp) -> u8 {
RxPp::to_bits(val)
}
}
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum TxPp {
#[doc = "The preamble is composed of '1's"]
ALL_ONE = 0x0,
#[doc = "The preamble is composed of '0's"]
ALL_ZERO = 0x01,
#[doc = "The preamble is composed of '01's"]
ZERO_ONE = 0x02,
#[doc = "The preamble is composed of '10's"]
ONE_ZERO = 0x03,
}
impl TxPp {
#[inline(always)]
pub const fn from_bits(val: u8) -> TxPp {
unsafe { core::mem::transmute(val & 0x03) }
}
#[inline(always)]
pub const fn to_bits(self) -> u8 {
unsafe { core::mem::transmute(self) }
}
}
impl From<u8> for TxPp {
#[inline(always)]
fn from(val: u8) -> TxPp {
TxPp::from_bits(val)
}
}
impl From<TxPp> for u8 {
#[inline(always)]
fn from(val: TxPp) -> u8 {
TxPp::to_bits(val)
}
}
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub struct Wpkey(u32);
impl Wpkey {
#[doc = "Writing any other value in this field aborts the write operation of the WPEN bit. Always reads as 0."]
pub const PASSWD: Self = Self(0x0055_5341);
}
impl Wpkey {
pub const fn from_bits(val: u32) -> Wpkey {
Self(val & 0x00ff_ffff)
}
pub const fn to_bits(self) -> u32 {
self.0
}
}
impl core::fmt::Debug for Wpkey {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self.0 {
0x0055_5341 => f.write_str("PASSWD"),
other => core::write!(f, "0x{:02X}", other),
}
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpkey {
fn format(&self, f: defmt::Formatter) {
match self.0 {
0x0055_5341 => defmt::write!(f, "PASSWD"),
other => defmt::write!(f, "0x{:02X}", other),
}
}
}
impl From<u32> for Wpkey {
#[inline(always)]
fn from(val: u32) -> Wpkey {
Wpkey::from_bits(val)
}
}
impl From<Wpkey> for u32 {
#[inline(always)]
fn from(val: Wpkey) -> u32 {
Wpkey::to_bits(val)
}
}