pub type R = crate::R<D3CFGRrs>;
pub type W = crate::W<D3CFGRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum D3PPRE {
Div2 = 4,
Div4 = 5,
Div8 = 6,
Div16 = 7,
Div1 = 0,
}
impl From<D3PPRE> for u8 {
#[inline(always)]
fn from(variant: D3PPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for D3PPRE {
type Ux = u8;
}
impl crate::IsEnum for D3PPRE {}
pub type D3PPRE_R = crate::FieldReader<D3PPRE>;
impl D3PPRE_R {
#[inline(always)]
pub const fn variant(&self) -> D3PPRE {
match self.bits {
4 => D3PPRE::Div2,
5 => D3PPRE::Div4,
6 => D3PPRE::Div8,
7 => D3PPRE::Div16,
_ => D3PPRE::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == D3PPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == D3PPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == D3PPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == D3PPRE::Div16
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), D3PPRE::Div1)
}
}
pub type D3PPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, D3PPRE, crate::Safe>;
impl<'a, REG> D3PPRE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(D3PPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(D3PPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(D3PPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(D3PPRE::Div16)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(D3PPRE::Div1)
}
}
impl R {
#[inline(always)]
pub fn d3ppre(&self) -> D3PPRE_R {
D3PPRE_R::new(((self.bits >> 4) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("D3CFGR").field("d3ppre", &self.d3ppre()).finish()
}
}
impl W {
#[inline(always)]
pub fn d3ppre(&mut self) -> D3PPRE_W<D3CFGRrs> {
D3PPRE_W::new(self, 4)
}
}
pub struct D3CFGRrs;
impl crate::RegisterSpec for D3CFGRrs {
type Ux = u32;
}
impl crate::Readable for D3CFGRrs {}
impl crate::Writable for D3CFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for D3CFGRrs {}