#[doc = "Baud Rate Generator Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Brgr(pub u32);
impl Brgr {
#[doc = "Clock Divider"]
#[must_use]
#[inline(always)]
pub const fn cd(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Clock Divider"]
#[inline(always)]
pub const fn set_cd(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
#[doc = "Fractional Part"]
#[must_use]
#[inline(always)]
pub const fn fp(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x07;
val as u8
}
#[doc = "Fractional Part"]
#[inline(always)]
pub const fn set_fp(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 16usize)) | (((val as u32) & 0x07) << 16usize);
}
}
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())
.field("fp", &self.fp())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Brgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Brgr {{ cd: {=u16:?}, fp: {=u8:?} }}",
self.cd(),
self.fp()
)
}
}
#[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);
}
#[doc = "Start Break"]
#[must_use]
#[inline(always)]
pub const fn sttbrk(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Start Break"]
#[inline(always)]
pub const fn set_sttbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Stop Break"]
#[must_use]
#[inline(always)]
pub const fn stpbrk(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Stop Break"]
#[inline(always)]
pub const fn set_stpbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Start Time-out"]
#[must_use]
#[inline(always)]
pub const fn sttto(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Start Time-out"]
#[inline(always)]
pub const fn set_sttto(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Send Address"]
#[must_use]
#[inline(always)]
pub const fn senda(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Send Address"]
#[inline(always)]
pub const fn set_senda(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Reset Iterations"]
#[must_use]
#[inline(always)]
pub const fn rstit(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Reset Iterations"]
#[inline(always)]
pub const fn set_rstit(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Reset Non Acknowledge"]
#[must_use]
#[inline(always)]
pub const fn rstnack(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Reset Non Acknowledge"]
#[inline(always)]
pub const fn set_rstnack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Rearm Time-out"]
#[must_use]
#[inline(always)]
pub const fn retto(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Rearm Time-out"]
#[inline(always)]
pub const fn set_retto(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "Request to Send Enable"]
#[must_use]
#[inline(always)]
pub const fn rtsen(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Request to Send Enable"]
#[inline(always)]
pub const fn set_rtsen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Request to Send Disable"]
#[must_use]
#[inline(always)]
pub const fn rtsdis(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Request to Send Disable"]
#[inline(always)]
pub const fn set_rtsdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Abort LIN Transmission"]
#[must_use]
#[inline(always)]
pub const fn linabt(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Abort LIN Transmission"]
#[inline(always)]
pub const fn set_linabt(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Send LIN Wakeup Signal"]
#[must_use]
#[inline(always)]
pub const fn linwkup(&self) -> bool {
let val = (self.0 >> 21usize) & 0x01;
val != 0
}
#[doc = "Send LIN Wakeup Signal"]
#[inline(always)]
pub const fn set_linwkup(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
}
}
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())
.field("sttbrk", &self.sttbrk())
.field("stpbrk", &self.stpbrk())
.field("sttto", &self.sttto())
.field("senda", &self.senda())
.field("rstit", &self.rstit())
.field("rstnack", &self.rstnack())
.field("retto", &self.retto())
.field("rtsen", &self.rtsen())
.field("rtsdis", &self.rtsdis())
.field("linabt", &self.linabt())
.field("linwkup", &self.linwkup())
.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:?}, sttbrk: {=bool:?}, stpbrk: {=bool:?}, sttto: {=bool:?}, senda: {=bool:?}, rstit: {=bool:?}, rstnack: {=bool:?}, retto: {=bool:?}, rtsen: {=bool:?}, rtsdis: {=bool:?}, linabt: {=bool:?}, linwkup: {=bool:?} }}",
self.rstrx(),
self.rsttx(),
self.rxen(),
self.rxdis(),
self.txen(),
self.txdis(),
self.rststa(),
self.sttbrk(),
self.stpbrk(),
self.sttto(),
self.senda(),
self.rstit(),
self.rstnack(),
self.retto(),
self.rtsen(),
self.rtsdis(),
self.linabt(),
self.linwkup()
)
}
}
#[doc = "Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CrSpiMode(pub u32);
impl CrSpiMode {
#[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);
}
#[doc = "Force SPI Chip Select"]
#[must_use]
#[inline(always)]
pub const fn fcs(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Force SPI Chip Select"]
#[inline(always)]
pub const fn set_fcs(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Release SPI Chip Select"]
#[must_use]
#[inline(always)]
pub const fn rcs(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Release SPI Chip Select"]
#[inline(always)]
pub const fn set_rcs(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
}
impl Default for CrSpiMode {
#[inline(always)]
fn default() -> CrSpiMode {
CrSpiMode(0)
}
}
impl core::fmt::Debug for CrSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CrSpiMode")
.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())
.field("fcs", &self.fcs())
.field("rcs", &self.rcs())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CrSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"CrSpiMode {{ rstrx: {=bool:?}, rsttx: {=bool:?}, rxen: {=bool:?}, rxdis: {=bool:?}, txen: {=bool:?}, txdis: {=bool:?}, rststa: {=bool:?}, fcs: {=bool:?}, rcs: {=bool:?} }}",
self.rstrx(),
self.rsttx(),
self.rxen(),
self.rxdis(),
self.txen(),
self.txdis(),
self.rststa(),
self.fcs(),
self.rcs()
)
}
}
#[doc = "Channel Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Csr(pub u32);
impl Csr {
#[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 = "Break Received/End of Break"]
#[must_use]
#[inline(always)]
pub const fn rxbrk(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Break Received/End of Break"]
#[inline(always)]
pub const fn set_rxbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[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 = "Receiver Time-out"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Receiver Time-out"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[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 = "Max Number of Repetitions Reached"]
#[must_use]
#[inline(always)]
pub const fn iter(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Max Number of Repetitions Reached"]
#[inline(always)]
pub const fn set_iter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[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 = "Reception Buffer Full"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Reception Buffer Full"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Non Acknowledge Interrupt"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Non Acknowledge Interrupt"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Clear to Send Input Change Flag"]
#[must_use]
#[inline(always)]
pub const fn ctsic(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Clear to Send Input Change Flag"]
#[inline(always)]
pub const fn set_ctsic(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Image of CTS Input"]
#[must_use]
#[inline(always)]
pub const fn cts(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Image of CTS Input"]
#[inline(always)]
pub const fn set_cts(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Manchester Error"]
#[must_use]
#[inline(always)]
pub const fn manerr(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Manchester Error"]
#[inline(always)]
pub const fn set_manerr(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
impl Default for Csr {
#[inline(always)]
fn default() -> Csr {
Csr(0)
}
}
impl core::fmt::Debug for Csr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Csr")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("rxbrk", &self.rxbrk())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("iter", &self.iter())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("nack", &self.nack())
.field("ctsic", &self.ctsic())
.field("cts", &self.cts())
.field("manerr", &self.manerr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Csr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Csr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, rxbrk: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, iter: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, nack: {=bool:?}, ctsic: {=bool:?}, cts: {=bool:?}, manerr: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.rxbrk(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.iter(),
self.txbufe(),
self.rxbuff(),
self.nack(),
self.ctsic(),
self.cts(),
self.manerr()
)
}
}
#[doc = "Channel Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CsrLinMode(pub u32);
impl CsrLinMode {
#[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);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 = "Receiver Time-out"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Receiver Time-out"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[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);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "LIN Break Sent or LIN Break Received"]
#[must_use]
#[inline(always)]
pub const fn linbk(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "LIN Break Sent or LIN Break Received"]
#[inline(always)]
pub const fn set_linbk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "LIN Identifier Sent or LIN Identifier Received"]
#[must_use]
#[inline(always)]
pub const fn linid(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Sent or LIN Identifier Received"]
#[inline(always)]
pub const fn set_linid(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "LIN Transfer Completed"]
#[must_use]
#[inline(always)]
pub const fn lintc(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "LIN Transfer Completed"]
#[inline(always)]
pub const fn set_lintc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "LIN Bus Line Status"]
#[must_use]
#[inline(always)]
pub const fn linbls(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "LIN Bus Line Status"]
#[inline(always)]
pub const fn set_linbls(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "LIN Bit Error"]
#[must_use]
#[inline(always)]
pub const fn linbe(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "LIN Bit Error"]
#[inline(always)]
pub const fn set_linbe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "LIN Inconsistent Synch Field Error"]
#[must_use]
#[inline(always)]
pub const fn linisfe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "LIN Inconsistent Synch Field Error"]
#[inline(always)]
pub const fn set_linisfe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "LIN Identifier Parity Error"]
#[must_use]
#[inline(always)]
pub const fn linipe(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Parity Error"]
#[inline(always)]
pub const fn set_linipe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "LIN Checksum Error"]
#[must_use]
#[inline(always)]
pub const fn lince(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "LIN Checksum Error"]
#[inline(always)]
pub const fn set_lince(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "LIN Slave Not Responding Error"]
#[must_use]
#[inline(always)]
pub const fn linsnre(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "LIN Slave Not Responding Error"]
#[inline(always)]
pub const fn set_linsnre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
}
impl Default for CsrLinMode {
#[inline(always)]
fn default() -> CsrLinMode {
CsrLinMode(0)
}
}
impl core::fmt::Debug for CsrLinMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CsrLinMode")
.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("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("linbk", &self.linbk())
.field("linid", &self.linid())
.field("lintc", &self.lintc())
.field("linbls", &self.linbls())
.field("linbe", &self.linbe())
.field("linisfe", &self.linisfe())
.field("linipe", &self.linipe())
.field("lince", &self.lince())
.field("linsnre", &self.linsnre())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CsrLinMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"CsrLinMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, linbk: {=bool:?}, linid: {=bool:?}, lintc: {=bool:?}, linbls: {=bool:?}, linbe: {=bool:?}, linisfe: {=bool:?}, linipe: {=bool:?}, lince: {=bool:?}, linsnre: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.txbufe(),
self.rxbuff(),
self.linbk(),
self.linid(),
self.lintc(),
self.linbls(),
self.linbe(),
self.linisfe(),
self.linipe(),
self.lince(),
self.linsnre()
)
}
}
#[doc = "Channel Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct CsrSpiMode(pub u32);
impl CsrSpiMode {
#[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);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 = "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 = "Underrun Error"]
#[must_use]
#[inline(always)]
pub const fn unre(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Underrun Error"]
#[inline(always)]
pub const fn set_unre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[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 CsrSpiMode {
#[inline(always)]
fn default() -> CsrSpiMode {
CsrSpiMode(0)
}
}
impl core::fmt::Debug for CsrSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CsrSpiMode")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("txempty", &self.txempty())
.field("unre", &self.unre())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for CsrSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"CsrSpiMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, txempty: {=bool:?}, unre: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.txempty(),
self.unre(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "FI DI Ratio Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Fidi(pub u32);
impl Fidi {
#[doc = "FI Over DI Ratio Value"]
#[must_use]
#[inline(always)]
pub const fn fi_di_ratio(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x07ff;
val as u16
}
#[doc = "FI Over DI Ratio Value"]
#[inline(always)]
pub const fn set_fi_di_ratio(&mut self, val: u16) {
self.0 = (self.0 & !(0x07ff << 0usize)) | (((val as u32) & 0x07ff) << 0usize);
}
}
impl Default for Fidi {
#[inline(always)]
fn default() -> Fidi {
Fidi(0)
}
}
impl core::fmt::Debug for Fidi {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Fidi")
.field("fi_di_ratio", &self.fi_di_ratio())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Fidi {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Fidi {{ fi_di_ratio: {=u16:?} }}", self.fi_di_ratio())
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idr(pub u32);
impl Idr {
#[doc = "RXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Receiver Break Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxbrk(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Receiver Break Interrupt Disable"]
#[inline(always)]
pub const fn set_rxbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "End of Receive Transfer Interrupt Disable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "End of Receive Transfer Interrupt Disable (available in all USART modes of operation)"]
#[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 Transmit Interrupt Disable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Interrupt Disable (available in all USART modes of operation)"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Enable"]
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Disable"]
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Disable"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Disable"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Disable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Max Number of Repetitions Reached Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn iter(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Max Number of Repetitions Reached Interrupt Disable"]
#[inline(always)]
pub const fn set_iter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Buffer Empty Interrupt Disable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Buffer Empty Interrupt Disable (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Buffer Full Interrupt Disable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Buffer Full Interrupt Disable (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Non Acknowledge Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Non Acknowledge Interrupt Disable"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Clear to Send Input Change Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn ctsic(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Clear to Send Input Change Interrupt Disable"]
#[inline(always)]
pub const fn set_ctsic(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Manchester Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn mane(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Manchester Error Interrupt Disable"]
#[inline(always)]
pub const fn set_mane(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
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("rxbrk", &self.rxbrk())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("iter", &self.iter())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("nack", &self.nack())
.field("ctsic", &self.ctsic())
.field("mane", &self.mane())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Idr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, rxbrk: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, iter: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, nack: {=bool:?}, ctsic: {=bool:?}, mane: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.rxbrk(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.iter(),
self.txbufe(),
self.rxbuff(),
self.nack(),
self.ctsic(),
self.mane()
)
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IdrLinMode(pub u32);
impl IdrLinMode {
#[doc = "RXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Disable"]
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Disable"]
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Disable"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Disable"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Disable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linbk(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Disable"]
#[inline(always)]
pub const fn set_linbk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linid(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Disable"]
#[inline(always)]
pub const fn set_linid(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "LIN Transfer Completed Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn lintc(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "LIN Transfer Completed Interrupt Disable"]
#[inline(always)]
pub const fn set_lintc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "LIN Bus Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linbe(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "LIN Bus Error Interrupt Disable"]
#[inline(always)]
pub const fn set_linbe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linisfe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Disable"]
#[inline(always)]
pub const fn set_linisfe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "LIN Identifier Parity Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linipe(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Parity Interrupt Disable"]
#[inline(always)]
pub const fn set_linipe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "LIN Checksum Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn lince(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "LIN Checksum Error Interrupt Disable"]
#[inline(always)]
pub const fn set_lince(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "LIN Slave Not Responding Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn linsnre(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "LIN Slave Not Responding Error Interrupt Disable"]
#[inline(always)]
pub const fn set_linsnre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
}
impl Default for IdrLinMode {
#[inline(always)]
fn default() -> IdrLinMode {
IdrLinMode(0)
}
}
impl core::fmt::Debug for IdrLinMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IdrLinMode")
.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("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("linbk", &self.linbk())
.field("linid", &self.linid())
.field("lintc", &self.lintc())
.field("linbe", &self.linbe())
.field("linisfe", &self.linisfe())
.field("linipe", &self.linipe())
.field("lince", &self.lince())
.field("linsnre", &self.linsnre())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IdrLinMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"IdrLinMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, linbk: {=bool:?}, linid: {=bool:?}, lintc: {=bool:?}, linbe: {=bool:?}, linisfe: {=bool:?}, linipe: {=bool:?}, lince: {=bool:?}, linsnre: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.txbufe(),
self.rxbuff(),
self.linbk(),
self.linid(),
self.lintc(),
self.linbe(),
self.linisfe(),
self.linipe(),
self.lince(),
self.linsnre()
)
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IdrSpiMode(pub u32);
impl IdrSpiMode {
#[doc = "RXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Disable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Disable"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "TXEMPTY Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Disable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "SPI Underrun Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn unre(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "SPI Underrun Error Interrupt Disable"]
#[inline(always)]
pub const fn set_unre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[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 IdrSpiMode {
#[inline(always)]
fn default() -> IdrSpiMode {
IdrSpiMode(0)
}
}
impl core::fmt::Debug for IdrSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IdrSpiMode")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("txempty", &self.txempty())
.field("unre", &self.unre())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IdrSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"IdrSpiMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, txempty: {=bool:?}, unre: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.txempty(),
self.unre(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "RXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Receiver Break Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxbrk(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Receiver Break Interrupt Enable"]
#[inline(always)]
pub const fn set_rxbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "End of Receive Transfer Interrupt Enable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "End of Receive Transfer Interrupt Enable (available in all USART modes of operation)"]
#[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 Transmit Interrupt Enable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Interrupt Enable (available in all USART modes of operation)"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Enable"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Enable"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Enable"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Enable"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Enable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Max number of Repetitions Reached Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn iter(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Max number of Repetitions Reached Interrupt Enable"]
#[inline(always)]
pub const fn set_iter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Buffer Empty Interrupt Enable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Buffer Empty Interrupt Enable (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Buffer Full Interrupt Enable (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Buffer Full Interrupt Enable (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Non Acknowledge Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Non Acknowledge Interrupt Enable"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Clear to Send Input Change Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ctsic(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Clear to Send Input Change Interrupt Enable"]
#[inline(always)]
pub const fn set_ctsic(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Manchester Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn mane(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Manchester Error Interrupt Enable"]
#[inline(always)]
pub const fn set_mane(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
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("rxbrk", &self.rxbrk())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("iter", &self.iter())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("nack", &self.nack())
.field("ctsic", &self.ctsic())
.field("mane", &self.mane())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ier {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, rxbrk: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, iter: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, nack: {=bool:?}, ctsic: {=bool:?}, mane: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.rxbrk(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.iter(),
self.txbufe(),
self.rxbuff(),
self.nack(),
self.ctsic(),
self.mane()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IerLinMode(pub u32);
impl IerLinMode {
#[doc = "RXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Enable"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Enable"]
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Enable"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Enable"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Enable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linbk(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Enable"]
#[inline(always)]
pub const fn set_linbk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linid(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Enable"]
#[inline(always)]
pub const fn set_linid(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "LIN Transfer Completed Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn lintc(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "LIN Transfer Completed Interrupt Enable"]
#[inline(always)]
pub const fn set_lintc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "LIN Bus Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linbe(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "LIN Bus Error Interrupt Enable"]
#[inline(always)]
pub const fn set_linbe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linisfe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Enable"]
#[inline(always)]
pub const fn set_linisfe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "LIN Identifier Parity Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linipe(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Parity Interrupt Enable"]
#[inline(always)]
pub const fn set_linipe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "LIN Checksum Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn lince(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "LIN Checksum Error Interrupt Enable"]
#[inline(always)]
pub const fn set_lince(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "LIN Slave Not Responding Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn linsnre(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "LIN Slave Not Responding Error Interrupt Enable"]
#[inline(always)]
pub const fn set_linsnre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
}
impl Default for IerLinMode {
#[inline(always)]
fn default() -> IerLinMode {
IerLinMode(0)
}
}
impl core::fmt::Debug for IerLinMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IerLinMode")
.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("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("linbk", &self.linbk())
.field("linid", &self.linid())
.field("lintc", &self.lintc())
.field("linbe", &self.linbe())
.field("linisfe", &self.linisfe())
.field("linipe", &self.linipe())
.field("lince", &self.lince())
.field("linsnre", &self.linsnre())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IerLinMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"IerLinMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, linbk: {=bool:?}, linid: {=bool:?}, lintc: {=bool:?}, linbe: {=bool:?}, linisfe: {=bool:?}, linipe: {=bool:?}, lince: {=bool:?}, linsnre: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.txbufe(),
self.rxbuff(),
self.linbk(),
self.linid(),
self.lintc(),
self.linbe(),
self.linisfe(),
self.linipe(),
self.lince(),
self.linsnre()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct IerSpiMode(pub u32);
impl IerSpiMode {
#[doc = "RXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Enable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Enable"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "TXEMPTY Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Enable"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "SPI Underrun Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn unre(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "SPI Underrun Error Interrupt Enable"]
#[inline(always)]
pub const fn set_unre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[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 IerSpiMode {
#[inline(always)]
fn default() -> IerSpiMode {
IerSpiMode(0)
}
}
impl core::fmt::Debug for IerSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IerSpiMode")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("txempty", &self.txempty())
.field("unre", &self.unre())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for IerSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"IerSpiMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, txempty: {=bool:?}, unre: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.txempty(),
self.unre(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "IrDA Filter Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct If(pub u32);
impl If {
#[doc = "IrDA Filter"]
#[must_use]
#[inline(always)]
pub const fn irda_filter(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "IrDA Filter"]
#[inline(always)]
pub const fn set_irda_filter(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for If {
#[inline(always)]
fn default() -> If {
If(0)
}
}
impl core::fmt::Debug for If {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("If")
.field("irda_filter", &self.irda_filter())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for If {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "If {{ irda_filter: {=u8:?} }}", self.irda_filter())
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "RXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Receiver Break Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxbrk(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Receiver Break Interrupt Mask"]
#[inline(always)]
pub const fn set_rxbrk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "End of Receive Transfer Interrupt Mask (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "End of Receive Transfer Interrupt Mask (available in all USART modes of operation)"]
#[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 Transmit Interrupt Mask (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Interrupt Mask (available in all USART modes of operation)"]
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Mask"]
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Mask"]
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Mask"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Mask"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Mask"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Max Number of Repetitions Reached Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn iter(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Max Number of Repetitions Reached Interrupt Mask"]
#[inline(always)]
pub const fn set_iter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Buffer Empty Interrupt Mask (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Buffer Empty Interrupt Mask (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Buffer Full Interrupt Mask (available in all USART modes of operation)"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Buffer Full Interrupt Mask (available in all USART modes of operation)"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Non Acknowledge Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Non Acknowledge Interrupt Mask"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Clear to Send Input Change Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ctsic(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Clear to Send Input Change Interrupt Mask"]
#[inline(always)]
pub const fn set_ctsic(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Manchester Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn mane(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Manchester Error Interrupt Mask"]
#[inline(always)]
pub const fn set_mane(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
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("rxbrk", &self.rxbrk())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("frame", &self.frame())
.field("pare", &self.pare())
.field("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("iter", &self.iter())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("nack", &self.nack())
.field("ctsic", &self.ctsic())
.field("mane", &self.mane())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Imr {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, rxbrk: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, iter: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, nack: {=bool:?}, ctsic: {=bool:?}, mane: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.rxbrk(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.iter(),
self.txbufe(),
self.rxbuff(),
self.nack(),
self.ctsic(),
self.mane()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ImrLinMode(pub u32);
impl ImrLinMode {
#[doc = "RXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Mask"]
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn frame(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Framing Error Interrupt Mask"]
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn pare(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Parity Error Interrupt Mask"]
#[inline(always)]
pub const fn set_pare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Time-out Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn timeout(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Time-out Interrupt Mask"]
#[inline(always)]
pub const fn set_timeout(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "TXEMPTY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Mask"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linbk(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "LIN Break Sent or LIN Break Received Interrupt Mask"]
#[inline(always)]
pub const fn set_linbk(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linid(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Sent or LIN Identifier Received Interrupt Mask"]
#[inline(always)]
pub const fn set_linid(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "LIN Transfer Completed Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn lintc(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "LIN Transfer Completed Interrupt Mask"]
#[inline(always)]
pub const fn set_lintc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "LIN Bus Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linbe(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "LIN Bus Error Interrupt Mask"]
#[inline(always)]
pub const fn set_linbe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linisfe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "LIN Inconsistent Synch Field Error Interrupt Mask"]
#[inline(always)]
pub const fn set_linisfe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "LIN Identifier Parity Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linipe(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "LIN Identifier Parity Interrupt Mask"]
#[inline(always)]
pub const fn set_linipe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "LIN Checksum Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn lince(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "LIN Checksum Error Interrupt Mask"]
#[inline(always)]
pub const fn set_lince(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "LIN Slave Not Responding Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn linsnre(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "LIN Slave Not Responding Error Interrupt Mask"]
#[inline(always)]
pub const fn set_linsnre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
}
impl Default for ImrLinMode {
#[inline(always)]
fn default() -> ImrLinMode {
ImrLinMode(0)
}
}
impl core::fmt::Debug for ImrLinMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ImrLinMode")
.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("timeout", &self.timeout())
.field("txempty", &self.txempty())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.field("linbk", &self.linbk())
.field("linid", &self.linid())
.field("lintc", &self.lintc())
.field("linbe", &self.linbe())
.field("linisfe", &self.linisfe())
.field("linipe", &self.linipe())
.field("lince", &self.lince())
.field("linsnre", &self.linsnre())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ImrLinMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"ImrLinMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, frame: {=bool:?}, pare: {=bool:?}, timeout: {=bool:?}, txempty: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?}, linbk: {=bool:?}, linid: {=bool:?}, lintc: {=bool:?}, linbe: {=bool:?}, linisfe: {=bool:?}, linipe: {=bool:?}, lince: {=bool:?}, linsnre: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.frame(),
self.pare(),
self.timeout(),
self.txempty(),
self.txbufe(),
self.rxbuff(),
self.linbk(),
self.linid(),
self.lintc(),
self.linbe(),
self.linisfe(),
self.linipe(),
self.lince(),
self.linsnre()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ImrSpiMode(pub u32);
impl ImrSpiMode {
#[doc = "RXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "RXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "TXRDY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TXRDY Interrupt Mask"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[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 Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Mask"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "TXEMPTY Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txempty(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "TXEMPTY Interrupt Mask"]
#[inline(always)]
pub const fn set_txempty(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "SPI Underrun Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn unre(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "SPI Underrun Error Interrupt Mask"]
#[inline(always)]
pub const fn set_unre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[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 ImrSpiMode {
#[inline(always)]
fn default() -> ImrSpiMode {
ImrSpiMode(0)
}
}
impl core::fmt::Debug for ImrSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ImrSpiMode")
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("ovre", &self.ovre())
.field("txempty", &self.txempty())
.field("unre", &self.unre())
.field("txbufe", &self.txbufe())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for ImrSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"ImrSpiMode {{ rxrdy: {=bool:?}, txrdy: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, ovre: {=bool:?}, txempty: {=bool:?}, unre: {=bool:?}, txbufe: {=bool:?}, rxbuff: {=bool:?} }}",
self.rxrdy(),
self.txrdy(),
self.endrx(),
self.endtx(),
self.ovre(),
self.txempty(),
self.unre(),
self.txbufe(),
self.rxbuff()
)
}
}
#[doc = "LIN Baud Rate Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Linbrr(pub u32);
impl Linbrr {
#[doc = "Clock Divider after Synchronization"]
#[must_use]
#[inline(always)]
pub const fn lincd(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "Clock Divider after Synchronization"]
#[inline(always)]
pub const fn set_lincd(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
#[doc = "Fractional Part after Synchronization"]
#[must_use]
#[inline(always)]
pub const fn linfp(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x07;
val as u8
}
#[doc = "Fractional Part after Synchronization"]
#[inline(always)]
pub const fn set_linfp(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 16usize)) | (((val as u32) & 0x07) << 16usize);
}
}
impl Default for Linbrr {
#[inline(always)]
fn default() -> Linbrr {
Linbrr(0)
}
}
impl core::fmt::Debug for Linbrr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Linbrr")
.field("lincd", &self.lincd())
.field("linfp", &self.linfp())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Linbrr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Linbrr {{ lincd: {=u16:?}, linfp: {=u8:?} }}",
self.lincd(),
self.linfp()
)
}
}
#[doc = "LIN Identifier Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Linir(pub u32);
impl Linir {
#[doc = "Identifier Character"]
#[must_use]
#[inline(always)]
pub const fn idchr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Identifier Character"]
#[inline(always)]
pub const fn set_idchr(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Linir {
#[inline(always)]
fn default() -> Linir {
Linir(0)
}
}
impl core::fmt::Debug for Linir {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Linir")
.field("idchr", &self.idchr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Linir {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Linir {{ idchr: {=u8:?} }}", self.idchr())
}
}
#[doc = "LIN Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Linmr(pub u32);
impl Linmr {
#[doc = "LIN Node Action"]
#[must_use]
#[inline(always)]
pub const fn nact(&self) -> super::vals::Nact {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Nact::from_bits(val as u8)
}
#[doc = "LIN Node Action"]
#[inline(always)]
pub const fn set_nact(&mut self, val: super::vals::Nact) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Parity Disable"]
#[must_use]
#[inline(always)]
pub const fn pardis(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Parity Disable"]
#[inline(always)]
pub const fn set_pardis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Checksum Disable"]
#[must_use]
#[inline(always)]
pub const fn chkdis(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Checksum Disable"]
#[inline(always)]
pub const fn set_chkdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Checksum Type"]
#[must_use]
#[inline(always)]
pub const fn chktyp(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Checksum Type"]
#[inline(always)]
pub const fn set_chktyp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Data Length Mode"]
#[must_use]
#[inline(always)]
pub const fn dlm(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Data Length Mode"]
#[inline(always)]
pub const fn set_dlm(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Frame Slot Mode Disable"]
#[must_use]
#[inline(always)]
pub const fn fsdis(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Frame Slot Mode Disable"]
#[inline(always)]
pub const fn set_fsdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Wakeup Signal Type"]
#[must_use]
#[inline(always)]
pub const fn wkuptyp(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Wakeup Signal Type"]
#[inline(always)]
pub const fn set_wkuptyp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "Data Length Control"]
#[must_use]
#[inline(always)]
pub const fn dlc(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Data Length Control"]
#[inline(always)]
pub const fn set_dlc(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "PDC Mode"]
#[must_use]
#[inline(always)]
pub const fn pdcm(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "PDC Mode"]
#[inline(always)]
pub const fn set_pdcm(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
}
impl Default for Linmr {
#[inline(always)]
fn default() -> Linmr {
Linmr(0)
}
}
impl core::fmt::Debug for Linmr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Linmr")
.field("nact", &self.nact())
.field("pardis", &self.pardis())
.field("chkdis", &self.chkdis())
.field("chktyp", &self.chktyp())
.field("dlm", &self.dlm())
.field("fsdis", &self.fsdis())
.field("wkuptyp", &self.wkuptyp())
.field("dlc", &self.dlc())
.field("pdcm", &self.pdcm())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Linmr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Linmr {{ nact: {:?}, pardis: {=bool:?}, chkdis: {=bool:?}, chktyp: {=bool:?}, dlm: {=bool:?}, fsdis: {=bool:?}, wkuptyp: {=bool:?}, dlc: {=u8:?}, pdcm: {=bool:?} }}",
self.nact(),
self.pardis(),
self.chkdis(),
self.chktyp(),
self.dlm(),
self.fsdis(),
self.wkuptyp(),
self.dlc(),
self.pdcm()
)
}
}
#[doc = "Manchester Configuration Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Man(pub u32);
impl Man {
#[doc = "Transmitter Preamble Length"]
#[must_use]
#[inline(always)]
pub const fn tx_pl(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "Transmitter Preamble Length"]
#[inline(always)]
pub const fn set_tx_pl(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
#[doc = "Transmitter Preamble Pattern"]
#[must_use]
#[inline(always)]
pub const fn tx_pp(&self) -> super::vals::TxPp {
let val = (self.0 >> 8usize) & 0x03;
super::vals::TxPp::from_bits(val as u8)
}
#[doc = "Transmitter Preamble Pattern"]
#[inline(always)]
pub const fn set_tx_pp(&mut self, val: super::vals::TxPp) {
self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
}
#[doc = "Transmitter Manchester Polarity"]
#[must_use]
#[inline(always)]
pub const fn tx_mpol(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Transmitter Manchester Polarity"]
#[inline(always)]
pub const fn set_tx_mpol(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Receiver Preamble Length"]
#[must_use]
#[inline(always)]
pub const fn rx_pl(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x0f;
val as u8
}
#[doc = "Receiver Preamble Length"]
#[inline(always)]
pub const fn set_rx_pl(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
}
#[doc = "Receiver Preamble Pattern detected"]
#[must_use]
#[inline(always)]
pub const fn rx_pp(&self) -> super::vals::RxPp {
let val = (self.0 >> 24usize) & 0x03;
super::vals::RxPp::from_bits(val as u8)
}
#[doc = "Receiver Preamble Pattern detected"]
#[inline(always)]
pub const fn set_rx_pp(&mut self, val: super::vals::RxPp) {
self.0 = (self.0 & !(0x03 << 24usize)) | (((val.to_bits() as u32) & 0x03) << 24usize);
}
#[doc = "Receiver Manchester Polarity"]
#[must_use]
#[inline(always)]
pub const fn rx_mpol(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "Receiver Manchester Polarity"]
#[inline(always)]
pub const fn set_rx_mpol(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "Must Be Set to 1"]
#[must_use]
#[inline(always)]
pub const fn one(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "Must Be Set to 1"]
#[inline(always)]
pub const fn set_one(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
#[doc = "Drift Compensation"]
#[must_use]
#[inline(always)]
pub const fn drift(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "Drift Compensation"]
#[inline(always)]
pub const fn set_drift(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
}
impl Default for Man {
#[inline(always)]
fn default() -> Man {
Man(0)
}
}
impl core::fmt::Debug for Man {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Man")
.field("tx_pl", &self.tx_pl())
.field("tx_pp", &self.tx_pp())
.field("tx_mpol", &self.tx_mpol())
.field("rx_pl", &self.rx_pl())
.field("rx_pp", &self.rx_pp())
.field("rx_mpol", &self.rx_mpol())
.field("one", &self.one())
.field("drift", &self.drift())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Man {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Man {{ tx_pl: {=u8:?}, tx_pp: {:?}, tx_mpol: {=bool:?}, rx_pl: {=u8:?}, rx_pp: {:?}, rx_mpol: {=bool:?}, one: {=bool:?}, drift: {=bool:?} }}",
self.tx_pl(),
self.tx_pp(),
self.tx_mpol(),
self.rx_pl(),
self.rx_pp(),
self.rx_mpol(),
self.one(),
self.drift()
)
}
}
#[doc = "Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mr(pub u32);
impl Mr {
#[doc = "USART Mode of Operation"]
#[must_use]
#[inline(always)]
pub const fn usart_mode(&self) -> super::vals::MrUsartMode {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::MrUsartMode::from_bits(val as u8)
}
#[doc = "USART Mode of Operation"]
#[inline(always)]
pub const fn set_usart_mode(&mut self, val: super::vals::MrUsartMode) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Clock Selection"]
#[must_use]
#[inline(always)]
pub const fn usclks(&self) -> super::vals::MrUsclks {
let val = (self.0 >> 4usize) & 0x03;
super::vals::MrUsclks::from_bits(val as u8)
}
#[doc = "Clock Selection"]
#[inline(always)]
pub const fn set_usclks(&mut self, val: super::vals::MrUsclks) {
self.0 = (self.0 & !(0x03 << 4usize)) | (((val.to_bits() as u32) & 0x03) << 4usize);
}
#[doc = "Character Length"]
#[must_use]
#[inline(always)]
pub const fn chrl(&self) -> super::vals::MrChrl {
let val = (self.0 >> 6usize) & 0x03;
super::vals::MrChrl::from_bits(val as u8)
}
#[doc = "Character Length"]
#[inline(always)]
pub const fn set_chrl(&mut self, val: super::vals::MrChrl) {
self.0 = (self.0 & !(0x03 << 6usize)) | (((val.to_bits() as u32) & 0x03) << 6usize);
}
#[doc = "Synchronous Mode Select"]
#[must_use]
#[inline(always)]
pub const fn sync(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Synchronous Mode Select"]
#[inline(always)]
pub const fn set_sync(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[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 = "Number of Stop Bits"]
#[must_use]
#[inline(always)]
pub const fn nbstop(&self) -> super::vals::Nbstop {
let val = (self.0 >> 12usize) & 0x03;
super::vals::Nbstop::from_bits(val as u8)
}
#[doc = "Number of Stop Bits"]
#[inline(always)]
pub const fn set_nbstop(&mut self, val: super::vals::Nbstop) {
self.0 = (self.0 & !(0x03 << 12usize)) | (((val.to_bits() as u32) & 0x03) << 12usize);
}
#[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);
}
#[doc = "Bit Order"]
#[must_use]
#[inline(always)]
pub const fn msbf(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "Bit Order"]
#[inline(always)]
pub const fn set_msbf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "9-bit Character Length"]
#[must_use]
#[inline(always)]
pub const fn mode9(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "9-bit Character Length"]
#[inline(always)]
pub const fn set_mode9(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "Clock Output Select"]
#[must_use]
#[inline(always)]
pub const fn clko(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Clock Output Select"]
#[inline(always)]
pub const fn set_clko(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Oversampling Mode"]
#[must_use]
#[inline(always)]
pub const fn over(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Oversampling Mode"]
#[inline(always)]
pub const fn set_over(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Inhibit Non Acknowledge"]
#[must_use]
#[inline(always)]
pub const fn inack(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Inhibit Non Acknowledge"]
#[inline(always)]
pub const fn set_inack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
#[doc = "Disable Successive NACK"]
#[must_use]
#[inline(always)]
pub const fn dsnack(&self) -> bool {
let val = (self.0 >> 21usize) & 0x01;
val != 0
}
#[doc = "Disable Successive NACK"]
#[inline(always)]
pub const fn set_dsnack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
}
#[doc = "Variable Synchronization of Command/Data Sync Start Frame Delimiter"]
#[must_use]
#[inline(always)]
pub const fn var_sync(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "Variable Synchronization of Command/Data Sync Start Frame Delimiter"]
#[inline(always)]
pub const fn set_var_sync(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
#[doc = "Inverted Data"]
#[must_use]
#[inline(always)]
pub const fn invdata(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "Inverted Data"]
#[inline(always)]
pub const fn set_invdata(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Maximum Number of Automatic Iteration"]
#[must_use]
#[inline(always)]
pub const fn max_iteration(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x07;
val as u8
}
#[doc = "Maximum Number of Automatic Iteration"]
#[inline(always)]
pub const fn set_max_iteration(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 24usize)) | (((val as u32) & 0x07) << 24usize);
}
#[doc = "Infrared Receive Line Filter"]
#[must_use]
#[inline(always)]
pub const fn filter(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "Infrared Receive Line Filter"]
#[inline(always)]
pub const fn set_filter(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
#[doc = "Manchester Encoder/Decoder Enable"]
#[must_use]
#[inline(always)]
pub const fn man(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "Manchester Encoder/Decoder Enable"]
#[inline(always)]
pub const fn set_man(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
#[doc = "Manchester Synchronization Mode"]
#[must_use]
#[inline(always)]
pub const fn modsync(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "Manchester Synchronization Mode"]
#[inline(always)]
pub const fn set_modsync(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "Start Frame Delimiter Selector"]
#[must_use]
#[inline(always)]
pub const fn onebit(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Start Frame Delimiter Selector"]
#[inline(always)]
pub const fn set_onebit(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
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("usart_mode", &self.usart_mode())
.field("usclks", &self.usclks())
.field("chrl", &self.chrl())
.field("sync", &self.sync())
.field("par", &self.par())
.field("nbstop", &self.nbstop())
.field("chmode", &self.chmode())
.field("msbf", &self.msbf())
.field("mode9", &self.mode9())
.field("clko", &self.clko())
.field("over", &self.over())
.field("inack", &self.inack())
.field("dsnack", &self.dsnack())
.field("var_sync", &self.var_sync())
.field("invdata", &self.invdata())
.field("max_iteration", &self.max_iteration())
.field("filter", &self.filter())
.field("man", &self.man())
.field("modsync", &self.modsync())
.field("onebit", &self.onebit())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Mr {{ usart_mode: {:?}, usclks: {:?}, chrl: {:?}, sync: {=bool:?}, par: {:?}, nbstop: {:?}, chmode: {:?}, msbf: {=bool:?}, mode9: {=bool:?}, clko: {=bool:?}, over: {=bool:?}, inack: {=bool:?}, dsnack: {=bool:?}, var_sync: {=bool:?}, invdata: {=bool:?}, max_iteration: {=u8:?}, filter: {=bool:?}, man: {=bool:?}, modsync: {=bool:?}, onebit: {=bool:?} }}",
self.usart_mode(),
self.usclks(),
self.chrl(),
self.sync(),
self.par(),
self.nbstop(),
self.chmode(),
self.msbf(),
self.mode9(),
self.clko(),
self.over(),
self.inack(),
self.dsnack(),
self.var_sync(),
self.invdata(),
self.max_iteration(),
self.filter(),
self.man(),
self.modsync(),
self.onebit()
)
}
}
#[doc = "Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct MrSpiMode(pub u32);
impl MrSpiMode {
#[doc = "USART Mode of Operation"]
#[must_use]
#[inline(always)]
pub const fn usart_mode(&self) -> super::vals::MrSpiModeUsartMode {
let val = (self.0 >> 0usize) & 0x0f;
super::vals::MrSpiModeUsartMode::from_bits(val as u8)
}
#[doc = "USART Mode of Operation"]
#[inline(always)]
pub const fn set_usart_mode(&mut self, val: super::vals::MrSpiModeUsartMode) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val.to_bits() as u32) & 0x0f) << 0usize);
}
#[doc = "Clock Selection"]
#[must_use]
#[inline(always)]
pub const fn usclks(&self) -> super::vals::MrSpiModeUsclks {
let val = (self.0 >> 4usize) & 0x03;
super::vals::MrSpiModeUsclks::from_bits(val as u8)
}
#[doc = "Clock Selection"]
#[inline(always)]
pub const fn set_usclks(&mut self, val: super::vals::MrSpiModeUsclks) {
self.0 = (self.0 & !(0x03 << 4usize)) | (((val.to_bits() as u32) & 0x03) << 4usize);
}
#[doc = "Character Length"]
#[must_use]
#[inline(always)]
pub const fn chrl(&self) -> super::vals::MrSpiModeChrl {
let val = (self.0 >> 6usize) & 0x03;
super::vals::MrSpiModeChrl::from_bits(val as u8)
}
#[doc = "Character Length"]
#[inline(always)]
pub const fn set_chrl(&mut self, val: super::vals::MrSpiModeChrl) {
self.0 = (self.0 & !(0x03 << 6usize)) | (((val.to_bits() as u32) & 0x03) << 6usize);
}
#[doc = "SPI Clock Phase"]
#[must_use]
#[inline(always)]
pub const fn cpha(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "SPI Clock Phase"]
#[inline(always)]
pub const fn set_cpha(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "SPI Clock Polarity"]
#[must_use]
#[inline(always)]
pub const fn cpol(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "SPI Clock Polarity"]
#[inline(always)]
pub const fn set_cpol(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "Wait Read Data Before Transfer"]
#[must_use]
#[inline(always)]
pub const fn wrdbt(&self) -> bool {
let val = (self.0 >> 20usize) & 0x01;
val != 0
}
#[doc = "Wait Read Data Before Transfer"]
#[inline(always)]
pub const fn set_wrdbt(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
}
}
impl Default for MrSpiMode {
#[inline(always)]
fn default() -> MrSpiMode {
MrSpiMode(0)
}
}
impl core::fmt::Debug for MrSpiMode {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("MrSpiMode")
.field("usart_mode", &self.usart_mode())
.field("usclks", &self.usclks())
.field("chrl", &self.chrl())
.field("cpha", &self.cpha())
.field("cpol", &self.cpol())
.field("wrdbt", &self.wrdbt())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for MrSpiMode {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"MrSpiMode {{ usart_mode: {:?}, usclks: {:?}, chrl: {:?}, cpha: {=bool:?}, cpol: {=bool:?}, wrdbt: {=bool:?} }}",
self.usart_mode(),
self.usclks(),
self.chrl(),
self.cpha(),
self.cpol(),
self.wrdbt()
)
}
}
#[doc = "Number of Errors Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ner(pub u32);
impl Ner {
#[doc = "Number of Errors"]
#[must_use]
#[inline(always)]
pub const fn nb_errors(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Number of Errors"]
#[inline(always)]
pub const fn set_nb_errors(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Ner {
#[inline(always)]
fn default() -> Ner {
Ner(0)
}
}
impl core::fmt::Debug for Ner {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ner")
.field("nb_errors", &self.nb_errors())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ner {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ner {{ nb_errors: {=u8:?} }}", self.nb_errors())
}
}
#[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) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Received Character"]
#[inline(always)]
pub const fn set_rxchr(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
#[doc = "Received Sync"]
#[must_use]
#[inline(always)]
pub const fn rxsynh(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Received Sync"]
#[inline(always)]
pub const fn set_rxsynh(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
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())
.field("rxsynh", &self.rxsynh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rhr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Rhr {{ rxchr: {=u16:?}, rxsynh: {=bool:?} }}",
self.rxchr(),
self.rxsynh()
)
}
}
#[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 = "Receiver Time-out Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rtor(pub u32);
impl Rtor {
#[doc = "Time-out Value"]
#[must_use]
#[inline(always)]
pub const fn to(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x0001_ffff;
val as u32
}
#[doc = "Time-out Value"]
#[inline(always)]
pub const fn set_to(&mut self, val: u32) {
self.0 = (self.0 & !(0x0001_ffff << 0usize)) | (((val as u32) & 0x0001_ffff) << 0usize);
}
}
impl Default for Rtor {
#[inline(always)]
fn default() -> Rtor {
Rtor(0)
}
}
impl core::fmt::Debug for Rtor {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rtor").field("to", &self.to()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rtor {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rtor {{ to: {=u32:?} }}", self.to())
}
}
#[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) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Character to be Transmitted"]
#[inline(always)]
pub const fn set_txchr(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
#[doc = "Sync Field to be Transmitted"]
#[must_use]
#[inline(always)]
pub const fn txsynh(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Sync Field to be Transmitted"]
#[inline(always)]
pub const fn set_txsynh(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
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())
.field("txsynh", &self.txsynh())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Thr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Thr {{ txchr: {=u16:?}, txsynh: {=bool:?} }}",
self.txchr(),
self.txsynh()
)
}
}
#[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())
}
}
#[doc = "Transmitter Timeguard Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ttgr(pub u32);
impl Ttgr {
#[doc = "Timeguard Value"]
#[must_use]
#[inline(always)]
pub const fn tg(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Timeguard Value"]
#[inline(always)]
pub const fn set_tg(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Ttgr {
#[inline(always)]
fn default() -> Ttgr {
Ttgr(0)
}
}
impl core::fmt::Debug for Ttgr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ttgr").field("tg", &self.tg()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ttgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Ttgr {{ tg: {=u8:?} }}", self.tg())
}
}
#[doc = "Write Protection Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wpmr(pub u32);
impl Wpmr {
#[doc = "Write Protection Enable"]
#[must_use]
#[inline(always)]
pub const fn wpen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write Protection Enable"]
#[inline(always)]
pub const fn set_wpen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write Protection Key"]
#[must_use]
#[inline(always)]
pub const fn wpkey(&self) -> super::vals::Wpkey {
let val = (self.0 >> 8usize) & 0x00ff_ffff;
super::vals::Wpkey::from_bits(val as u32)
}
#[doc = "Write Protection Key"]
#[inline(always)]
pub const fn set_wpkey(&mut self, val: super::vals::Wpkey) {
self.0 = (self.0 & !(0x00ff_ffff << 8usize))
| (((val.to_bits() as u32) & 0x00ff_ffff) << 8usize);
}
}
impl Default for Wpmr {
#[inline(always)]
fn default() -> Wpmr {
Wpmr(0)
}
}
impl core::fmt::Debug for Wpmr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wpmr")
.field("wpen", &self.wpen())
.field("wpkey", &self.wpkey())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpmr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Wpmr {{ wpen: {=bool:?}, wpkey: {:?} }}",
self.wpen(),
self.wpkey()
)
}
}
#[doc = "Write Protection Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wpsr(pub u32);
impl Wpsr {
#[doc = "Write Protection Violation Status"]
#[must_use]
#[inline(always)]
pub const fn wpvs(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write Protection Violation Status"]
#[inline(always)]
pub const fn set_wpvs(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Write Protection Violation Source"]
#[must_use]
#[inline(always)]
pub const fn wpvsrc(&self) -> u16 {
let val = (self.0 >> 8usize) & 0xffff;
val as u16
}
#[doc = "Write Protection Violation Source"]
#[inline(always)]
pub const fn set_wpvsrc(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 8usize)) | (((val as u32) & 0xffff) << 8usize);
}
}
impl Default for Wpsr {
#[inline(always)]
fn default() -> Wpsr {
Wpsr(0)
}
}
impl core::fmt::Debug for Wpsr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Wpsr")
.field("wpvs", &self.wpvs())
.field("wpvsrc", &self.wpvsrc())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Wpsr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Wpsr {{ wpvs: {=bool:?}, wpvsrc: {=u16:?} }}",
self.wpvs(),
self.wpvsrc()
)
}
}