pub type R = crate::R<D3PCR2Lrs>;
pub type W = crate::W<D3PCR2Lrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PCS34 {
DmaCh6 = 0,
DmaCh7 = 1,
Lptim4 = 2,
Lptim5 = 3,
}
impl From<PCS34> for u8 {
#[inline(always)]
fn from(variant: PCS34) -> Self {
variant as _
}
}
impl crate::FieldSpec for PCS34 {
type Ux = u8;
}
impl crate::IsEnum for PCS34 {}
pub type PCS34_R = crate::FieldReader<PCS34>;
impl PCS34_R {
#[inline(always)]
pub const fn variant(&self) -> PCS34 {
match self.bits {
0 => PCS34::DmaCh6,
1 => PCS34::DmaCh7,
2 => PCS34::Lptim4,
3 => PCS34::Lptim5,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_dma_ch6(&self) -> bool {
*self == PCS34::DmaCh6
}
#[inline(always)]
pub fn is_dma_ch7(&self) -> bool {
*self == PCS34::DmaCh7
}
#[inline(always)]
pub fn is_lptim4(&self) -> bool {
*self == PCS34::Lptim4
}
#[inline(always)]
pub fn is_lptim5(&self) -> bool {
*self == PCS34::Lptim5
}
}
pub type PCS34_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PCS34, crate::Safe>;
impl<'a, REG> PCS34_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn dma_ch6(self) -> &'a mut crate::W<REG> {
self.variant(PCS34::DmaCh6)
}
#[inline(always)]
pub fn dma_ch7(self) -> &'a mut crate::W<REG> {
self.variant(PCS34::DmaCh7)
}
#[inline(always)]
pub fn lptim4(self) -> &'a mut crate::W<REG> {
self.variant(PCS34::Lptim4)
}
#[inline(always)]
pub fn lptim5(self) -> &'a mut crate::W<REG> {
self.variant(PCS34::Lptim5)
}
}
pub use PCS34_R as PCS35_R;
pub use PCS34_R as PCS41_R;
pub use PCS34_W as PCS35_W;
pub use PCS34_W as PCS41_W;
impl R {
#[inline(always)]
pub fn pcs34(&self) -> PCS34_R {
PCS34_R::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn pcs35(&self) -> PCS35_R {
PCS35_R::new(((self.bits >> 6) & 3) as u8)
}
#[inline(always)]
pub fn pcs41(&self) -> PCS41_R {
PCS41_R::new(((self.bits >> 18) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("D3PCR2L")
.field("pcs34", &self.pcs34())
.field("pcs35", &self.pcs35())
.field("pcs41", &self.pcs41())
.finish()
}
}
impl W {
#[inline(always)]
pub fn pcs34(&mut self) -> PCS34_W<D3PCR2Lrs> {
PCS34_W::new(self, 4)
}
#[inline(always)]
pub fn pcs35(&mut self) -> PCS35_W<D3PCR2Lrs> {
PCS35_W::new(self, 6)
}
#[inline(always)]
pub fn pcs41(&mut self) -> PCS41_W<D3PCR2Lrs> {
PCS41_W::new(self, 18)
}
}
pub struct D3PCR2Lrs;
impl crate::RegisterSpec for D3PCR2Lrs {
type Ux = u32;
}
impl crate::Readable for D3PCR2Lrs {}
impl crate::Writable for D3PCR2Lrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for D3PCR2Lrs {}