#[doc = "Analog Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Acr(pub u32);
impl Acr {
#[doc = "Temperature Sensor On"]
#[must_use]
#[inline(always)]
pub const fn tson(&self) -> bool {
let val = (self.0 >> 4usize) & 0x01;
val != 0
}
#[doc = "Temperature Sensor On"]
#[inline(always)]
pub const fn set_tson(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
}
#[doc = "ADC Bias Current Control"]
#[must_use]
#[inline(always)]
pub const fn ibctl(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x03;
val as u8
}
#[doc = "ADC Bias Current Control"]
#[inline(always)]
pub const fn set_ibctl(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 8usize)) | (((val as u32) & 0x03) << 8usize);
}
}
impl Default for Acr {
#[inline(always)]
fn default() -> Acr {
Acr(0)
}
}
impl core::fmt::Debug for Acr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Acr")
.field("tson", &self.tson())
.field("ibctl", &self.ibctl())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Acr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Acr {{ tson: {=bool:?}, ibctl: {=u8:?} }}",
self.tson(),
self.ibctl()
)
}
}
#[doc = "Channel Data Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cdr(pub u32);
impl Cdr {
#[doc = "Converted Data"]
#[must_use]
#[inline(always)]
pub const fn data(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x0fff;
val as u16
}
#[doc = "Converted Data"]
#[inline(always)]
pub const fn set_data(&mut self, val: u16) {
self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
}
}
impl Default for Cdr {
#[inline(always)]
fn default() -> Cdr {
Cdr(0)
}
}
impl core::fmt::Debug for Cdr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cdr").field("data", &self.data()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cdr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Cdr {{ data: {=u16:?} }}", self.data())
}
}
#[doc = "Channel Gain Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cgr(pub u32);
impl Cgr {
#[doc = "Gain for Channel 0"]
#[must_use]
#[inline(always)]
pub const fn gain(&self, n: usize) -> u8 {
assert!(n < 16usize);
let offs = 0usize + n * 2usize;
let val = (self.0 >> offs) & 0x03;
val as u8
}
#[doc = "Gain for Channel 0"]
#[inline(always)]
pub const fn set_gain(&mut self, n: usize, val: u8) {
assert!(n < 16usize);
let offs = 0usize + n * 2usize;
self.0 = (self.0 & !(0x03 << offs)) | (((val as u32) & 0x03) << offs);
}
}
impl Default for Cgr {
#[inline(always)]
fn default() -> Cgr {
Cgr(0)
}
}
impl core::fmt::Debug for Cgr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cgr")
.field("gain[0]", &self.gain(0usize))
.field("gain[1]", &self.gain(1usize))
.field("gain[2]", &self.gain(2usize))
.field("gain[3]", &self.gain(3usize))
.field("gain[4]", &self.gain(4usize))
.field("gain[5]", &self.gain(5usize))
.field("gain[6]", &self.gain(6usize))
.field("gain[7]", &self.gain(7usize))
.field("gain[8]", &self.gain(8usize))
.field("gain[9]", &self.gain(9usize))
.field("gain[10]", &self.gain(10usize))
.field("gain[11]", &self.gain(11usize))
.field("gain[12]", &self.gain(12usize))
.field("gain[13]", &self.gain(13usize))
.field("gain[14]", &self.gain(14usize))
.field("gain[15]", &self.gain(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cgr {{ gain[0]: {=u8:?}, gain[1]: {=u8:?}, gain[2]: {=u8:?}, gain[3]: {=u8:?}, gain[4]: {=u8:?}, gain[5]: {=u8:?}, gain[6]: {=u8:?}, gain[7]: {=u8:?}, gain[8]: {=u8:?}, gain[9]: {=u8:?}, gain[10]: {=u8:?}, gain[11]: {=u8:?}, gain[12]: {=u8:?}, gain[13]: {=u8:?}, gain[14]: {=u8:?}, gain[15]: {=u8:?} }}",
self.gain(0usize),
self.gain(1usize),
self.gain(2usize),
self.gain(3usize),
self.gain(4usize),
self.gain(5usize),
self.gain(6usize),
self.gain(7usize),
self.gain(8usize),
self.gain(9usize),
self.gain(10usize),
self.gain(11usize),
self.gain(12usize),
self.gain(13usize),
self.gain(14usize),
self.gain(15usize)
)
}
}
#[doc = "Channel Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Chdr(pub u32);
impl Chdr {
#[doc = "Channel 0 Disable"]
#[must_use]
#[inline(always)]
pub const fn ch(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Channel 0 Disable"]
#[inline(always)]
pub const fn set_ch(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Chdr {
#[inline(always)]
fn default() -> Chdr {
Chdr(0)
}
}
impl core::fmt::Debug for Chdr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Chdr")
.field("ch[0]", &self.ch(0usize))
.field("ch[1]", &self.ch(1usize))
.field("ch[2]", &self.ch(2usize))
.field("ch[3]", &self.ch(3usize))
.field("ch[4]", &self.ch(4usize))
.field("ch[5]", &self.ch(5usize))
.field("ch[6]", &self.ch(6usize))
.field("ch[7]", &self.ch(7usize))
.field("ch[8]", &self.ch(8usize))
.field("ch[9]", &self.ch(9usize))
.field("ch[10]", &self.ch(10usize))
.field("ch[11]", &self.ch(11usize))
.field("ch[12]", &self.ch(12usize))
.field("ch[13]", &self.ch(13usize))
.field("ch[14]", &self.ch(14usize))
.field("ch[15]", &self.ch(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Chdr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Chdr {{ ch[0]: {=bool:?}, ch[1]: {=bool:?}, ch[2]: {=bool:?}, ch[3]: {=bool:?}, ch[4]: {=bool:?}, ch[5]: {=bool:?}, ch[6]: {=bool:?}, ch[7]: {=bool:?}, ch[8]: {=bool:?}, ch[9]: {=bool:?}, ch[10]: {=bool:?}, ch[11]: {=bool:?}, ch[12]: {=bool:?}, ch[13]: {=bool:?}, ch[14]: {=bool:?}, ch[15]: {=bool:?} }}",
self.ch(0usize),
self.ch(1usize),
self.ch(2usize),
self.ch(3usize),
self.ch(4usize),
self.ch(5usize),
self.ch(6usize),
self.ch(7usize),
self.ch(8usize),
self.ch(9usize),
self.ch(10usize),
self.ch(11usize),
self.ch(12usize),
self.ch(13usize),
self.ch(14usize),
self.ch(15usize)
)
}
}
#[doc = "Channel Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cher(pub u32);
impl Cher {
#[doc = "Channel 0 Enable"]
#[must_use]
#[inline(always)]
pub const fn ch(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Channel 0 Enable"]
#[inline(always)]
pub const fn set_ch(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Cher {
#[inline(always)]
fn default() -> Cher {
Cher(0)
}
}
impl core::fmt::Debug for Cher {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cher")
.field("ch[0]", &self.ch(0usize))
.field("ch[1]", &self.ch(1usize))
.field("ch[2]", &self.ch(2usize))
.field("ch[3]", &self.ch(3usize))
.field("ch[4]", &self.ch(4usize))
.field("ch[5]", &self.ch(5usize))
.field("ch[6]", &self.ch(6usize))
.field("ch[7]", &self.ch(7usize))
.field("ch[8]", &self.ch(8usize))
.field("ch[9]", &self.ch(9usize))
.field("ch[10]", &self.ch(10usize))
.field("ch[11]", &self.ch(11usize))
.field("ch[12]", &self.ch(12usize))
.field("ch[13]", &self.ch(13usize))
.field("ch[14]", &self.ch(14usize))
.field("ch[15]", &self.ch(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cher {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cher {{ ch[0]: {=bool:?}, ch[1]: {=bool:?}, ch[2]: {=bool:?}, ch[3]: {=bool:?}, ch[4]: {=bool:?}, ch[5]: {=bool:?}, ch[6]: {=bool:?}, ch[7]: {=bool:?}, ch[8]: {=bool:?}, ch[9]: {=bool:?}, ch[10]: {=bool:?}, ch[11]: {=bool:?}, ch[12]: {=bool:?}, ch[13]: {=bool:?}, ch[14]: {=bool:?}, ch[15]: {=bool:?} }}",
self.ch(0usize),
self.ch(1usize),
self.ch(2usize),
self.ch(3usize),
self.ch(4usize),
self.ch(5usize),
self.ch(6usize),
self.ch(7usize),
self.ch(8usize),
self.ch(9usize),
self.ch(10usize),
self.ch(11usize),
self.ch(12usize),
self.ch(13usize),
self.ch(14usize),
self.ch(15usize)
)
}
}
#[doc = "Channel Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Chsr(pub u32);
impl Chsr {
#[doc = "Channel 0 Status"]
#[must_use]
#[inline(always)]
pub const fn ch(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Channel 0 Status"]
#[inline(always)]
pub const fn set_ch(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Chsr {
#[inline(always)]
fn default() -> Chsr {
Chsr(0)
}
}
impl core::fmt::Debug for Chsr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Chsr")
.field("ch[0]", &self.ch(0usize))
.field("ch[1]", &self.ch(1usize))
.field("ch[2]", &self.ch(2usize))
.field("ch[3]", &self.ch(3usize))
.field("ch[4]", &self.ch(4usize))
.field("ch[5]", &self.ch(5usize))
.field("ch[6]", &self.ch(6usize))
.field("ch[7]", &self.ch(7usize))
.field("ch[8]", &self.ch(8usize))
.field("ch[9]", &self.ch(9usize))
.field("ch[10]", &self.ch(10usize))
.field("ch[11]", &self.ch(11usize))
.field("ch[12]", &self.ch(12usize))
.field("ch[13]", &self.ch(13usize))
.field("ch[14]", &self.ch(14usize))
.field("ch[15]", &self.ch(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Chsr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Chsr {{ ch[0]: {=bool:?}, ch[1]: {=bool:?}, ch[2]: {=bool:?}, ch[3]: {=bool:?}, ch[4]: {=bool:?}, ch[5]: {=bool:?}, ch[6]: {=bool:?}, ch[7]: {=bool:?}, ch[8]: {=bool:?}, ch[9]: {=bool:?}, ch[10]: {=bool:?}, ch[11]: {=bool:?}, ch[12]: {=bool:?}, ch[13]: {=bool:?}, ch[14]: {=bool:?}, ch[15]: {=bool:?} }}",
self.ch(0usize),
self.ch(1usize),
self.ch(2usize),
self.ch(3usize),
self.ch(4usize),
self.ch(5usize),
self.ch(6usize),
self.ch(7usize),
self.ch(8usize),
self.ch(9usize),
self.ch(10usize),
self.ch(11usize),
self.ch(12usize),
self.ch(13usize),
self.ch(14usize),
self.ch(15usize)
)
}
}
#[doc = "Channel Offset Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cor(pub u32);
impl Cor {
#[doc = "Offset for channel 0"]
#[must_use]
#[inline(always)]
pub const fn off(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Offset for channel 0"]
#[inline(always)]
pub const fn set_off(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Differential inputs for channel 0"]
#[must_use]
#[inline(always)]
pub const fn diff(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Differential inputs for channel 0"]
#[inline(always)]
pub const fn set_diff(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Cor {
#[inline(always)]
fn default() -> Cor {
Cor(0)
}
}
impl core::fmt::Debug for Cor {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cor")
.field("off[0]", &self.off(0usize))
.field("off[1]", &self.off(1usize))
.field("off[2]", &self.off(2usize))
.field("off[3]", &self.off(3usize))
.field("off[4]", &self.off(4usize))
.field("off[5]", &self.off(5usize))
.field("off[6]", &self.off(6usize))
.field("off[7]", &self.off(7usize))
.field("off[8]", &self.off(8usize))
.field("off[9]", &self.off(9usize))
.field("off[10]", &self.off(10usize))
.field("off[11]", &self.off(11usize))
.field("off[12]", &self.off(12usize))
.field("off[13]", &self.off(13usize))
.field("off[14]", &self.off(14usize))
.field("off[15]", &self.off(15usize))
.field("diff[0]", &self.diff(0usize))
.field("diff[1]", &self.diff(1usize))
.field("diff[2]", &self.diff(2usize))
.field("diff[3]", &self.diff(3usize))
.field("diff[4]", &self.diff(4usize))
.field("diff[5]", &self.diff(5usize))
.field("diff[6]", &self.diff(6usize))
.field("diff[7]", &self.diff(7usize))
.field("diff[8]", &self.diff(8usize))
.field("diff[9]", &self.diff(9usize))
.field("diff[10]", &self.diff(10usize))
.field("diff[11]", &self.diff(11usize))
.field("diff[12]", &self.diff(12usize))
.field("diff[13]", &self.diff(13usize))
.field("diff[14]", &self.diff(14usize))
.field("diff[15]", &self.diff(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cor {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cor {{ off[0]: {=bool:?}, off[1]: {=bool:?}, off[2]: {=bool:?}, off[3]: {=bool:?}, off[4]: {=bool:?}, off[5]: {=bool:?}, off[6]: {=bool:?}, off[7]: {=bool:?}, off[8]: {=bool:?}, off[9]: {=bool:?}, off[10]: {=bool:?}, off[11]: {=bool:?}, off[12]: {=bool:?}, off[13]: {=bool:?}, off[14]: {=bool:?}, off[15]: {=bool:?}, diff[0]: {=bool:?}, diff[1]: {=bool:?}, diff[2]: {=bool:?}, diff[3]: {=bool:?}, diff[4]: {=bool:?}, diff[5]: {=bool:?}, diff[6]: {=bool:?}, diff[7]: {=bool:?}, diff[8]: {=bool:?}, diff[9]: {=bool:?}, diff[10]: {=bool:?}, diff[11]: {=bool:?}, diff[12]: {=bool:?}, diff[13]: {=bool:?}, diff[14]: {=bool:?}, diff[15]: {=bool:?} }}",
self.off(0usize),
self.off(1usize),
self.off(2usize),
self.off(3usize),
self.off(4usize),
self.off(5usize),
self.off(6usize),
self.off(7usize),
self.off(8usize),
self.off(9usize),
self.off(10usize),
self.off(11usize),
self.off(12usize),
self.off(13usize),
self.off(14usize),
self.off(15usize),
self.diff(0usize),
self.diff(1usize),
self.diff(2usize),
self.diff(3usize),
self.diff(4usize),
self.diff(5usize),
self.diff(6usize),
self.diff(7usize),
self.diff(8usize),
self.diff(9usize),
self.diff(10usize),
self.diff(11usize),
self.diff(12usize),
self.diff(13usize),
self.diff(14usize),
self.diff(15usize)
)
}
}
#[doc = "Control Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
#[doc = "Software Reset"]
#[must_use]
#[inline(always)]
pub const fn swrst(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Software Reset"]
#[inline(always)]
pub const fn set_swrst(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
}
#[doc = "Start Conversion"]
#[must_use]
#[inline(always)]
pub const fn start(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "Start Conversion"]
#[inline(always)]
pub const fn set_start(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
}
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("swrst", &self.swrst())
.field("start", &self.start())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cr {{ swrst: {=bool:?}, start: {=bool:?} }}",
self.swrst(),
self.start()
)
}
}
#[doc = "Compare Window Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cwr(pub u32);
impl Cwr {
#[doc = "Low Threshold"]
#[must_use]
#[inline(always)]
pub const fn lowthres(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x0fff;
val as u16
}
#[doc = "Low Threshold"]
#[inline(always)]
pub const fn set_lowthres(&mut self, val: u16) {
self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
}
#[doc = "High Threshold"]
#[must_use]
#[inline(always)]
pub const fn highthres(&self) -> u16 {
let val = (self.0 >> 16usize) & 0x0fff;
val as u16
}
#[doc = "High Threshold"]
#[inline(always)]
pub const fn set_highthres(&mut self, val: u16) {
self.0 = (self.0 & !(0x0fff << 16usize)) | (((val as u32) & 0x0fff) << 16usize);
}
}
impl Default for Cwr {
#[inline(always)]
fn default() -> Cwr {
Cwr(0)
}
}
impl core::fmt::Debug for Cwr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cwr")
.field("lowthres", &self.lowthres())
.field("highthres", &self.highthres())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cwr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cwr {{ lowthres: {=u16:?}, highthres: {=u16:?} }}",
self.lowthres(),
self.highthres()
)
}
}
#[doc = "Extended Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Emr(pub u32);
impl Emr {
#[doc = "Comparison Mode"]
#[must_use]
#[inline(always)]
pub const fn cmpmode(&self) -> super::vals::Cmpmode {
let val = (self.0 >> 0usize) & 0x03;
super::vals::Cmpmode::from_bits(val as u8)
}
#[doc = "Comparison Mode"]
#[inline(always)]
pub const fn set_cmpmode(&mut self, val: super::vals::Cmpmode) {
self.0 = (self.0 & !(0x03 << 0usize)) | (((val.to_bits() as u32) & 0x03) << 0usize);
}
#[doc = "Comparison Selected Channel"]
#[must_use]
#[inline(always)]
pub const fn cmpsel(&self) -> u8 {
let val = (self.0 >> 4usize) & 0x0f;
val as u8
}
#[doc = "Comparison Selected Channel"]
#[inline(always)]
pub const fn set_cmpsel(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val as u32) & 0x0f) << 4usize);
}
#[doc = "Compare All Channels"]
#[must_use]
#[inline(always)]
pub const fn cmpall(&self) -> bool {
let val = (self.0 >> 9usize) & 0x01;
val != 0
}
#[doc = "Compare All Channels"]
#[inline(always)]
pub const fn set_cmpall(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 9usize)) | (((val as u32) & 0x01) << 9usize);
}
#[doc = "Compare Event Filtering"]
#[must_use]
#[inline(always)]
pub const fn cmpfilter(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x03;
val as u8
}
#[doc = "Compare Event Filtering"]
#[inline(always)]
pub const fn set_cmpfilter(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 12usize)) | (((val as u32) & 0x03) << 12usize);
}
#[doc = "TAG of the ADC_LDCR register"]
#[must_use]
#[inline(always)]
pub const fn tag(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "TAG of the ADC_LDCR register"]
#[inline(always)]
pub const fn set_tag(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
}
impl Default for Emr {
#[inline(always)]
fn default() -> Emr {
Emr(0)
}
}
impl core::fmt::Debug for Emr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Emr")
.field("cmpmode", &self.cmpmode())
.field("cmpsel", &self.cmpsel())
.field("cmpall", &self.cmpall())
.field("cmpfilter", &self.cmpfilter())
.field("tag", &self.tag())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Emr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Emr {{ cmpmode: {:?}, cmpsel: {=u8:?}, cmpall: {=bool:?}, cmpfilter: {=u8:?}, tag: {=bool:?} }}",
self.cmpmode(),
self.cmpsel(),
self.cmpall(),
self.cmpfilter(),
self.tag()
)
}
}
#[doc = "Interrupt Disable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Idr(pub u32);
impl Idr {
#[doc = "End of Conversion Interrupt Disable 0"]
#[must_use]
#[inline(always)]
pub const fn eoc(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "End of Conversion Interrupt Disable 0"]
#[inline(always)]
pub const fn set_eoc(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Data Ready Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn drdy(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Data Ready Interrupt Disable"]
#[inline(always)]
pub const fn set_drdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "General Overrun Error Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn govre(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "General Overrun Error Interrupt Disable"]
#[inline(always)]
pub const fn set_govre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Comparison Event Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn compe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Comparison Event Interrupt Disable"]
#[inline(always)]
pub const fn set_compe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "End of Receive Buffer Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 27usize) & 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 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "Receive Buffer Full Interrupt Disable"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 28usize) & 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 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
}
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("eoc[0]", &self.eoc(0usize))
.field("eoc[1]", &self.eoc(1usize))
.field("eoc[2]", &self.eoc(2usize))
.field("eoc[3]", &self.eoc(3usize))
.field("eoc[4]", &self.eoc(4usize))
.field("eoc[5]", &self.eoc(5usize))
.field("eoc[6]", &self.eoc(6usize))
.field("eoc[7]", &self.eoc(7usize))
.field("eoc[8]", &self.eoc(8usize))
.field("eoc[9]", &self.eoc(9usize))
.field("eoc[10]", &self.eoc(10usize))
.field("eoc[11]", &self.eoc(11usize))
.field("eoc[12]", &self.eoc(12usize))
.field("eoc[13]", &self.eoc(13usize))
.field("eoc[14]", &self.eoc(14usize))
.field("eoc[15]", &self.eoc(15usize))
.field("drdy", &self.drdy())
.field("govre", &self.govre())
.field("compe", &self.compe())
.field("endrx", &self.endrx())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Idr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Idr {{ eoc[0]: {=bool:?}, eoc[1]: {=bool:?}, eoc[2]: {=bool:?}, eoc[3]: {=bool:?}, eoc[4]: {=bool:?}, eoc[5]: {=bool:?}, eoc[6]: {=bool:?}, eoc[7]: {=bool:?}, eoc[8]: {=bool:?}, eoc[9]: {=bool:?}, eoc[10]: {=bool:?}, eoc[11]: {=bool:?}, eoc[12]: {=bool:?}, eoc[13]: {=bool:?}, eoc[14]: {=bool:?}, eoc[15]: {=bool:?}, drdy: {=bool:?}, govre: {=bool:?}, compe: {=bool:?}, endrx: {=bool:?}, rxbuff: {=bool:?} }}",
self.eoc(0usize),
self.eoc(1usize),
self.eoc(2usize),
self.eoc(3usize),
self.eoc(4usize),
self.eoc(5usize),
self.eoc(6usize),
self.eoc(7usize),
self.eoc(8usize),
self.eoc(9usize),
self.eoc(10usize),
self.eoc(11usize),
self.eoc(12usize),
self.eoc(13usize),
self.eoc(14usize),
self.eoc(15usize),
self.drdy(),
self.govre(),
self.compe(),
self.endrx(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Enable Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "End of Conversion Interrupt Enable 0"]
#[must_use]
#[inline(always)]
pub const fn eoc(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "End of Conversion Interrupt Enable 0"]
#[inline(always)]
pub const fn set_eoc(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Data Ready Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn drdy(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Data Ready Interrupt Enable"]
#[inline(always)]
pub const fn set_drdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "General Overrun Error Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn govre(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "General Overrun Error Interrupt Enable"]
#[inline(always)]
pub const fn set_govre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Comparison Event Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn compe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Comparison Event Interrupt Enable"]
#[inline(always)]
pub const fn set_compe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "End of Receive Buffer Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 27usize) & 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 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "Receive Buffer Full Interrupt Enable"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 28usize) & 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 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
}
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("eoc[0]", &self.eoc(0usize))
.field("eoc[1]", &self.eoc(1usize))
.field("eoc[2]", &self.eoc(2usize))
.field("eoc[3]", &self.eoc(3usize))
.field("eoc[4]", &self.eoc(4usize))
.field("eoc[5]", &self.eoc(5usize))
.field("eoc[6]", &self.eoc(6usize))
.field("eoc[7]", &self.eoc(7usize))
.field("eoc[8]", &self.eoc(8usize))
.field("eoc[9]", &self.eoc(9usize))
.field("eoc[10]", &self.eoc(10usize))
.field("eoc[11]", &self.eoc(11usize))
.field("eoc[12]", &self.eoc(12usize))
.field("eoc[13]", &self.eoc(13usize))
.field("eoc[14]", &self.eoc(14usize))
.field("eoc[15]", &self.eoc(15usize))
.field("drdy", &self.drdy())
.field("govre", &self.govre())
.field("compe", &self.compe())
.field("endrx", &self.endrx())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ier {{ eoc[0]: {=bool:?}, eoc[1]: {=bool:?}, eoc[2]: {=bool:?}, eoc[3]: {=bool:?}, eoc[4]: {=bool:?}, eoc[5]: {=bool:?}, eoc[6]: {=bool:?}, eoc[7]: {=bool:?}, eoc[8]: {=bool:?}, eoc[9]: {=bool:?}, eoc[10]: {=bool:?}, eoc[11]: {=bool:?}, eoc[12]: {=bool:?}, eoc[13]: {=bool:?}, eoc[14]: {=bool:?}, eoc[15]: {=bool:?}, drdy: {=bool:?}, govre: {=bool:?}, compe: {=bool:?}, endrx: {=bool:?}, rxbuff: {=bool:?} }}",
self.eoc(0usize),
self.eoc(1usize),
self.eoc(2usize),
self.eoc(3usize),
self.eoc(4usize),
self.eoc(5usize),
self.eoc(6usize),
self.eoc(7usize),
self.eoc(8usize),
self.eoc(9usize),
self.eoc(10usize),
self.eoc(11usize),
self.eoc(12usize),
self.eoc(13usize),
self.eoc(14usize),
self.eoc(15usize),
self.drdy(),
self.govre(),
self.compe(),
self.endrx(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Mask Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Imr(pub u32);
impl Imr {
#[doc = "End of Conversion Interrupt Mask 0"]
#[must_use]
#[inline(always)]
pub const fn eoc(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "End of Conversion Interrupt Mask 0"]
#[inline(always)]
pub const fn set_eoc(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Data Ready Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn drdy(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Data Ready Interrupt Mask"]
#[inline(always)]
pub const fn set_drdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "General Overrun Error Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn govre(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "General Overrun Error Interrupt Mask"]
#[inline(always)]
pub const fn set_govre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Comparison Event Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn compe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Comparison Event Interrupt Mask"]
#[inline(always)]
pub const fn set_compe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "End of Receive Buffer Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 27usize) & 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 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "Receive Buffer Full Interrupt Mask"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 28usize) & 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 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
}
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("eoc[0]", &self.eoc(0usize))
.field("eoc[1]", &self.eoc(1usize))
.field("eoc[2]", &self.eoc(2usize))
.field("eoc[3]", &self.eoc(3usize))
.field("eoc[4]", &self.eoc(4usize))
.field("eoc[5]", &self.eoc(5usize))
.field("eoc[6]", &self.eoc(6usize))
.field("eoc[7]", &self.eoc(7usize))
.field("eoc[8]", &self.eoc(8usize))
.field("eoc[9]", &self.eoc(9usize))
.field("eoc[10]", &self.eoc(10usize))
.field("eoc[11]", &self.eoc(11usize))
.field("eoc[12]", &self.eoc(12usize))
.field("eoc[13]", &self.eoc(13usize))
.field("eoc[14]", &self.eoc(14usize))
.field("eoc[15]", &self.eoc(15usize))
.field("drdy", &self.drdy())
.field("govre", &self.govre())
.field("compe", &self.compe())
.field("endrx", &self.endrx())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Imr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Imr {{ eoc[0]: {=bool:?}, eoc[1]: {=bool:?}, eoc[2]: {=bool:?}, eoc[3]: {=bool:?}, eoc[4]: {=bool:?}, eoc[5]: {=bool:?}, eoc[6]: {=bool:?}, eoc[7]: {=bool:?}, eoc[8]: {=bool:?}, eoc[9]: {=bool:?}, eoc[10]: {=bool:?}, eoc[11]: {=bool:?}, eoc[12]: {=bool:?}, eoc[13]: {=bool:?}, eoc[14]: {=bool:?}, eoc[15]: {=bool:?}, drdy: {=bool:?}, govre: {=bool:?}, compe: {=bool:?}, endrx: {=bool:?}, rxbuff: {=bool:?} }}",
self.eoc(0usize),
self.eoc(1usize),
self.eoc(2usize),
self.eoc(3usize),
self.eoc(4usize),
self.eoc(5usize),
self.eoc(6usize),
self.eoc(7usize),
self.eoc(8usize),
self.eoc(9usize),
self.eoc(10usize),
self.eoc(11usize),
self.eoc(12usize),
self.eoc(13usize),
self.eoc(14usize),
self.eoc(15usize),
self.drdy(),
self.govre(),
self.compe(),
self.endrx(),
self.rxbuff()
)
}
}
#[doc = "Interrupt Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isr(pub u32);
impl Isr {
#[doc = "End of Conversion 0"]
#[must_use]
#[inline(always)]
pub const fn eoc(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "End of Conversion 0"]
#[inline(always)]
pub const fn set_eoc(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Data Ready"]
#[must_use]
#[inline(always)]
pub const fn drdy(&self) -> bool {
let val = (self.0 >> 24usize) & 0x01;
val != 0
}
#[doc = "Data Ready"]
#[inline(always)]
pub const fn set_drdy(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
}
#[doc = "General Overrun Error"]
#[must_use]
#[inline(always)]
pub const fn govre(&self) -> bool {
let val = (self.0 >> 25usize) & 0x01;
val != 0
}
#[doc = "General Overrun Error"]
#[inline(always)]
pub const fn set_govre(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
}
#[doc = "Comparison Error"]
#[must_use]
#[inline(always)]
pub const fn compe(&self) -> bool {
let val = (self.0 >> 26usize) & 0x01;
val != 0
}
#[doc = "Comparison Error"]
#[inline(always)]
pub const fn set_compe(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
}
#[doc = "End of RX Buffer"]
#[must_use]
#[inline(always)]
pub const fn endrx(&self) -> bool {
let val = (self.0 >> 27usize) & 0x01;
val != 0
}
#[doc = "End of RX Buffer"]
#[inline(always)]
pub const fn set_endrx(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 27usize)) | (((val as u32) & 0x01) << 27usize);
}
#[doc = "RX Buffer Full"]
#[must_use]
#[inline(always)]
pub const fn rxbuff(&self) -> bool {
let val = (self.0 >> 28usize) & 0x01;
val != 0
}
#[doc = "RX Buffer Full"]
#[inline(always)]
pub const fn set_rxbuff(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 28usize)) | (((val as u32) & 0x01) << 28usize);
}
}
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("eoc[0]", &self.eoc(0usize))
.field("eoc[1]", &self.eoc(1usize))
.field("eoc[2]", &self.eoc(2usize))
.field("eoc[3]", &self.eoc(3usize))
.field("eoc[4]", &self.eoc(4usize))
.field("eoc[5]", &self.eoc(5usize))
.field("eoc[6]", &self.eoc(6usize))
.field("eoc[7]", &self.eoc(7usize))
.field("eoc[8]", &self.eoc(8usize))
.field("eoc[9]", &self.eoc(9usize))
.field("eoc[10]", &self.eoc(10usize))
.field("eoc[11]", &self.eoc(11usize))
.field("eoc[12]", &self.eoc(12usize))
.field("eoc[13]", &self.eoc(13usize))
.field("eoc[14]", &self.eoc(14usize))
.field("eoc[15]", &self.eoc(15usize))
.field("drdy", &self.drdy())
.field("govre", &self.govre())
.field("compe", &self.compe())
.field("endrx", &self.endrx())
.field("rxbuff", &self.rxbuff())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Isr {{ eoc[0]: {=bool:?}, eoc[1]: {=bool:?}, eoc[2]: {=bool:?}, eoc[3]: {=bool:?}, eoc[4]: {=bool:?}, eoc[5]: {=bool:?}, eoc[6]: {=bool:?}, eoc[7]: {=bool:?}, eoc[8]: {=bool:?}, eoc[9]: {=bool:?}, eoc[10]: {=bool:?}, eoc[11]: {=bool:?}, eoc[12]: {=bool:?}, eoc[13]: {=bool:?}, eoc[14]: {=bool:?}, eoc[15]: {=bool:?}, drdy: {=bool:?}, govre: {=bool:?}, compe: {=bool:?}, endrx: {=bool:?}, rxbuff: {=bool:?} }}",
self.eoc(0usize),
self.eoc(1usize),
self.eoc(2usize),
self.eoc(3usize),
self.eoc(4usize),
self.eoc(5usize),
self.eoc(6usize),
self.eoc(7usize),
self.eoc(8usize),
self.eoc(9usize),
self.eoc(10usize),
self.eoc(11usize),
self.eoc(12usize),
self.eoc(13usize),
self.eoc(14usize),
self.eoc(15usize),
self.drdy(),
self.govre(),
self.compe(),
self.endrx(),
self.rxbuff()
)
}
}
#[doc = "Last Converted Data Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Lcdr(pub u32);
impl Lcdr {
#[doc = "Last Data Converted"]
#[must_use]
#[inline(always)]
pub const fn ldata(&self) -> u16 {
let val = (self.0 >> 0usize) & 0x0fff;
val as u16
}
#[doc = "Last Data Converted"]
#[inline(always)]
pub const fn set_ldata(&mut self, val: u16) {
self.0 = (self.0 & !(0x0fff << 0usize)) | (((val as u32) & 0x0fff) << 0usize);
}
#[doc = "Channel Number"]
#[must_use]
#[inline(always)]
pub const fn chnb(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x0f;
val as u8
}
#[doc = "Channel Number"]
#[inline(always)]
pub const fn set_chnb(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 12usize)) | (((val as u32) & 0x0f) << 12usize);
}
}
impl Default for Lcdr {
#[inline(always)]
fn default() -> Lcdr {
Lcdr(0)
}
}
impl core::fmt::Debug for Lcdr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Lcdr")
.field("ldata", &self.ldata())
.field("chnb", &self.chnb())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Lcdr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Lcdr {{ ldata: {=u16:?}, chnb: {=u8:?} }}",
self.ldata(),
self.chnb()
)
}
}
#[doc = "Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Mr(pub u32);
impl Mr {
#[doc = "Trigger Enable"]
#[must_use]
#[inline(always)]
pub const fn trgen(&self) -> super::vals::Trgen {
let val = (self.0 >> 0usize) & 0x01;
super::vals::Trgen::from_bits(val as u8)
}
#[doc = "Trigger Enable"]
#[inline(always)]
pub const fn set_trgen(&mut self, val: super::vals::Trgen) {
self.0 = (self.0 & !(0x01 << 0usize)) | (((val.to_bits() as u32) & 0x01) << 0usize);
}
#[doc = "Trigger Selection"]
#[must_use]
#[inline(always)]
pub const fn trgsel(&self) -> super::vals::Trgsel {
let val = (self.0 >> 1usize) & 0x07;
super::vals::Trgsel::from_bits(val as u8)
}
#[doc = "Trigger Selection"]
#[inline(always)]
pub const fn set_trgsel(&mut self, val: super::vals::Trgsel) {
self.0 = (self.0 & !(0x07 << 1usize)) | (((val.to_bits() as u32) & 0x07) << 1usize);
}
#[must_use]
#[inline(always)]
pub const fn lowres(&self) -> super::vals::Resolution {
let val = (self.0 >> 4usize) & 0x01;
super::vals::Resolution::from_bits(val as u8)
}
#[inline(always)]
pub const fn set_lowres(&mut self, val: super::vals::Resolution) {
self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
}
#[doc = "Sleep Mode"]
#[must_use]
#[inline(always)]
pub const fn sleep(&self) -> super::vals::Sleep {
let val = (self.0 >> 5usize) & 0x01;
super::vals::Sleep::from_bits(val as u8)
}
#[doc = "Sleep Mode"]
#[inline(always)]
pub const fn set_sleep(&mut self, val: super::vals::Sleep) {
self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
}
#[doc = "Fast Wake Up"]
#[must_use]
#[inline(always)]
pub const fn fwup(&self) -> super::vals::Fwup {
let val = (self.0 >> 6usize) & 0x01;
super::vals::Fwup::from_bits(val as u8)
}
#[doc = "Fast Wake Up"]
#[inline(always)]
pub const fn set_fwup(&mut self, val: super::vals::Fwup) {
self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
}
#[doc = "Free Run Mode"]
#[must_use]
#[inline(always)]
pub const fn freerun(&self) -> super::vals::Freerun {
let val = (self.0 >> 7usize) & 0x01;
super::vals::Freerun::from_bits(val as u8)
}
#[doc = "Free Run Mode"]
#[inline(always)]
pub const fn set_freerun(&mut self, val: super::vals::Freerun) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
}
#[doc = "Prescaler Rate Selection"]
#[must_use]
#[inline(always)]
pub const fn prescal(&self) -> u8 {
let val = (self.0 >> 8usize) & 0xff;
val as u8
}
#[doc = "Prescaler Rate Selection"]
#[inline(always)]
pub const fn set_prescal(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 8usize)) | (((val as u32) & 0xff) << 8usize);
}
#[doc = "Start Up Time"]
#[must_use]
#[inline(always)]
pub const fn startup(&self) -> super::vals::Startup {
let val = (self.0 >> 16usize) & 0x0f;
super::vals::Startup::from_bits(val as u8)
}
#[doc = "Start Up Time"]
#[inline(always)]
pub const fn set_startup(&mut self, val: super::vals::Startup) {
self.0 = (self.0 & !(0x0f << 16usize)) | (((val.to_bits() as u32) & 0x0f) << 16usize);
}
#[doc = "Analog Settling Time"]
#[must_use]
#[inline(always)]
pub const fn settling(&self) -> super::vals::Settling {
let val = (self.0 >> 20usize) & 0x03;
super::vals::Settling::from_bits(val as u8)
}
#[doc = "Analog Settling Time"]
#[inline(always)]
pub const fn set_settling(&mut self, val: super::vals::Settling) {
self.0 = (self.0 & !(0x03 << 20usize)) | (((val.to_bits() as u32) & 0x03) << 20usize);
}
#[doc = "Analog Change"]
#[must_use]
#[inline(always)]
pub const fn anach(&self) -> super::vals::Anach {
let val = (self.0 >> 23usize) & 0x01;
super::vals::Anach::from_bits(val as u8)
}
#[doc = "Analog Change"]
#[inline(always)]
pub const fn set_anach(&mut self, val: super::vals::Anach) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val.to_bits() as u32) & 0x01) << 23usize);
}
#[doc = "Tracking Time"]
#[must_use]
#[inline(always)]
pub const fn tracktim(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x0f;
val as u8
}
#[doc = "Tracking Time"]
#[inline(always)]
pub const fn set_tracktim(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 24usize)) | (((val as u32) & 0x0f) << 24usize);
}
#[doc = "Transfer Period"]
#[must_use]
#[inline(always)]
pub const fn transfer(&self) -> u8 {
let val = (self.0 >> 28usize) & 0x03;
val as u8
}
#[doc = "Transfer Period"]
#[inline(always)]
pub const fn set_transfer(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 28usize)) | (((val as u32) & 0x03) << 28usize);
}
#[doc = "Use Sequence Enable"]
#[must_use]
#[inline(always)]
pub const fn useq(&self) -> super::vals::Useq {
let val = (self.0 >> 31usize) & 0x01;
super::vals::Useq::from_bits(val as u8)
}
#[doc = "Use Sequence Enable"]
#[inline(always)]
pub const fn set_useq(&mut self, val: super::vals::Useq) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val.to_bits() 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("trgen", &self.trgen())
.field("trgsel", &self.trgsel())
.field("lowres", &self.lowres())
.field("sleep", &self.sleep())
.field("fwup", &self.fwup())
.field("freerun", &self.freerun())
.field("prescal", &self.prescal())
.field("startup", &self.startup())
.field("settling", &self.settling())
.field("anach", &self.anach())
.field("tracktim", &self.tracktim())
.field("transfer", &self.transfer())
.field("useq", &self.useq())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Mr {{ trgen: {:?}, trgsel: {:?}, lowres: {:?}, sleep: {:?}, fwup: {:?}, freerun: {:?}, prescal: {=u8:?}, startup: {:?}, settling: {:?}, anach: {:?}, tracktim: {=u8:?}, transfer: {=u8:?}, useq: {:?} }}",
self.trgen(),
self.trgsel(),
self.lowres(),
self.sleep(),
self.fwup(),
self.freerun(),
self.prescal(),
self.startup(),
self.settling(),
self.anach(),
self.tracktim(),
self.transfer(),
self.useq()
)
}
}
#[doc = "Overrun Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Over(pub u32);
impl Over {
#[doc = "Overrun Error 0"]
#[must_use]
#[inline(always)]
pub const fn ovre(&self, n: usize) -> bool {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Overrun Error 0"]
#[inline(always)]
pub const fn set_ovre(&mut self, n: usize, val: bool) {
assert!(n < 16usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Over {
#[inline(always)]
fn default() -> Over {
Over(0)
}
}
impl core::fmt::Debug for Over {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Over")
.field("ovre[0]", &self.ovre(0usize))
.field("ovre[1]", &self.ovre(1usize))
.field("ovre[2]", &self.ovre(2usize))
.field("ovre[3]", &self.ovre(3usize))
.field("ovre[4]", &self.ovre(4usize))
.field("ovre[5]", &self.ovre(5usize))
.field("ovre[6]", &self.ovre(6usize))
.field("ovre[7]", &self.ovre(7usize))
.field("ovre[8]", &self.ovre(8usize))
.field("ovre[9]", &self.ovre(9usize))
.field("ovre[10]", &self.ovre(10usize))
.field("ovre[11]", &self.ovre(11usize))
.field("ovre[12]", &self.ovre(12usize))
.field("ovre[13]", &self.ovre(13usize))
.field("ovre[14]", &self.ovre(14usize))
.field("ovre[15]", &self.ovre(15usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Over {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Over {{ ovre[0]: {=bool:?}, ovre[1]: {=bool:?}, ovre[2]: {=bool:?}, ovre[3]: {=bool:?}, ovre[4]: {=bool:?}, ovre[5]: {=bool:?}, ovre[6]: {=bool:?}, ovre[7]: {=bool:?}, ovre[8]: {=bool:?}, ovre[9]: {=bool:?}, ovre[10]: {=bool:?}, ovre[11]: {=bool:?}, ovre[12]: {=bool:?}, ovre[13]: {=bool:?}, ovre[14]: {=bool:?}, ovre[15]: {=bool:?} }}",
self.ovre(0usize),
self.ovre(1usize),
self.ovre(2usize),
self.ovre(3usize),
self.ovre(4usize),
self.ovre(5usize),
self.ovre(6usize),
self.ovre(7usize),
self.ovre(8usize),
self.ovre(9usize),
self.ovre(10usize),
self.ovre(11usize),
self.ovre(12usize),
self.ovre(13usize),
self.ovre(14usize),
self.ovre(15usize)
)
}
}
#[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 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 = "Channel Sequence Register 1"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Seqr1(pub u32);
impl Seqr1 {
#[doc = "User Sequence Number 1"]
#[must_use]
#[inline(always)]
pub const fn usch1(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 1"]
#[inline(always)]
pub const fn set_usch1(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
#[doc = "User Sequence Number 2"]
#[must_use]
#[inline(always)]
pub const fn usch2(&self) -> u8 {
let val = (self.0 >> 4usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 2"]
#[inline(always)]
pub const fn set_usch2(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val as u32) & 0x0f) << 4usize);
}
#[doc = "User Sequence Number 3"]
#[must_use]
#[inline(always)]
pub const fn usch3(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 3"]
#[inline(always)]
pub const fn set_usch3(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
}
#[doc = "User Sequence Number 4"]
#[must_use]
#[inline(always)]
pub const fn usch4(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 4"]
#[inline(always)]
pub const fn set_usch4(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 12usize)) | (((val as u32) & 0x0f) << 12usize);
}
#[doc = "User Sequence Number 5"]
#[must_use]
#[inline(always)]
pub const fn usch5(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 5"]
#[inline(always)]
pub const fn set_usch5(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
}
#[doc = "User Sequence Number 6"]
#[must_use]
#[inline(always)]
pub const fn usch6(&self) -> u8 {
let val = (self.0 >> 20usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 6"]
#[inline(always)]
pub const fn set_usch6(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 20usize)) | (((val as u32) & 0x0f) << 20usize);
}
#[doc = "User Sequence Number 7"]
#[must_use]
#[inline(always)]
pub const fn usch7(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 7"]
#[inline(always)]
pub const fn set_usch7(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 24usize)) | (((val as u32) & 0x0f) << 24usize);
}
#[doc = "User Sequence Number 8"]
#[must_use]
#[inline(always)]
pub const fn usch8(&self) -> u8 {
let val = (self.0 >> 28usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 8"]
#[inline(always)]
pub const fn set_usch8(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 28usize)) | (((val as u32) & 0x0f) << 28usize);
}
}
impl Default for Seqr1 {
#[inline(always)]
fn default() -> Seqr1 {
Seqr1(0)
}
}
impl core::fmt::Debug for Seqr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Seqr1")
.field("usch1", &self.usch1())
.field("usch2", &self.usch2())
.field("usch3", &self.usch3())
.field("usch4", &self.usch4())
.field("usch5", &self.usch5())
.field("usch6", &self.usch6())
.field("usch7", &self.usch7())
.field("usch8", &self.usch8())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Seqr1 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Seqr1 {{ usch1: {=u8:?}, usch2: {=u8:?}, usch3: {=u8:?}, usch4: {=u8:?}, usch5: {=u8:?}, usch6: {=u8:?}, usch7: {=u8:?}, usch8: {=u8:?} }}",
self.usch1(),
self.usch2(),
self.usch3(),
self.usch4(),
self.usch5(),
self.usch6(),
self.usch7(),
self.usch8()
)
}
}
#[doc = "Channel Sequence Register 2"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Seqr2(pub u32);
impl Seqr2 {
#[doc = "User Sequence Number 9"]
#[must_use]
#[inline(always)]
pub const fn usch9(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 9"]
#[inline(always)]
pub const fn set_usch9(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
}
#[doc = "User Sequence Number 10"]
#[must_use]
#[inline(always)]
pub const fn usch10(&self) -> u8 {
let val = (self.0 >> 4usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 10"]
#[inline(always)]
pub const fn set_usch10(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 4usize)) | (((val as u32) & 0x0f) << 4usize);
}
#[doc = "User Sequence Number 11"]
#[must_use]
#[inline(always)]
pub const fn usch11(&self) -> u8 {
let val = (self.0 >> 8usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 11"]
#[inline(always)]
pub const fn set_usch11(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
}
#[doc = "User Sequence Number 12"]
#[must_use]
#[inline(always)]
pub const fn usch12(&self) -> u8 {
let val = (self.0 >> 12usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 12"]
#[inline(always)]
pub const fn set_usch12(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 12usize)) | (((val as u32) & 0x0f) << 12usize);
}
#[doc = "User Sequence Number 13"]
#[must_use]
#[inline(always)]
pub const fn usch13(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 13"]
#[inline(always)]
pub const fn set_usch13(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
}
#[doc = "User Sequence Number 14"]
#[must_use]
#[inline(always)]
pub const fn usch14(&self) -> u8 {
let val = (self.0 >> 20usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 14"]
#[inline(always)]
pub const fn set_usch14(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 20usize)) | (((val as u32) & 0x0f) << 20usize);
}
#[doc = "User Sequence Number 15"]
#[must_use]
#[inline(always)]
pub const fn usch15(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x0f;
val as u8
}
#[doc = "User Sequence Number 15"]
#[inline(always)]
pub const fn set_usch15(&mut self, val: u8) {
self.0 = (self.0 & !(0x0f << 24usize)) | (((val as u32) & 0x0f) << 24usize);
}
}
impl Default for Seqr2 {
#[inline(always)]
fn default() -> Seqr2 {
Seqr2(0)
}
}
impl core::fmt::Debug for Seqr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Seqr2")
.field("usch9", &self.usch9())
.field("usch10", &self.usch10())
.field("usch11", &self.usch11())
.field("usch12", &self.usch12())
.field("usch13", &self.usch13())
.field("usch14", &self.usch14())
.field("usch15", &self.usch15())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Seqr2 {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Seqr2 {{ usch9: {=u8:?}, usch10: {=u8:?}, usch11: {=u8:?}, usch12: {=u8:?}, usch13: {=u8:?}, usch14: {=u8:?}, usch15: {=u8:?} }}",
self.usch9(),
self.usch10(),
self.usch11(),
self.usch12(),
self.usch13(),
self.usch14(),
self.usch15()
)
}
}
#[doc = "Write Protect Mode Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wpmr(pub u32);
impl Wpmr {
#[doc = "Write Protect Enable"]
#[must_use]
#[inline(always)]
pub const fn wpen(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write Protect 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 Protect 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 Protect 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 Protect Status Register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Wpsr(pub u32);
impl Wpsr {
#[doc = "Write Protect Violation Status"]
#[must_use]
#[inline(always)]
pub const fn wpvs(&self) -> bool {
let val = (self.0 >> 0usize) & 0x01;
val != 0
}
#[doc = "Write Protect 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 Protect Violation Source"]
#[must_use]
#[inline(always)]
pub const fn wpvsrc(&self) -> u16 {
let val = (self.0 >> 8usize) & 0xffff;
val as u16
}
#[doc = "Write Protect 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()
)
}
}