pub type R = crate::R<BIASPROGrs>;
pub type W = crate::W<BIASPROGrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum ADCBIASPROG {
Normal = 0,
Scale2 = 4,
Scale4 = 8,
Scale8 = 12,
Scale16 = 14,
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 {}
pub type AdcbiasprogR = crate::FieldReader<ADCBIASPROG>;
impl AdcbiasprogR {
#[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,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == ADCBIASPROG::Normal
}
#[inline(always)]
pub fn is_scale2(&self) -> bool {
*self == ADCBIASPROG::Scale2
}
#[inline(always)]
pub fn is_scale4(&self) -> bool {
*self == ADCBIASPROG::Scale4
}
#[inline(always)]
pub fn is_scale8(&self) -> bool {
*self == ADCBIASPROG::Scale8
}
#[inline(always)]
pub fn is_scale16(&self) -> bool {
*self == ADCBIASPROG::Scale16
}
#[inline(always)]
pub fn is_scale32(&self) -> bool {
*self == ADCBIASPROG::Scale32
}
}
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>,
{
#[inline(always)]
pub fn normal(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Normal)
}
#[inline(always)]
pub fn scale2(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Scale2)
}
#[inline(always)]
pub fn scale4(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Scale4)
}
#[inline(always)]
pub fn scale8(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Scale8)
}
#[inline(always)]
pub fn scale16(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Scale16)
}
#[inline(always)]
pub fn scale32(self) -> &'a mut crate::W<REG> {
self.variant(ADCBIASPROG::Scale32)
}
}
pub type VfaultclrR = crate::BitReader;
pub type VfaultclrW<'a, REG> = crate::BitWriter<'a, REG>;
pub type GpbiasaccR = crate::BitReader;
pub type GpbiasaccW<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn adcbiasprog(&self) -> AdcbiasprogR {
AdcbiasprogR::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn vfaultclr(&self) -> VfaultclrR {
VfaultclrR::new(((self.bits >> 12) & 1) != 0)
}
#[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 {
#[inline(always)]
pub fn adcbiasprog(&mut self) -> AdcbiasprogW<'_, BIASPROGrs> {
AdcbiasprogW::new(self, 0)
}
#[inline(always)]
pub fn vfaultclr(&mut self) -> VfaultclrW<'_, BIASPROGrs> {
VfaultclrW::new(self, 12)
}
#[inline(always)]
pub fn gpbiasacc(&mut self) -> GpbiasaccW<'_, BIASPROGrs> {
GpbiasaccW::new(self, 16)
}
}
pub struct BIASPROGrs;
impl crate::RegisterSpec for BIASPROGrs {
type Ux = u32;
}
impl crate::Readable for BIASPROGrs {}
impl crate::Writable for BIASPROGrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for BIASPROGrs {}