#[doc = "Register `ABMCFG` reader"]
pub type R = crate::R<AbmcfgSpec>;
#[doc = "Register `ABMCFG` writer"]
pub type W = crate::W<AbmcfgSpec>;
#[doc = "Frame Counter Selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Fcsselect {
    #[doc = "0: Frame Counter 0"]
    Fc0 = 0,
    #[doc = "1: Frame Counter 1"]
    Fc1 = 1,
    #[doc = "2: Frame Counter 2"]
    Fc2 = 2,
}
impl From<Fcsselect> for u8 {
    #[inline(always)]
    fn from(variant: Fcsselect) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Fcsselect {
    type Ux = u8;
}
impl crate::IsEnum for Fcsselect {}
#[doc = "Field `FCS` reader - Frame Counter Selection"]
pub type FcsR = crate::FieldReader<Fcsselect>;
impl FcsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Fcsselect> {
        match self.bits {
            0 => Some(Fcsselect::Fc0),
            1 => Some(Fcsselect::Fc1),
            2 => Some(Fcsselect::Fc2),
            _ => None,
        }
    }
    #[doc = "Frame Counter 0"]
    #[inline(always)]
    pub fn is_fc0(&self) -> bool {
        *self == Fcsselect::Fc0
    }
    #[doc = "Frame Counter 1"]
    #[inline(always)]
    pub fn is_fc1(&self) -> bool {
        *self == Fcsselect::Fc1
    }
    #[doc = "Frame Counter 2"]
    #[inline(always)]
    pub fn is_fc2(&self) -> bool {
        *self == Fcsselect::Fc2
    }
}
#[doc = "Field `FCS` writer - Frame Counter Selection"]
pub type FcsW<'a, REG> = crate::FieldWriter<'a, REG, 2, Fcsselect>;
impl<'a, REG> FcsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Frame Counter 0"]
    #[inline(always)]
    pub fn fc0(self) -> &'a mut crate::W<REG> {
        self.variant(Fcsselect::Fc0)
    }
    #[doc = "Frame Counter 1"]
    #[inline(always)]
    pub fn fc1(self) -> &'a mut crate::W<REG> {
        self.variant(Fcsselect::Fc1)
    }
    #[doc = "Frame Counter 2"]
    #[inline(always)]
    pub fn fc2(self) -> &'a mut crate::W<REG> {
        self.variant(Fcsselect::Fc2)
    }
}
#[doc = "Field `SIZE` reader - Size"]
pub type SizeR = crate::FieldReader;
#[doc = "Field `SIZE` writer - Size"]
pub type SizeW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
impl R {
    #[doc = "Bits 0:1 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&self) -> FcsR {
        FcsR::new(self.bits & 3)
    }
    #[doc = "Bits 2:7 - Size"]
    #[inline(always)]
    pub fn size(&self) -> SizeR {
        SizeR::new((self.bits >> 2) & 0x3f)
    }
}
impl W {
    #[doc = "Bits 0:1 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&mut self) -> FcsW<AbmcfgSpec> {
        FcsW::new(self, 0)
    }
    #[doc = "Bits 2:7 - Size"]
    #[inline(always)]
    pub fn size(&mut self) -> SizeW<AbmcfgSpec> {
        SizeW::new(self, 2)
    }
}
#[doc = "Automated Bit Mapping Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`abmcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`abmcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct AbmcfgSpec;
impl crate::RegisterSpec for AbmcfgSpec {
    type Ux = u8;
}
#[doc = "`read()` method returns [`abmcfg::R`](R) reader structure"]
impl crate::Readable for AbmcfgSpec {}
#[doc = "`write(|w| ..)` method takes [`abmcfg::W`](W) writer structure"]
impl crate::Writable for AbmcfgSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
}
#[doc = "`reset()` method sets ABMCFG to value 0"]
impl crate::Resettable for AbmcfgSpec {
    const RESET_VALUE: u8 = 0;
}
