pub type R = crate::R<ADCCTRLrs>;
pub type W = crate::W<ADCCTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ADC0CLKSEL {
Disabled = 0,
Auxhfrco = 1,
Hfxo = 2,
Hfsrcclk = 3,
}
impl From<ADC0CLKSEL> for u8 {
#[inline(always)]
fn from(variant: ADC0CLKSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for ADC0CLKSEL {
type Ux = u8;
}
impl crate::IsEnum for ADC0CLKSEL {}
pub type Adc0clkselR = crate::FieldReader<ADC0CLKSEL>;
impl Adc0clkselR {
#[inline(always)]
pub const fn variant(&self) -> ADC0CLKSEL {
match self.bits {
0 => ADC0CLKSEL::Disabled,
1 => ADC0CLKSEL::Auxhfrco,
2 => ADC0CLKSEL::Hfxo,
3 => ADC0CLKSEL::Hfsrcclk,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == ADC0CLKSEL::Disabled
}
#[inline(always)]
pub fn is_auxhfrco(&self) -> bool {
*self == ADC0CLKSEL::Auxhfrco
}
#[inline(always)]
pub fn is_hfxo(&self) -> bool {
*self == ADC0CLKSEL::Hfxo
}
#[inline(always)]
pub fn is_hfsrcclk(&self) -> bool {
*self == ADC0CLKSEL::Hfsrcclk
}
}
pub type Adc0clkselW<'a, REG> = crate::FieldWriter<'a, REG, 2, ADC0CLKSEL, crate::Safe>;
impl<'a, REG> Adc0clkselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(ADC0CLKSEL::Disabled)
}
#[inline(always)]
pub fn auxhfrco(self) -> &'a mut crate::W<REG> {
self.variant(ADC0CLKSEL::Auxhfrco)
}
#[inline(always)]
pub fn hfxo(self) -> &'a mut crate::W<REG> {
self.variant(ADC0CLKSEL::Hfxo)
}
#[inline(always)]
pub fn hfsrcclk(self) -> &'a mut crate::W<REG> {
self.variant(ADC0CLKSEL::Hfsrcclk)
}
}
pub type Adc0clkinvR = crate::BitReader;
pub type Adc0clkinvW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn adc0clksel(&self) -> Adc0clkselR {
Adc0clkselR::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn adc0clkinv(&self) -> Adc0clkinvR {
Adc0clkinvR::new(((self.bits >> 8) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ADCCTRL")
.field("adc0clksel", &self.adc0clksel())
.field("adc0clkinv", &self.adc0clkinv())
.finish()
}
}
impl W {
#[inline(always)]
pub fn adc0clksel(&mut self) -> Adc0clkselW<'_, ADCCTRLrs> {
Adc0clkselW::new(self, 4)
}
#[inline(always)]
pub fn adc0clkinv(&mut self) -> Adc0clkinvW<'_, ADCCTRLrs> {
Adc0clkinvW::new(self, 8)
}
}
pub struct ADCCTRLrs;
impl crate::RegisterSpec for ADCCTRLrs {
type Ux = u32;
}
impl crate::Readable for ADCCTRLrs {}
impl crate::Writable for ADCCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for ADCCTRLrs {}