#[doc = "Baud Rate Generator Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Brgr(pub u32);
impl Brgr {
#[doc = "Clock Divisor"]
#[must_use]
#[inline(always)]
pub const fn cd(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Clock Divisor"]
#[inline(always)]
pub const fn set_cd(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Brgr {
#[inline(always)]
fn default() -> Brgr {
Brgr(0)
}
}
impl core::fmt::Debug for Brgr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Brgr").field("cd", &self.cd()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Brgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Brgr {{ cd: {=u16:?} }}", self.cd())
}
}
#[doc = "Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
#[doc = "Reset Receiver"]
#[must_use]
#[inline(always)]
pub const fn rstrx(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Reset Receiver"]
#[inline(always)]
pub const fn set_rstrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Reset Transmitter"]
#[must_use]
#[inline(always)]
pub const fn rsttx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Reset Transmitter"]
#[inline(always)]
pub const fn set_rsttx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Receiver Enable"]
#[must_use]
#[inline(always)]
pub const fn rxen(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Receiver Enable"]
#[inline(always)]
pub const fn set_rxen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Receiver Disable"]
#[must_use]
#[inline(always)]
pub const fn rxdis(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Receiver Disable"]
#[inline(always)]
pub const fn set_rxdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Transmitter Enable"]
#[must_use]
#[inline(always)]
pub const fn txen(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Transmitter Enable"]
#[inline(always)]
pub const fn set_txen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Transmitter Disable"]
#[must_use]
#[inline(always)]
pub const fn txdis(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Transmitter Disable"]
#[inline(always)]
pub const fn set_txdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Reset Status Bits"]
#[must_use]
#[inline(always)]
pub const fn rststa(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Reset Status Bits"]
#[inline(always)]
pub const fn set_rststa(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Cr {
#[inline(always)]
fn default() -> Cr {
Cr(0)
}
}
impl core::fmt::Debug for Cr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr")
.field("rstrx", &self.rstrx())
.field("rsttx", &self.rsttx())
.field("rxen", &self.rxen())
.field("rxdis", &self.rxdis())
.field("txen", &self.txen())
.field("txdis", &self.txdis())
.field("rststa", &self.rststa())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cr {{ rstrx: {=bool:?}, rsttx: {=bool:?}, rxen: {=bool:?}, rxdis: {=bool:?}, txen: {=bool:?}, txdis: {=bool:?}, rststa: {=bool:?} }}",
self.rstrx(),
self.rsttx(),
self.rxen(),
self.rxdis(),
self.txen(),
self.txdis(),
self.rststa()
)
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idr(pub u32);
impl Idr {
#[doc = "Disable RXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Disable RXRDY Interrupt"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Disable TXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Disable TXRDY Interrupt"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Disable End of Receive Transfer Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Disable End of Receive Transfer Interrupt"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Disable End of Transmit Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Disable End of Transmit Interrupt"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Disable Overrun Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Disable Overrun Error Interrupt"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Disable Framing Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Disable Framing Error Interrupt"]
#[inline(always)]
pub const fn set_frame(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Disable Parity Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Disable Parity Error Interrupt"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Disable TXEMPTY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Disable TXEMPTY Interrupt"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Disable Buffer Empty Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Disable Buffer Empty Interrupt"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Disable Buffer Full Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Disable Buffer Full Interrupt"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Idr {
#[inline(always)]
fn default() -> Idr {
Idr(0)
}
}
impl core::fmt::Debug for Idr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Idr")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Idr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.txempty(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "Enable RXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Enable RXRDY Interrupt"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Enable TXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Enable TXRDY Interrupt"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Enable End of Receive Transfer Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Enable End of Receive Transfer Interrupt"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Enable End of Transmit Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Enable End of Transmit Interrupt"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Enable Overrun Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Enable Overrun Error Interrupt"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Enable Framing Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Enable Framing Error Interrupt"]
#[inline(always)]
pub const fn set_frame(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Enable Parity Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Enable Parity Error Interrupt"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Enable TXEMPTY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Enable TXEMPTY Interrupt"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Enable Buffer Empty Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Enable Buffer Empty Interrupt"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Enable Buffer Full Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Enable Buffer Full Interrupt"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Ier {
#[inline(always)]
fn default() -> Ier {
Ier(0)
}
}
impl core::fmt::Debug for Ier {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ier")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ier {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.txempty(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "Mask RXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Mask RXRDY Interrupt"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Disable TXRDY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Disable TXRDY Interrupt"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Mask End of Receive Transfer Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Mask End of Receive Transfer Interrupt"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Mask End of Transmit Interrupt"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Mask End of Transmit Interrupt"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Mask Overrun Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Mask Overrun Error Interrupt"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Mask Framing Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Mask Framing Error Interrupt"]
#[inline(always)]
pub const fn set_frame(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Mask Parity Error Interrupt"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Mask Parity Error Interrupt"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Mask TXEMPTY Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Mask TXEMPTY Interrupt"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Mask TXBUFE Interrupt"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Mask TXBUFE Interrupt"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Mask RXBUFF Interrupt"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Mask RXBUFF Interrupt"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Imr {
#[inline(always)]
fn default() -> Imr {
Imr(0)
}
}
impl core::fmt::Debug for Imr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Imr")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Imr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.txempty(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mr(pub u32);
impl Mr {
#[doc = "Parity Type"]
#[must_use]
#[inline(always)]
pub const fn par(&self) -> super::vals::Par {
let val = (self.0 >> 9usize) & 0x07;
super::vals::Par::from_bits(val as u8)
}
#[doc = "Parity Type"]
#[inline(always)]
pub const fn set_par(&mut self, val: super::vals::Par) {
self.0 = (self.0 & !(0x07 << 9usize)) | (((val.to_bits() as u32) & 0x07) << 9usize);
}
#[doc = "Channel Mode"]
#[must_use]
#[inline(always)]
pub const fn chmode(&self) -> super::vals::Chmode {
let val = (self.0 >> 14usize) & 0x03;
super::vals::Chmode::from_bits(val as u8)
}
#[doc = "Channel Mode"]
#[inline(always)]
pub const fn set_chmode(&mut self, val: super::vals::Chmode) {
self.0 = (self.0 & !(0x03 << 14usize)) | (((val.to_bits() as u32) & 0x03) << 14usize);
}
}
impl Default for Mr {
#[inline(always)]
fn default() -> Mr {
Mr(0)
}
}
impl core::fmt::Debug for Mr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mr")
.field("par", &self.par())
.field("chmode", &self.chmode())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Mr {{ par: {:?}, chmode: {:?} }}",
self.par(),
self.chmode()
)
}
}
#[doc = "Transfer Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ptcr(pub u32);
impl Ptcr {
#[doc = "Receiver Transfer Enable"]
#[must_use]
#[inline(always)]
pub const fn rxten(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Receiver Transfer Enable"]
#[inline(always)]
pub const fn set_rxten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receiver Transfer Disable"]
#[must_use]
#[inline(always)]
pub const fn rxtdis(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Receiver Transfer Disable"]
#[inline(always)]
pub const fn set_rxtdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Transmitter Transfer Enable"]
#[must_use]
#[inline(always)]
pub const fn txten(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Transmitter Transfer Enable"]
#[inline(always)]
pub const fn set_txten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Transmitter Transfer Disable"]
#[must_use]
#[inline(always)]
pub const fn txtdis(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Transmitter Transfer Disable"]
#[inline(always)]
pub const fn set_txtdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
}
impl Default for Ptcr {
#[inline(always)]
fn default() -> Ptcr {
Ptcr(0)
}
}
impl core::fmt::Debug for Ptcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ptcr")
.field("rxten", &self.rxten())
.field("rxtdis", &self.rxtdis())
.field("txten", &self.txten())
.field("txtdis", &self.txtdis())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ptcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ptcr {{ rxten: {=bool:?}, rxtdis: {=bool:?}, txten: {=bool:?}, txtdis: {=bool:?} }}",
self.rxten(),
self.rxtdis(),
self.txten(),
self.txtdis()
)
}
}
#[doc = "Transfer Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ptsr(pub u32);
impl Ptsr {
#[doc = "Receiver Transfer Enable"]
#[must_use]
#[inline(always)]
pub const fn rxten(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Receiver Transfer Enable"]
#[inline(always)]
pub const fn set_rxten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Transmitter Transfer Enable"]
#[must_use]
#[inline(always)]
pub const fn txten(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Transmitter Transfer Enable"]
#[inline(always)]
pub const fn set_txten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
}
impl Default for Ptsr {
#[inline(always)]
fn default() -> Ptsr {
Ptsr(0)
}
}
impl core::fmt::Debug for Ptsr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ptsr")
.field("rxten", &self.rxten())
.field("txten", &self.txten())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ptsr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ptsr {{ rxten: {=bool:?}, txten: {=bool:?} }}",
self.rxten(),
self.txten()
)
}
}
#[doc = "Receive Counter Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rcr(pub u32);
impl Rcr {
#[doc = "Receive Counter Register"]
#[must_use]
#[inline(always)]
pub const fn rxctr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Receive Counter Register"]
#[inline(always)]
pub const fn set_rxctr(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Rcr {
#[inline(always)]
fn default() -> Rcr {
Rcr(0)
}
}
impl core::fmt::Debug for Rcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rcr").field("rxctr", &self.rxctr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rcr {{ rxctr: {=u16:?} }}", self.rxctr())
}
}
#[doc = "Receive Holding Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rhr(pub u32);
impl Rhr {
#[doc = "Received Character"]
#[must_use]
#[inline(always)]
pub const fn rxchr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Received Character"]
#[inline(always)]
pub const fn set_rxchr(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Rhr {
#[inline(always)]
fn default() -> Rhr {
Rhr(0)
}
}
impl core::fmt::Debug for Rhr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rhr").field("rxchr", &self.rxchr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rhr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rhr {{ rxchr: {=u8:?} }}", self.rxchr())
}
}
#[doc = "Receive Next Counter Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rncr(pub u32);
impl Rncr {
#[doc = "Receive Next Counter"]
#[must_use]
#[inline(always)]
pub const fn rxnctr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Receive Next Counter"]
#[inline(always)]
pub const fn set_rxnctr(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Rncr {
#[inline(always)]
fn default() -> Rncr {
Rncr(0)
}
}
impl core::fmt::Debug for Rncr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rncr")
.field("rxnctr", &self.rxnctr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rncr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rncr {{ rxnctr: {=u16:?} }}", self.rxnctr())
}
}
#[doc = "Receive Next Pointer Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rnpr(pub u32);
impl Rnpr {
#[doc = "Receive Next Pointer"]
#[must_use]
#[inline(always)]
pub const fn rxnptr(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "Receive Next Pointer"]
#[inline(always)]
pub const fn set_rxnptr(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Rnpr {
#[inline(always)]
fn default() -> Rnpr {
Rnpr(0)
}
}
impl core::fmt::Debug for Rnpr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rnpr")
.field("rxnptr", &self.rxnptr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rnpr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rnpr {{ rxnptr: {=u32:?} }}", self.rxnptr())
}
}
#[doc = "Receive Pointer Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rpr(pub u32);
impl Rpr {
#[doc = "Receive Pointer Register"]
#[must_use]
#[inline(always)]
pub const fn rxptr(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "Receive Pointer Register"]
#[inline(always)]
pub const fn set_rxptr(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Rpr {
#[inline(always)]
fn default() -> Rpr {
Rpr(0)
}
}
impl core::fmt::Debug for Rpr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rpr").field("rxptr", &self.rxptr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rpr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rpr {{ rxptr: {=u32:?} }}", self.rxptr())
}
}
#[doc = "Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sr(pub u32);
impl Sr {
#[doc = "Receiver Ready"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Receiver Ready"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Transmitter Ready"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Transmitter Ready"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "End of Receiver Transfer"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "End of Receiver Transfer"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "End of Transmitter Transfer"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "End of Transmitter Transfer"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Overrun Error"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Framing Error"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error"]
#[inline(always)]
pub const fn set_frame(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Parity Error"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Transmitter Empty"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Transmitter Empty"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Transmission Buffer Empty"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Transmission Buffer Empty"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Receive Buffer Full"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Receive Buffer Full"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Sr {
#[inline(always)]
fn default() -> Sr {
Sr(0)
}
}
impl core::fmt::Debug for Sr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sr")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Sr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.txempty(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "Transmit Counter Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tcr(pub u32);
impl Tcr {
#[doc = "Transmit Counter Register"]
#[must_use]
#[inline(always)]
pub const fn txctr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Transmit Counter Register"]
#[inline(always)]
pub const fn set_txctr(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Tcr {
#[inline(always)]
fn default() -> Tcr {
Tcr(0)
}
}
impl core::fmt::Debug for Tcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tcr").field("txctr", &self.txctr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tcr {{ txctr: {=u16:?} }}", self.txctr())
}
}
#[doc = "Transmit Holding Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Thr(pub u32);
impl Thr {
#[doc = "Character to be Transmitted"]
#[must_use]
#[inline(always)]
pub const fn txchr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Character to be Transmitted"]
#[inline(always)]
pub const fn set_txchr(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Thr {
#[inline(always)]
fn default() -> Thr {
Thr(0)
}
}
impl core::fmt::Debug for Thr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Thr").field("txchr", &self.txchr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Thr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Thr {{ txchr: {=u8:?} }}", self.txchr())
}
}
#[doc = "Transmit Next Counter Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tncr(pub u32);
impl Tncr {
#[doc = "Transmit Counter Next"]
#[must_use]
#[inline(always)]
pub const fn txnctr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Transmit Counter Next"]
#[inline(always)]
pub const fn set_txnctr(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Tncr {
#[inline(always)]
fn default() -> Tncr {
Tncr(0)
}
}
impl core::fmt::Debug for Tncr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tncr")
.field("txnctr", &self.txnctr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tncr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tncr {{ txnctr: {=u16:?} }}", self.txnctr())
}
}
#[doc = "Transmit Next Pointer Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tnpr(pub u32);
impl Tnpr {
#[doc = "Transmit Next Pointer"]
#[must_use]
#[inline(always)]
pub const fn txnptr(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "Transmit Next Pointer"]
#[inline(always)]
pub const fn set_txnptr(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Tnpr {
#[inline(always)]
fn default() -> Tnpr {
Tnpr(0)
}
}
impl core::fmt::Debug for Tnpr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tnpr")
.field("txnptr", &self.txnptr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tnpr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tnpr {{ txnptr: {=u32:?} }}", self.txnptr())
}
}
#[doc = "Transmit Pointer Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tpr(pub u32);
impl Tpr {
#[doc = "Transmit Counter Register"]
#[must_use]
#[inline(always)]
pub const fn txptr(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "Transmit Counter Register"]
#[inline(always)]
pub const fn set_txptr(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Tpr {
#[inline(always)]
fn default() -> Tpr {
Tpr(0)
}
}
impl core::fmt::Debug for Tpr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tpr").field("txptr", &self.txptr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tpr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tpr {{ txptr: {=u32:?} }}", self.txptr())
}
}