pub type R = crate::R<SRrs>;
pub type W = crate::W<SRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMAUDR1 {
NoUnderrun = 0,
Underrun = 1,
}
impl From<DMAUDR1> for bool {
#[inline(always)]
fn from(variant: DMAUDR1) -> Self {
variant as u8 != 0
}
}
pub type DMAUDR_R = crate::BitReader<DMAUDR1>;
impl DMAUDR_R {
#[inline(always)]
pub const fn variant(&self) -> DMAUDR1 {
match self.bits {
false => DMAUDR1::NoUnderrun,
true => DMAUDR1::Underrun,
}
}
#[inline(always)]
pub fn is_no_underrun(&self) -> bool {
*self == DMAUDR1::NoUnderrun
}
#[inline(always)]
pub fn is_underrun(&self) -> bool {
*self == DMAUDR1::Underrun
}
}
pub type DMAUDR_W<'a, REG> = crate::BitWriter<'a, REG, DMAUDR1>;
impl<'a, REG> DMAUDR_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn no_underrun(self) -> &'a mut crate::W<REG> {
self.variant(DMAUDR1::NoUnderrun)
}
#[inline(always)]
pub fn underrun(self) -> &'a mut crate::W<REG> {
self.variant(DMAUDR1::Underrun)
}
}
impl R {
#[inline(always)]
pub fn dmaudr(&self, n: u8) -> DMAUDR_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
DMAUDR_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0)
}
#[inline(always)]
pub fn dmaudr_iter(&self) -> impl Iterator<Item = DMAUDR_R> + '_ {
(0..2).map(move |n| DMAUDR_R::new(((self.bits >> (n * 16 + 13)) & 1) != 0))
}
#[inline(always)]
pub fn dmaudr1(&self) -> DMAUDR_R {
DMAUDR_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn dmaudr2(&self) -> DMAUDR_R {
DMAUDR_R::new(((self.bits >> 29) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SR")
.field("dmaudr1", &self.dmaudr1())
.field("dmaudr2", &self.dmaudr2())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dmaudr(&mut self, n: u8) -> DMAUDR_W<SRrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
DMAUDR_W::new(self, n * 16 + 13)
}
#[inline(always)]
pub fn dmaudr1(&mut self) -> DMAUDR_W<SRrs> {
DMAUDR_W::new(self, 13)
}
#[inline(always)]
pub fn dmaudr2(&mut self) -> DMAUDR_W<SRrs> {
DMAUDR_W::new(self, 29)
}
}
pub struct SRrs;
impl crate::RegisterSpec for SRrs {
type Ux = u32;
}
impl crate::Readable for SRrs {}
impl crate::Writable for SRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for SRrs {}