#[doc = "Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
#[doc = "Send a START Condition"]
#[must_use]
#[inline(always)]
pub const fn start(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Send a START Condition"]
#[inline(always)]
pub const fn set_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Send a STOP Condition"]
#[must_use]
#[inline(always)]
pub const fn stop(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Send a STOP Condition"]
#[inline(always)]
pub const fn set_stop(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "TWI Master Mode Enabled"]
#[must_use]
#[inline(always)]
pub const fn msen(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "TWI Master Mode Enabled"]
#[inline(always)]
pub const fn set_msen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "TWI Master Mode Disabled"]
#[must_use]
#[inline(always)]
pub const fn msdis(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "TWI Master Mode Disabled"]
#[inline(always)]
pub const fn set_msdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "TWI Slave Mode Enabled"]
#[must_use]
#[inline(always)]
pub const fn sven(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "TWI Slave Mode Enabled"]
#[inline(always)]
pub const fn set_sven(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "TWI Slave Mode Disabled"]
#[must_use]
#[inline(always)]
pub const fn svdis(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "TWI Slave Mode Disabled"]
#[inline(always)]
pub const fn set_svdis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "SMBUS Quick Command"]
#[must_use]
#[inline(always)]
pub const fn quick(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "SMBUS Quick Command"]
#[inline(always)]
pub const fn set_quick(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Software Reset"]
#[must_use]
#[inline(always)]
pub const fn swrst(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "Software Reset"]
#[inline(always)]
pub const fn set_swrst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
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("start", &self.start())
.field("stop", &self.stop())
.field("msen", &self.msen())
.field("msdis", &self.msdis())
.field("sven", &self.sven())
.field("svdis", &self.svdis())
.field("quick", &self.quick())
.field("swrst", &self.swrst())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cr {{ start: {=bool:?}, stop: {=bool:?}, msen: {=bool:?}, msdis: {=bool:?}, sven: {=bool:?}, svdis: {=bool:?}, quick: {=bool:?}, swrst: {=bool:?} }}",
self.start(),
self.stop(),
self.msen(),
self.msdis(),
self.sven(),
self.svdis(),
self.quick(),
self.swrst()
)
}
}
#[doc = "Clock Waveform Generator Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cwgr(pub u32);
impl Cwgr {
#[doc = "Clock Low Divider"]
#[must_use]
#[inline(always)]
pub const fn cldiv(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Clock Low Divider"]
#[inline(always)]
pub const fn set_cldiv(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Clock High Divider"]
#[must_use]
#[inline(always)]
pub const fn chdiv(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Clock High Divider"]
#[inline(always)]
pub const fn set_chdiv(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Clock Divider"]
#[must_use]
#[inline(always)]
pub const fn ckdiv(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x07;
val as u8
}
#[doc = "Clock Divider"]
#[inline(always)]
pub const fn set_ckdiv(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 16usize)) | (((val as u32) & 0x07) << 16usize);
}
}
impl Default for Cwgr {
#[inline(always)]
fn default() -> Cwgr {
Cwgr(0)
}
}
impl core::fmt::Debug for Cwgr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cwgr")
.field("cldiv", &self.cldiv())
.field("chdiv", &self.chdiv())
.field("ckdiv", &self.ckdiv())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cwgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cwgr {{ cldiv: {=u8:?}, chdiv: {=u8:?}, ckdiv: {=u8:?} }}",
self.cldiv(),
self.chdiv(),
self.ckdiv()
)
}
}
#[doc = "Internal Address Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Iadr(pub u32);
impl Iadr {
#[doc = "Internal Address"]
#[must_use]
#[inline(always)]
pub const fn iadr(&self) -> u32 {
let val = (self.0 >> 0usize) & 0x00ff_ffff;
val as u32
}
#[doc = "Internal Address"]
#[inline(always)]
pub const fn set_iadr(&mut self, val: u32) {
self.0 = (self.0 & !(0x00ff_ffff << 0usize)) | (((val as u32) & 0x00ff_ffff) << 0usize);
}
}
impl Default for Iadr {
#[inline(always)]
fn default() -> Iadr {
Iadr(0)
}
}
impl core::fmt::Debug for Iadr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Iadr").field("iadr", &self.iadr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Iadr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Iadr {{ iadr: {=u32:?} }}", self.iadr())
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idr(pub u32);
impl Idr {
#[doc = "Transmission Completed Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txcomp(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Transmission Completed Interrupt Disable"]
#[inline(always)]
pub const fn set_txcomp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receive Holding Register Ready Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Receive Holding Register Ready Interrupt Disable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Transmit Holding Register Ready Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Transmit Holding Register Ready Interrupt Disable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Slave Access Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn svacc(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Slave Access Interrupt Disable"]
#[inline(always)]
pub const fn set_svacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "General Call Access Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn gacc(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "General Call Access Interrupt Disable"]
#[inline(always)]
pub const fn set_gacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Overrun Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Disable"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Not Acknowledge Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Not Acknowledge Interrupt Disable"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Arbitration Lost Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn arblst(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Arbitration Lost Interrupt Disable"]
#[inline(always)]
pub const fn set_arblst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Clock Wait State Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn scl_ws(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Clock Wait State Interrupt Disable"]
#[inline(always)]
pub const fn set_scl_ws(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "End Of Slave Access Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn eosacc(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "End Of Slave Access Interrupt Disable"]
#[inline(always)]
pub const fn set_eosacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "End of Receive Buffer Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "End of Receive Buffer Interrupt Disable"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "End of Transmit Buffer Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Buffer Interrupt Disable"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Receive Buffer Full Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Receive Buffer Full Interrupt Disable"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Transmit Buffer Empty Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Transmit Buffer Empty Interrupt Disable"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
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("txcomp", &self.txcomp())
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("svacc", &self.svacc())
.field("gacc", &self.gacc())
.field("ovre", &self.ovre())
.field("nack", &self.nack())
.field("arblst", &self.arblst())
.field("scl_ws", &self.scl_ws())
.field("eosacc", &self.eosacc())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("rxbuff", &self.rxbuff())
.field("txbufe", &self.txbufe())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Idr {{ txcomp: {=bool:?}, rxrdy: {=bool:?}, txrdy: {=bool:?}, svacc: {=bool:?}, gacc: {=bool:?}, ovre: {=bool:?}, nack: {=bool:?}, arblst: {=bool:?}, scl_ws: {=bool:?}, eosacc: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, rxbuff: {=bool:?}, txbufe: {=bool:?} }}",
self.txcomp(),
self.rxrdy(),
self.txrdy(),
self.svacc(),
self.gacc(),
self.ovre(),
self.nack(),
self.arblst(),
self.scl_ws(),
self.eosacc(),
self.endrx(),
self.endtx(),
self.rxbuff(),
self.txbufe()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "Transmission Completed Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txcomp(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Transmission Completed Interrupt Enable"]
#[inline(always)]
pub const fn set_txcomp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receive Holding Register Ready Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Receive Holding Register Ready Interrupt Enable"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Transmit Holding Register Ready Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Transmit Holding Register Ready Interrupt Enable"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Slave Access Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn svacc(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Slave Access Interrupt Enable"]
#[inline(always)]
pub const fn set_svacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "General Call Access Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn gacc(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "General Call Access Interrupt Enable"]
#[inline(always)]
pub const fn set_gacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Overrun Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Enable"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Not Acknowledge Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Not Acknowledge Interrupt Enable"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Arbitration Lost Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn arblst(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Arbitration Lost Interrupt Enable"]
#[inline(always)]
pub const fn set_arblst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Clock Wait State Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn scl_ws(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Clock Wait State Interrupt Enable"]
#[inline(always)]
pub const fn set_scl_ws(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "End Of Slave Access Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn eosacc(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "End Of Slave Access Interrupt Enable"]
#[inline(always)]
pub const fn set_eosacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "End of Receive Buffer Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "End of Receive Buffer Interrupt Enable"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "End of Transmit Buffer Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Buffer Interrupt Enable"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Receive Buffer Full Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Receive Buffer Full Interrupt Enable"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Transmit Buffer Empty Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Transmit Buffer Empty Interrupt Enable"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
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("txcomp", &self.txcomp())
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("svacc", &self.svacc())
.field("gacc", &self.gacc())
.field("ovre", &self.ovre())
.field("nack", &self.nack())
.field("arblst", &self.arblst())
.field("scl_ws", &self.scl_ws())
.field("eosacc", &self.eosacc())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("rxbuff", &self.rxbuff())
.field("txbufe", &self.txbufe())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ier {{ txcomp: {=bool:?}, rxrdy: {=bool:?}, txrdy: {=bool:?}, svacc: {=bool:?}, gacc: {=bool:?}, ovre: {=bool:?}, nack: {=bool:?}, arblst: {=bool:?}, scl_ws: {=bool:?}, eosacc: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, rxbuff: {=bool:?}, txbufe: {=bool:?} }}",
self.txcomp(),
self.rxrdy(),
self.txrdy(),
self.svacc(),
self.gacc(),
self.ovre(),
self.nack(),
self.arblst(),
self.scl_ws(),
self.eosacc(),
self.endrx(),
self.endtx(),
self.rxbuff(),
self.txbufe()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "Transmission Completed Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txcomp(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Transmission Completed Interrupt Mask"]
#[inline(always)]
pub const fn set_txcomp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receive Holding Register Ready Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Receive Holding Register Ready Interrupt Mask"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Transmit Holding Register Ready Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Transmit Holding Register Ready Interrupt Mask"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Slave Access Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn svacc(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Slave Access Interrupt Mask"]
#[inline(always)]
pub const fn set_svacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "General Call Access Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn gacc(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "General Call Access Interrupt Mask"]
#[inline(always)]
pub const fn set_gacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Overrun Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Overrun Error Interrupt Mask"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Not Acknowledge Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Not Acknowledge Interrupt Mask"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Arbitration Lost Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn arblst(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Arbitration Lost Interrupt Mask"]
#[inline(always)]
pub const fn set_arblst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Clock Wait State Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn scl_ws(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Clock Wait State Interrupt Mask"]
#[inline(always)]
pub const fn set_scl_ws(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "End Of Slave Access Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn eosacc(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "End Of Slave Access Interrupt Mask"]
#[inline(always)]
pub const fn set_eosacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "End of Receive Buffer Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "End of Receive Buffer Interrupt Mask"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "End of Transmit Buffer Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "End of Transmit Buffer Interrupt Mask"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "Receive Buffer Full Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Receive Buffer Full Interrupt Mask"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Transmit Buffer Empty Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Transmit Buffer Empty Interrupt Mask"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
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("txcomp", &self.txcomp())
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("svacc", &self.svacc())
.field("gacc", &self.gacc())
.field("ovre", &self.ovre())
.field("nack", &self.nack())
.field("arblst", &self.arblst())
.field("scl_ws", &self.scl_ws())
.field("eosacc", &self.eosacc())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("rxbuff", &self.rxbuff())
.field("txbufe", &self.txbufe())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Imr {{ txcomp: {=bool:?}, rxrdy: {=bool:?}, txrdy: {=bool:?}, svacc: {=bool:?}, gacc: {=bool:?}, ovre: {=bool:?}, nack: {=bool:?}, arblst: {=bool:?}, scl_ws: {=bool:?}, eosacc: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, rxbuff: {=bool:?}, txbufe: {=bool:?} }}",
self.txcomp(),
self.rxrdy(),
self.txrdy(),
self.svacc(),
self.gacc(),
self.ovre(),
self.nack(),
self.arblst(),
self.scl_ws(),
self.eosacc(),
self.endrx(),
self.endtx(),
self.rxbuff(),
self.txbufe()
)
}
}
#[doc = "Master Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mmr(pub u32);
impl Mmr {
#[doc = "Internal Device Address Size"]
#[must_use]
#[inline(always)]
pub const fn iadrsz(&self) -> super::vals::Iadrsz {
let val = (self.0 >> 8usize) & 0x03;
super::vals::Iadrsz::from_bits(val as u8)
}
#[doc = "Internal Device Address Size"]
#[inline(always)]
pub const fn set_iadrsz(&mut self, val: super::vals::Iadrsz) {
self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
}
#[doc = "Master Read Direction"]
#[must_use]
#[inline(always)]
pub const fn mread(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "Master Read Direction"]
#[inline(always)]
pub const fn set_mread(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "Device Address"]
#[must_use]
#[inline(always)]
pub const fn dadr(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x7f;
val as u8
}
#[doc = "Device Address"]
#[inline(always)]
pub const fn set_dadr(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 16usize)) | (((val as u32) & 0x7f) << 16usize);
}
}
impl Default for Mmr {
#[inline(always)]
fn default() -> Mmr {
Mmr(0)
}
}
impl core::fmt::Debug for Mmr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Mmr")
.field("iadrsz", &self.iadrsz())
.field("mread", &self.mread())
.field("dadr", &self.dadr())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mmr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Mmr {{ iadrsz: {:?}, mread: {=bool:?}, dadr: {=u8:?} }}",
self.iadrsz(),
self.mread(),
self.dadr()
)
}
}
#[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 = "Master or Slave Receive Holding Data"]
#[must_use]
#[inline(always)]
pub const fn rxdata(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Master or Slave Receive Holding Data"]
#[inline(always)]
pub const fn set_rxdata(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Rhr {
#[inline(always)]
fn default() -> Rhr {
Rhr(0)
}
}
impl core::fmt::Debug for Rhr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Rhr")
.field("rxdata", &self.rxdata())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Rhr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Rhr {{ rxdata: {=u8:?} }}", self.rxdata())
}
}
#[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 = "Slave Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Smr(pub u32);
impl Smr {
#[doc = "Slave Address"]
#[must_use]
#[inline(always)]
pub const fn sadr(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x7f;
val as u8
}
#[doc = "Slave Address"]
#[inline(always)]
pub const fn set_sadr(&mut self, val: u8) {
self.0 = (self.0 & !(0x7f << 16usize)) | (((val as u32) & 0x7f) << 16usize);
}
}
impl Default for Smr {
#[inline(always)]
fn default() -> Smr {
Smr(0)
}
}
impl core::fmt::Debug for Smr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Smr").field("sadr", &self.sadr()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Smr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Smr {{ sadr: {=u8:?} }}", self.sadr())
}
}
#[doc = "Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sr(pub u32);
impl Sr {
#[doc = "Transmission Completed (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn txcomp(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Transmission Completed (automatically set / reset)"]
#[inline(always)]
pub const fn set_txcomp(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Receive Holding Register Ready (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn rxrdy(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Receive Holding Register Ready (automatically set / reset)"]
#[inline(always)]
pub const fn set_rxrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "Transmit Holding Register Ready (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn txrdy(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "Transmit Holding Register Ready (automatically set / reset)"]
#[inline(always)]
pub const fn set_txrdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "Slave Read (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn svread(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "Slave Read (automatically set / reset)"]
#[inline(always)]
pub const fn set_svread(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
#[doc = "Slave Access (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn svacc(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Slave Access (automatically set / reset)"]
#[inline(always)]
pub const fn set_svacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "General Call Access (clear on read)"]
#[must_use]
#[inline(always)]
pub const fn gacc(&self) -> bool {
let val = (self.0 >> 5usize) & 0x01;
val != 0
}
#[doc = "General Call Access (clear on read)"]
#[inline(always)]
pub const fn set_gacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
}
#[doc = "Overrun Error (clear on read)"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self) -> bool {
let val = (self.0 >> 6usize) & 0x01;
val != 0
}
#[doc = "Overrun Error (clear on read)"]
#[inline(always)]
pub const fn set_ovre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
}
#[doc = "Not Acknowledged (clear on read)"]
#[must_use]
#[inline(always)]
pub const fn nack(&self) -> bool {
let val = (self.0 >> 8usize) & 0x01;
val != 0
}
#[doc = "Not Acknowledged (clear on read)"]
#[inline(always)]
pub const fn set_nack(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 8usize)) | (((val as u32) & 0x01) << 8usize);
}
#[doc = "Arbitration Lost (clear on read)"]
#[must_use]
#[inline(always)]
pub const fn arblst(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Arbitration Lost (clear on read)"]
#[inline(always)]
pub const fn set_arblst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Clock Wait State (automatically set / reset)"]
#[must_use]
#[inline(always)]
pub const fn sclws(&self) -> bool {
let val = (self.0 >> 10usize) & 0x01;
val != 0
}
#[doc = "Clock Wait State (automatically set / reset)"]
#[inline(always)]
pub const fn set_sclws(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
}
#[doc = "End Of Slave Access (clear on read)"]
#[must_use]
#[inline(always)]
pub const fn eosacc(&self) -> bool {
let val = (self.0 >> 11usize) & 0x01;
val != 0
}
#[doc = "End Of Slave Access (clear on read)"]
#[inline(always)]
pub const fn set_eosacc(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
}
#[doc = "End of RX buffer"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 12usize) & 0x01;
val != 0
}
#[doc = "End of RX buffer"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
}
#[doc = "End of TX buffer"]
#[must_use]
#[inline(always)]
pub const fn endtx(&self) -> bool {
let val = (self.0 >> 13usize) & 0x01;
val != 0
}
#[doc = "End of TX buffer"]
#[inline(always)]
pub const fn set_endtx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
}
#[doc = "RX Buffer Full"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "RX Buffer Full"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "TX Buffer Empty"]
#[must_use]
#[inline(always)]
pub const fn txbufe(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "TX Buffer Empty"]
#[inline(always)]
pub const fn set_txbufe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
impl Default for Sr {
#[inline(always)]
fn default() -> Sr {
Sr(0)
}
}
impl core::fmt::Debug for Sr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sr")
.field("txcomp", &self.txcomp())
.field("rxrdy", &self.rxrdy())
.field("txrdy", &self.txrdy())
.field("svread", &self.svread())
.field("svacc", &self.svacc())
.field("gacc", &self.gacc())
.field("ovre", &self.ovre())
.field("nack", &self.nack())
.field("arblst", &self.arblst())
.field("sclws", &self.sclws())
.field("eosacc", &self.eosacc())
.field("endrx", &self.endrx())
.field("endtx", &self.endtx())
.field("rxbuff", &self.rxbuff())
.field("txbufe", &self.txbufe())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Sr {{ txcomp: {=bool:?}, rxrdy: {=bool:?}, txrdy: {=bool:?}, svread: {=bool:?}, svacc: {=bool:?}, gacc: {=bool:?}, ovre: {=bool:?}, nack: {=bool:?}, arblst: {=bool:?}, sclws: {=bool:?}, eosacc: {=bool:?}, endrx: {=bool:?}, endtx: {=bool:?}, rxbuff: {=bool:?}, txbufe: {=bool:?} }}",
self.txcomp(),
self.rxrdy(),
self.txrdy(),
self.svread(),
self.svacc(),
self.gacc(),
self.ovre(),
self.nack(),
self.arblst(),
self.sclws(),
self.eosacc(),
self.endrx(),
self.endtx(),
self.rxbuff(),
self.txbufe()
)
}
}
#[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 = "Master or Slave Transmit Holding Data"]
#[must_use]
#[inline(always)]
pub const fn txdata(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Master or Slave Transmit Holding Data"]
#[inline(always)]
pub const fn set_txdata(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
}
impl Default for Thr {
#[inline(always)]
fn default() -> Thr {
Thr(0)
}
}
impl core::fmt::Debug for Thr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Thr")
.field("txdata", &self.txdata())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Thr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Thr {{ txdata: {=u8:?} }}", self.txdata())
}
}
#[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())
}
}