#[doc = "BRR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Brr(pub u32);
impl Brr {
#[doc = "UARTDIV coefficient of the serial port baudrate"]
#[must_use]
#[inline(always)]
pub const fn brr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0xffff;
val as u16
}
#[doc = "UARTDIV coefficient of the serial port baudrate"]
#[inline(always)]
pub const fn set_brr(&mut self, val: u16) {
self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
}
}
impl Default for Brr {
#[inline(always)]
fn default() -> Brr {
Brr(0)
}
}
impl core::fmt::Debug for Brr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Brr").field("brr", &self.brr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Brr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Brr {{ brr: {=u16:?} }}", self.brr())
}
}
#[doc = "CR1"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr1(pub u32);
impl Cr1 {
#[doc = "UART enable"]
#[must_use]
#[inline(always)]
pub const fn ue(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "UART enable"]
#[inline(always)]
pub const fn set_ue(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receiver enable"]
#[must_use]
#[inline(always)]
pub const fn re(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Receiver enable"]
#[inline(always)]
pub const fn set_re(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Transmitter enable"]
#[must_use]
#[inline(always)]
pub const fn te(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Transmitter enable"]
#[inline(always)]
pub const fn set_te(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "IDLE interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn idleie(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "IDLE interrupt enable"]
#[inline(always)]
pub const fn set_idleie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "RXNE interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn rxneie(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "RXNE interrupt enable"]
#[inline(always)]
pub const fn set_rxneie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Transmission complete interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn tcie(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Transmission complete interrupt enable"]
#[inline(always)]
pub const fn set_tcie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "TXE interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn txeie(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "TXE interrupt enable"]
#[inline(always)]
pub const fn set_txeie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "PE interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn peie(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "PE interrupt enable"]
#[inline(always)]
pub const fn set_peie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Parity selection"]
#[must_use]
#[inline(always)]
pub const fn ps(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Parity selection"]
#[inline(always)]
pub const fn set_ps(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Parity control enable"]
#[must_use]
#[inline(always)]
pub const fn pce(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Parity control enable"]
#[inline(always)]
pub const fn set_pce(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "Receiver wakeup method"]
#[must_use]
#[inline(always)]
pub const fn wake(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "Receiver wakeup method"]
#[inline(always)]
pub const fn set_wake(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Word length"]
#[must_use]
#[inline(always)]
pub const fn m0(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Word length"]
#[inline(always)]
pub const fn set_m0(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Mute mode enable"]
#[must_use]
#[inline(always)]
pub const fn mme(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "Mute mode enable"]
#[inline(always)]
pub const fn set_mme(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Character match interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn cmie(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Character match interrupt enable"]
#[inline(always)]
pub const fn set_cmie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Oversampling mode"]
#[must_use]
#[inline(always)]
pub const fn over8(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Oversampling mode"]
#[inline(always)]
pub const fn set_over8(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "Half duplex enable"]
#[must_use]
#[inline(always)]
pub const fn hdupe(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Half duplex enable"]
#[inline(always)]
pub const fn set_hdupe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Cr1 {
#[inline(always)]
fn default() -> Cr1 {
Cr1(0)
}
}
impl core::fmt::Debug for Cr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr1")
.field("ue", &self.ue())
.field("re", &self.re())
.field("te", &self.te())
.field("idleie", &self.idleie())
.field("rxneie", &self.rxneie())
.field("tcie", &self.tcie())
.field("txeie", &self.txeie())
.field("peie", &self.peie())
.field("ps", &self.ps())
.field("pce", &self.pce())
.field("wake", &self.wake())
.field("m0", &self.m0())
.field("mme", &self.mme())
.field("cmie", &self.cmie())
.field("over8", &self.over8())
.field("hdupe", &self.hdupe())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr1 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cr1 {{ ue: {=bool:?}, re: {=bool:?}, te: {=bool:?}, idleie: {=bool:?}, rxneie: {=bool:?}, tcie: {=bool:?}, txeie: {=bool:?}, peie: {=bool:?}, ps: {=bool:?}, pce: {=bool:?}, wake: {=bool:?}, m0: {=bool:?}, mme: {=bool:?}, cmie: {=bool:?}, over8: {=bool:?}, hdupe: {=bool:?} }}" , self . ue () , self . re () , self . te () , self . idleie () , self . rxneie () , self . tcie () , self . txeie () , self . peie () , self . ps () , self . pce () , self . wake () , self . m0 () , self . mme () , self . cmie () , self . over8 () , self . hdupe ())
}
}
#[doc = "CR2"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr2(pub u32);
impl Cr2 {
#[doc = "7-bit address Detection/4-bit address Detection"]
#[must_use]
#[inline(always)]
pub const fn addm7(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "7-bit address Detection/4-bit address Detection"]
#[inline(always)]
pub const fn set_addm7(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "LIN break detection length"]
#[must_use]
#[inline(always)]
pub const fn lbdl(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "LIN break detection length"]
#[inline(always)]
pub const fn set_lbdl(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "LIN break detection interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn lbdie(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "LIN break detection interrupt enable"]
#[inline(always)]
pub const fn set_lbdie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "STOP bits"]
#[must_use]
#[inline(always)]
pub const fn stop(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x03;
val as u8
}
#[doc = "STOP bits"]
#[inline(always)]
pub const fn set_stop(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 12usize)) | (((val as u32) & 0x03) << 12usize);
}
#[doc = "LIN mode enable"]
#[must_use]
#[inline(always)]
pub const fn linen(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "LIN mode enable"]
#[inline(always)]
pub const fn set_linen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Swap TX/RX pins"]
#[must_use]
#[inline(always)]
pub const fn swap(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Swap TX/RX pins"]
#[inline(always)]
pub const fn set_swap(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
#[doc = "RX pin active level inversion"]
#[must_use]
#[inline(always)]
pub const fn rxinv(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "RX pin active level inversion"]
#[inline(always)]
pub const fn set_rxinv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "TX pin active level inversion"]
#[must_use]
#[inline(always)]
pub const fn txinv(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "TX pin active level inversion"]
#[inline(always)]
pub const fn set_txinv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "Binary data inversion"]
#[must_use]
#[inline(always)]
pub const fn datainv(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Binary data inversion"]
#[inline(always)]
pub const fn set_datainv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Most significant bit first"]
#[must_use]
#[inline(always)]
pub const fn msbfirst(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Most significant bit first"]
#[inline(always)]
pub const fn set_msbfirst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Address of the UART node"]
#[must_use]
#[inline(always)]
pub const fn add(&self) -> u8 {
let val = (self.0 >> 24usize) & 0xff;
val as u8
}
#[doc = "Address of the UART node"]
#[inline(always)]
pub const fn set_add(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 24usize)) | (((val as u32) & 0xff) << 24usize);
}
}
impl Default for Cr2 {
#[inline(always)]
fn default() -> Cr2 {
Cr2(0)
}
}
impl core::fmt::Debug for Cr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr2")
.field("addm7", &self.addm7())
.field("lbdl", &self.lbdl())
.field("lbdie", &self.lbdie())
.field("stop", &self.stop())
.field("linen", &self.linen())
.field("swap", &self.swap())
.field("rxinv", &self.rxinv())
.field("txinv", &self.txinv())
.field("datainv", &self.datainv())
.field("msbfirst", &self.msbfirst())
.field("add", &self.add())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr2 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cr2 {{ addm7: {=bool:?}, lbdl: {=bool:?}, lbdie: {=bool:?}, stop: {=u8:?}, linen: {=bool:?}, swap: {=bool:?}, rxinv: {=bool:?}, txinv: {=bool:?}, datainv: {=bool:?}, msbfirst: {=bool:?}, add: {=u8:?} }}" , self . addm7 () , self . lbdl () , self . lbdie () , self . stop () , self . linen () , self . swap () , self . rxinv () , self . txinv () , self . datainv () , self . msbfirst () , self . add ())
}
}
#[doc = "CR3"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr3(pub u32);
impl Cr3 {
#[doc = "Error interrupt enable"]
#[must_use]
#[inline(always)]
pub const fn eie(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Error interrupt enable"]
#[inline(always)]
pub const fn set_eie(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Half-duplex selection"]
#[must_use]
#[inline(always)]
pub const fn hdsel(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Half-duplex selection"]
#[inline(always)]
pub const fn set_hdsel(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "One sample bit method enable"]
#[must_use]
#[inline(always)]
pub const fn onebit(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "One sample bit method enable"]
#[inline(always)]
pub const fn set_onebit(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "Overrun disable"]
#[must_use]
#[inline(always)]
pub const fn ovrdis(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Overrun disable"]
#[inline(always)]
pub const fn set_ovrdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
}
impl Default for Cr3 {
#[inline(always)]
fn default() -> Cr3 {
Cr3(0)
}
}
impl core::fmt::Debug for Cr3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr3")
.field("eie", &self.eie())
.field("hdsel", &self.hdsel())
.field("onebit", &self.onebit())
.field("ovrdis", &self.ovrdis())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr3 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cr3 {{ eie: {=bool:?}, hdsel: {=bool:?}, onebit: {=bool:?}, ovrdis: {=bool:?} }}",
self.eie(),
self.hdsel(),
self.onebit(),
self.ovrdis()
)
}
}
#[doc = "ICR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Icr(pub u32);
impl Icr {
#[doc = "Parity error clear flag"]
#[must_use]
#[inline(always)]
pub const fn pecf(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Parity error clear flag"]
#[inline(always)]
pub const fn set_pecf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Framing error clear flag"]
#[must_use]
#[inline(always)]
pub const fn fecf(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Framing error clear flag"]
#[inline(always)]
pub const fn set_fecf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Noise detected clear flag"]
#[must_use]
#[inline(always)]
pub const fn ncf(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Noise detected clear flag"]
#[inline(always)]
pub const fn set_ncf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Overrun error clear flag"]
#[must_use]
#[inline(always)]
pub const fn orecf(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Overrun error clear flag"]
#[inline(always)]
pub const fn set_orecf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Idle line detected clear flag"]
#[must_use]
#[inline(always)]
pub const fn idlecf(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Idle line detected clear flag"]
#[inline(always)]
pub const fn set_idlecf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Transmission complete clear flag"]
#[must_use]
#[inline(always)]
pub const fn tccf(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Transmission complete clear flag"]
#[inline(always)]
pub const fn set_tccf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "LIN break detection clear flag"]
#[must_use]
#[inline(always)]
pub const fn lbdcf(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "LIN break detection clear flag"]
#[inline(always)]
pub const fn set_lbdcf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Character match clear flag"]
#[must_use]
#[inline(always)]
pub const fn cmcf(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "Character match clear flag"]
#[inline(always)]
pub const fn set_cmcf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
}
impl Default for Icr {
#[inline(always)]
fn default() -> Icr {
Icr(0)
}
}
impl core::fmt::Debug for Icr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Icr")
.field("pecf", &self.pecf())
.field("fecf", &self.fecf())
.field("ncf", &self.ncf())
.field("orecf", &self.orecf())
.field("idlecf", &self.idlecf())
.field("tccf", &self.tccf())
.field("lbdcf", &self.lbdcf())
.field("cmcf", &self.cmcf())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Icr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Icr {{ pecf: {=bool:?}, fecf: {=bool:?}, ncf: {=bool:?}, orecf: {=bool:?}, idlecf: {=bool:?}, tccf: {=bool:?}, lbdcf: {=bool:?}, cmcf: {=bool:?} }}" , self . pecf () , self . fecf () , self . ncf () , self . orecf () , self . idlecf () , self . tccf () , self . lbdcf () , self . cmcf ())
}
}
#[doc = "ISR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isr(pub u32);
impl Isr {
#[doc = "Parity error"]
#[must_use]
#[inline(always)]
pub const fn pe(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Parity error"]
#[inline(always)]
pub const fn set_pe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Framing error"]
#[must_use]
#[inline(always)]
pub const fn fe(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Framing error"]
#[inline(always)]
pub const fn set_fe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Noise detection flag"]
#[must_use]
#[inline(always)]
pub const fn nf(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Noise detection flag"]
#[inline(always)]
pub const fn set_nf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Overrun error"]
#[must_use]
#[inline(always)]
pub const fn ore(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Overrun error"]
#[inline(always)]
pub const fn set_ore(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Idle line detected"]
#[must_use]
#[inline(always)]
pub const fn idle(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Idle line detected"]
#[inline(always)]
pub const fn set_idle(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "Receive data register not empty"]
#[must_use]
#[inline(always)]
pub const fn rxne(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "Receive data register not empty"]
#[inline(always)]
pub const fn set_rxne(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Transmission complete"]
#[must_use]
#[inline(always)]
pub const fn tc(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Transmission complete"]
#[inline(always)]
pub const fn set_tc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Transmit data register empty"]
#[must_use]
#[inline(always)]
pub const fn txe(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Transmit data register empty"]
#[inline(always)]
pub const fn set_txe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
#[doc = "LIN break detection flag"]
#[must_use]
#[inline(always)]
pub const fn lbdf(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "LIN break detection flag"]
#[inline(always)]
pub const fn set_lbdf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Busy flag"]
#[must_use]
#[inline(always)]
pub const fn busy(&self) -> bool {
let val = (self.0 >> 16usize) & 0x01;
val != 0
}
#[doc = "Busy flag"]
#[inline(always)]
pub const fn set_busy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
}
#[doc = "Character match flag"]
#[must_use]
#[inline(always)]
pub const fn cmf(&self) -> bool {
let val = (self.0 >> 17usize) & 0x01;
val != 0
}
#[doc = "Character match flag"]
#[inline(always)]
pub const fn set_cmf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
}
#[doc = "Send break flag"]
#[must_use]
#[inline(always)]
pub const fn sbkf(&self) -> bool {
let val = (self.0 >> 18usize) & 0x01;
val != 0
}
#[doc = "Send break flag"]
#[inline(always)]
pub const fn set_sbkf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
}
#[doc = "Receiver wakeup from Mute mode"]
#[must_use]
#[inline(always)]
pub const fn rwu(&self) -> bool {
let val = (self.0 >> 19usize) & 0x01;
val != 0
}
#[doc = "Receiver wakeup from Mute mode"]
#[inline(always)]
pub const fn set_rwu(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
}
#[doc = "Transmit enable acknowledge flag"]
#[must_use]
#[inline(always)]
pub const fn teack(&self) -> bool {
let val = (self.0 >> 21usize) & 0x01;
val != 0
}
#[doc = "Transmit enable acknowledge flag"]
#[inline(always)]
pub const fn set_teack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
}
#[doc = "Receive enable acknowledge flag"]
#[must_use]
#[inline(always)]
pub const fn reack(&self) -> bool {
let val = (self.0 >> 22usize) & 0x01;
val != 0
}
#[doc = "Receive enable acknowledge flag"]
#[inline(always)]
pub const fn set_reack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
}
}
impl Default for Isr {
#[inline(always)]
fn default() -> Isr {
Isr(0)
}
}
impl core::fmt::Debug for Isr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Isr")
.field("pe", &self.pe())
.field("fe", &self.fe())
.field("nf", &self.nf())
.field("ore", &self.ore())
.field("idle", &self.idle())
.field("rxne", &self.rxne())
.field("tc", &self.tc())
.field("txe", &self.txe())
.field("lbdf", &self.lbdf())
.field("busy", &self.busy())
.field("cmf", &self.cmf())
.field("sbkf", &self.sbkf())
.field("rwu", &self.rwu())
.field("teack", &self.teack())
.field("reack", &self.reack())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Isr {{ pe: {=bool:?}, fe: {=bool:?}, nf: {=bool:?}, ore: {=bool:?}, idle: {=bool:?}, rxne: {=bool:?}, tc: {=bool:?}, txe: {=bool:?}, lbdf: {=bool:?}, busy: {=bool:?}, cmf: {=bool:?}, sbkf: {=bool:?}, rwu: {=bool:?}, teack: {=bool:?}, reack: {=bool:?} }}" , self . pe () , self . fe () , self . nf () , self . ore () , self . idle () , self . rxne () , self . tc () , self . txe () , self . lbdf () , self . busy () , self . cmf () , self . sbkf () , self . rwu () , self . teack () , self . reack ())
}
}
#[doc = "NFCR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Nfcr(pub u32);
impl Nfcr {
#[doc = "Noise filter config register"]
#[must_use]
#[inline(always)]
pub const fn nfcr(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "Noise filter config register"]
#[inline(always)]
pub const fn set_nfcr(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "Resynchronization"]
#[must_use]
#[inline(always)]
pub const fn resyn(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Resynchronization"]
#[inline(always)]
pub const fn set_resyn(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
}
impl Default for Nfcr {
#[inline(always)]
fn default() -> Nfcr {
Nfcr(0)
}
}
impl core::fmt::Debug for Nfcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Nfcr")
.field("nfcr", &self.nfcr())
.field("resyn", &self.resyn())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Nfcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Nfcr {{ nfcr: {=u8:?}, resyn: {=bool:?} }}",
self.nfcr(),
self.resyn()
)
}
}
#[doc = "RDR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rdr(pub u32);
impl Rdr {
#[doc = "Receive data value"]
#[must_use]
#[inline(always)]
pub const fn rdr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Receive data value"]
#[inline(always)]
pub const fn set_rdr(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
}
impl Default for Rdr {
#[inline(always)]
fn default() -> Rdr {
Rdr(0)
}
}
impl core::fmt::Debug for Rdr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rdr").field("rdr", &self.rdr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rdr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rdr {{ rdr: {=u16:?} }}", self.rdr())
}
}
#[doc = "RQR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Rqr(pub u32);
impl Rqr {
#[doc = "Send break request"]
#[must_use]
#[inline(always)]
pub const fn sbkrq(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Send break request"]
#[inline(always)]
pub const fn set_sbkrq(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Mute mode request"]
#[must_use]
#[inline(always)]
pub const fn mmrq(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Mute mode request"]
#[inline(always)]
pub const fn set_mmrq(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Receive data flush request"]
#[must_use]
#[inline(always)]
pub const fn rxfrq(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Receive data flush request"]
#[inline(always)]
pub const fn set_rxfrq(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Rqr {
#[inline(always)]
fn default() -> Rqr {
Rqr(0)
}
}
impl core::fmt::Debug for Rqr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rqr")
.field("sbkrq", &self.sbkrq())
.field("mmrq", &self.mmrq())
.field("rxfrq", &self.rxfrq())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rqr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Rqr {{ sbkrq: {=bool:?}, mmrq: {=bool:?}, rxfrq: {=bool:?} }}",
self.sbkrq(),
self.mmrq(),
self.rxfrq()
)
}
}
#[doc = "TDR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tdr(pub u32);
impl Tdr {
#[doc = "Transmit data value"]
#[must_use]
#[inline(always)]
pub const fn tdr(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x01ff;
val as u16
}
#[doc = "Transmit data value"]
#[inline(always)]
pub const fn set_tdr(&mut self, val: u16) {
self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
}
}
impl Default for Tdr {
#[inline(always)]
fn default() -> Tdr {
Tdr(0)
}
}
impl core::fmt::Debug for Tdr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Tdr").field("tdr", &self.tdr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Tdr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Tdr {{ tdr: {=u16:?} }}", self.tdr())
}
}