pub type R = crate::R<CURPROGrs>;
pub type W = crate::W<CURPROGrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RANGESEL {
Range0 = 0,
Range1 = 1,
Range2 = 2,
Range3 = 3,
}
impl From<RANGESEL> for u8 {
#[inline(always)]
fn from(variant: RANGESEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for RANGESEL {
type Ux = u8;
}
impl crate::IsEnum for RANGESEL {}
pub type RangeselR = crate::FieldReader<RANGESEL>;
impl RangeselR {
#[inline(always)]
pub const fn variant(&self) -> RANGESEL {
match self.bits {
0 => RANGESEL::Range0,
1 => RANGESEL::Range1,
2 => RANGESEL::Range2,
3 => RANGESEL::Range3,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_range0(&self) -> bool {
*self == RANGESEL::Range0
}
#[inline(always)]
pub fn is_range1(&self) -> bool {
*self == RANGESEL::Range1
}
#[inline(always)]
pub fn is_range2(&self) -> bool {
*self == RANGESEL::Range2
}
#[inline(always)]
pub fn is_range3(&self) -> bool {
*self == RANGESEL::Range3
}
}
pub type RangeselW<'a, REG> = crate::FieldWriter<'a, REG, 2, RANGESEL, crate::Safe>;
impl<'a, REG> RangeselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn range0(self) -> &'a mut crate::W<REG> {
self.variant(RANGESEL::Range0)
}
#[inline(always)]
pub fn range1(self) -> &'a mut crate::W<REG> {
self.variant(RANGESEL::Range1)
}
#[inline(always)]
pub fn range2(self) -> &'a mut crate::W<REG> {
self.variant(RANGESEL::Range2)
}
#[inline(always)]
pub fn range3(self) -> &'a mut crate::W<REG> {
self.variant(RANGESEL::Range3)
}
}
pub type StepselR = crate::FieldReader;
pub type StepselW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
pub type TuningR = crate::FieldReader;
pub type TuningW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl R {
#[inline(always)]
pub fn rangesel(&self) -> RangeselR {
RangeselR::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn stepsel(&self) -> StepselR {
StepselR::new(((self.bits >> 8) & 0x1f) as u8)
}
#[inline(always)]
pub fn tuning(&self) -> TuningR {
TuningR::new(((self.bits >> 16) & 0xff) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CURPROG")
.field("rangesel", &self.rangesel())
.field("stepsel", &self.stepsel())
.field("tuning", &self.tuning())
.finish()
}
}
impl W {
#[inline(always)]
pub fn rangesel(&mut self) -> RangeselW<'_, CURPROGrs> {
RangeselW::new(self, 0)
}
#[inline(always)]
pub fn stepsel(&mut self) -> StepselW<'_, CURPROGrs> {
StepselW::new(self, 8)
}
#[inline(always)]
pub fn tuning(&mut self) -> TuningW<'_, CURPROGrs> {
TuningW::new(self, 16)
}
}
pub struct CURPROGrs;
impl crate::RegisterSpec for CURPROGrs {
type Ux = u32;
}
impl crate::Readable for CURPROGrs {}
impl crate::Writable for CURPROGrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CURPROGrs {
const RESET_VALUE: u32 = 0x009b_0000;
}