pub type R = crate::R<D1CFGRrs>;
pub type W = crate::W<D1CFGRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum HPRE {
Div2 = 8,
Div4 = 9,
Div8 = 10,
Div16 = 11,
Div64 = 12,
Div128 = 13,
Div256 = 14,
Div512 = 15,
Div1 = 0,
}
impl From<HPRE> for u8 {
#[inline(always)]
fn from(variant: HPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for HPRE {
type Ux = u8;
}
impl crate::IsEnum for HPRE {}
pub type HPRE_R = crate::FieldReader<HPRE>;
impl HPRE_R {
#[inline(always)]
pub const fn variant(&self) -> HPRE {
match self.bits {
8 => HPRE::Div2,
9 => HPRE::Div4,
10 => HPRE::Div8,
11 => HPRE::Div16,
12 => HPRE::Div64,
13 => HPRE::Div128,
14 => HPRE::Div256,
15 => HPRE::Div512,
_ => HPRE::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == HPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == HPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == HPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == HPRE::Div16
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == HPRE::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == HPRE::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == HPRE::Div256
}
#[inline(always)]
pub fn is_div512(&self) -> bool {
*self == HPRE::Div512
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), HPRE::Div1)
}
}
pub type HPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 4, HPRE, crate::Safe>;
impl<'a, REG> HPRE_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(HPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div16)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div256)
}
#[inline(always)]
pub fn div512(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div512)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(HPRE::Div1)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum D1PPRE {
Div2 = 4,
Div4 = 5,
Div8 = 6,
Div16 = 7,
Div1 = 0,
}
impl From<D1PPRE> for u8 {
#[inline(always)]
fn from(variant: D1PPRE) -> Self {
variant as _
}
}
impl crate::FieldSpec for D1PPRE {
type Ux = u8;
}
impl crate::IsEnum for D1PPRE {}
pub type D1PPRE_R = crate::FieldReader<D1PPRE>;
impl D1PPRE_R {
#[inline(always)]
pub const fn variant(&self) -> D1PPRE {
match self.bits {
4 => D1PPRE::Div2,
5 => D1PPRE::Div4,
6 => D1PPRE::Div8,
7 => D1PPRE::Div16,
_ => D1PPRE::Div1,
}
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == D1PPRE::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == D1PPRE::Div4
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == D1PPRE::Div8
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == D1PPRE::Div16
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
matches!(self.variant(), D1PPRE::Div1)
}
}
pub type D1PPRE_W<'a, REG> = crate::FieldWriter<'a, REG, 3, D1PPRE, crate::Safe>;
impl<'a, REG> D1PPRE_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(D1PPRE::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(D1PPRE::Div4)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(D1PPRE::Div8)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(D1PPRE::Div16)
}
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(D1PPRE::Div1)
}
}
pub use HPRE_R as D1CPRE_R;
pub use HPRE_W as D1CPRE_W;
impl R {
#[inline(always)]
pub fn hpre(&self) -> HPRE_R {
HPRE_R::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn d1ppre(&self) -> D1PPRE_R {
D1PPRE_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn d1cpre(&self) -> D1CPRE_R {
D1CPRE_R::new(((self.bits >> 8) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("D1CFGR")
.field("hpre", &self.hpre())
.field("d1ppre", &self.d1ppre())
.field("d1cpre", &self.d1cpre())
.finish()
}
}
impl W {
#[inline(always)]
pub fn hpre(&mut self) -> HPRE_W<D1CFGRrs> {
HPRE_W::new(self, 0)
}
#[inline(always)]
pub fn d1ppre(&mut self) -> D1PPRE_W<D1CFGRrs> {
D1PPRE_W::new(self, 4)
}
#[inline(always)]
pub fn d1cpre(&mut self) -> D1CPRE_W<D1CFGRrs> {
D1CPRE_W::new(self, 8)
}
}
pub struct D1CFGRrs;
impl crate::RegisterSpec for D1CFGRrs {
type Ux = u32;
}
impl crate::Readable for D1CFGRrs {}
impl crate::Writable for D1CFGRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for D1CFGRrs {}