efm32pg1b-pac 0.4.3

Peripheral access API for Silicon Labs EFM32PG1B microcontrollers
Documentation
///Register `BIASPROG` reader
pub type R = crate::R<BIASPROGrs>;
///Register `BIASPROG` writer
pub type W = crate::W<BIASPROGrs>;
///Bias Programming Value of Analog ADC Block
///
///Value on reset: 0
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ADCBIASPROG {
    ///0: Normal power (use for 1Msps operation)
    Normal = 0,
    ///4: Scaling bias to 1/2
    Scale2 = 4,
    ///8: Scaling bias to 1/4
    Scale4 = 8,
    ///12: Scaling bias to 1/8
    Scale8 = 12,
    ///14: Scaling bias to 1/16
    Scale16 = 14,
    ///15: Scaling bias to 1/32
    Scale32 = 15,
}
impl From<ADCBIASPROG> for u8 {
    #[inline(always)]
    fn from(variant: ADCBIASPROG) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for ADCBIASPROG {
    type Ux = u8;
}
impl crate::IsEnum for ADCBIASPROG {}
///Field `ADCBIASPROG` reader - Bias Programming Value of Analog ADC Block
pub type AdcbiasprogR = crate::FieldReader<ADCBIASPROG>;
impl AdcbiasprogR {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<ADCBIASPROG> {
        match self.bits {
            0 => Some(ADCBIASPROG::Normal),
            4 => Some(ADCBIASPROG::Scale2),
            8 => Some(ADCBIASPROG::Scale4),
            12 => Some(ADCBIASPROG::Scale8),
            14 => Some(ADCBIASPROG::Scale16),
            15 => Some(ADCBIASPROG::Scale32),
            _ => None,
        }
    }
    ///Normal power (use for 1Msps operation)
    #[inline(always)]
    pub fn is_normal(&self) -> bool {
        *self == ADCBIASPROG::Normal
    }
    ///Scaling bias to 1/2
    #[inline(always)]
    pub fn is_scale2(&self) -> bool {
        *self == ADCBIASPROG::Scale2
    }
    ///Scaling bias to 1/4
    #[inline(always)]
    pub fn is_scale4(&self) -> bool {
        *self == ADCBIASPROG::Scale4
    }
    ///Scaling bias to 1/8
    #[inline(always)]
    pub fn is_scale8(&self) -> bool {
        *self == ADCBIASPROG::Scale8
    }
    ///Scaling bias to 1/16
    #[inline(always)]
    pub fn is_scale16(&self) -> bool {
        *self == ADCBIASPROG::Scale16
    }
    ///Scaling bias to 1/32
    #[inline(always)]
    pub fn is_scale32(&self) -> bool {
        *self == ADCBIASPROG::Scale32
    }
}
///Field `ADCBIASPROG` writer - Bias Programming Value of Analog ADC Block
pub type AdcbiasprogW<'a, REG> = crate::FieldWriter<'a, REG, 4, ADCBIASPROG>;
impl<'a, REG> AdcbiasprogW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///Normal power (use for 1Msps operation)
    #[inline(always)]
    pub fn normal(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Normal)
    }
    ///Scaling bias to 1/2
    #[inline(always)]
    pub fn scale2(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Scale2)
    }
    ///Scaling bias to 1/4
    #[inline(always)]
    pub fn scale4(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Scale4)
    }
    ///Scaling bias to 1/8
    #[inline(always)]
    pub fn scale8(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Scale8)
    }
    ///Scaling bias to 1/16
    #[inline(always)]
    pub fn scale16(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Scale16)
    }
    ///Scaling bias to 1/32
    #[inline(always)]
    pub fn scale32(self) -> &'a mut crate::W<REG> {
        self.variant(ADCBIASPROG::Scale32)
    }
}
///Field `VFAULTCLR` reader - Clear VREFOF Flag
pub type VfaultclrR = crate::BitReader;
///Field `VFAULTCLR` writer - Clear VREFOF Flag
pub type VfaultclrW<'a, REG> = crate::BitWriter<'a, REG>;
///Field `GPBIASACC` reader - Accuracy Setting for the System Bias During ADC Operation
pub type GpbiasaccR = crate::BitReader;
///Field `GPBIASACC` writer - Accuracy Setting for the System Bias During ADC Operation
pub type GpbiasaccW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
    ///Bits 0:3 - Bias Programming Value of Analog ADC Block
    #[inline(always)]
    pub fn adcbiasprog(&self) -> AdcbiasprogR {
        AdcbiasprogR::new((self.bits & 0x0f) as u8)
    }
    ///Bit 12 - Clear VREFOF Flag
    #[inline(always)]
    pub fn vfaultclr(&self) -> VfaultclrR {
        VfaultclrR::new(((self.bits >> 12) & 1) != 0)
    }
    ///Bit 16 - Accuracy Setting for the System Bias During ADC Operation
    #[inline(always)]
    pub fn gpbiasacc(&self) -> GpbiasaccR {
        GpbiasaccR::new(((self.bits >> 16) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("BIASPROG")
            .field("adcbiasprog", &self.adcbiasprog())
            .field("vfaultclr", &self.vfaultclr())
            .field("gpbiasacc", &self.gpbiasacc())
            .finish()
    }
}
impl W {
    ///Bits 0:3 - Bias Programming Value of Analog ADC Block
    #[inline(always)]
    pub fn adcbiasprog(&mut self) -> AdcbiasprogW<'_, BIASPROGrs> {
        AdcbiasprogW::new(self, 0)
    }
    ///Bit 12 - Clear VREFOF Flag
    #[inline(always)]
    pub fn vfaultclr(&mut self) -> VfaultclrW<'_, BIASPROGrs> {
        VfaultclrW::new(self, 12)
    }
    ///Bit 16 - Accuracy Setting for the System Bias During ADC Operation
    #[inline(always)]
    pub fn gpbiasacc(&mut self) -> GpbiasaccW<'_, BIASPROGrs> {
        GpbiasaccW::new(self, 16)
    }
}
///Bias Programming Register for Various Analog Blocks Used in ADC Operation
///
///You can [`read`](crate::Reg::read) this register and get [`biasprog::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`biasprog::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
pub struct BIASPROGrs;
impl crate::RegisterSpec for BIASPROGrs {
    type Ux = u32;
}
///`read()` method returns [`biasprog::R`](R) reader structure
impl crate::Readable for BIASPROGrs {}
///`write(|w| ..)` method takes [`biasprog::W`](W) writer structure
impl crate::Writable for BIASPROGrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets BIASPROG to value 0
impl crate::Resettable for BIASPROGrs {}