#[doc = "Register `BCFG` reader"]
pub type R = crate::R<BcfgSpec>;
#[doc = "Register `BCFG` writer"]
pub type W = crate::W<BcfgSpec>;
#[doc = "Blinking Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Modeselect {
    #[doc = "0: Blink all segments"]
    Blinkall = 0,
    #[doc = "1: Blink selected segments"]
    Blinksel = 1,
}
impl From<Modeselect> for bool {
    #[inline(always)]
    fn from(variant: Modeselect) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MODE` reader - Blinking Mode"]
pub type ModeR = crate::BitReader<Modeselect>;
impl ModeR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Modeselect {
        match self.bits {
            false => Modeselect::Blinkall,
            true => Modeselect::Blinksel,
        }
    }
    #[doc = "Blink all segments"]
    #[inline(always)]
    pub fn is_blinkall(&self) -> bool {
        *self == Modeselect::Blinkall
    }
    #[doc = "Blink selected segments"]
    #[inline(always)]
    pub fn is_blinksel(&self) -> bool {
        *self == Modeselect::Blinksel
    }
}
#[doc = "Field `MODE` writer - Blinking Mode"]
pub type ModeW<'a, REG> = crate::BitWriter<'a, REG, Modeselect>;
impl<'a, REG> ModeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Blink all segments"]
    #[inline(always)]
    pub fn blinkall(self) -> &'a mut crate::W<REG> {
        self.variant(Modeselect::Blinkall)
    }
    #[doc = "Blink selected segments"]
    #[inline(always)]
    pub fn blinksel(self) -> &'a mut crate::W<REG> {
        self.variant(Modeselect::Blinksel)
    }
}
#[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 `BSS0` reader - Blink Segment Selection 0"]
pub type Bss0R = crate::FieldReader;
#[doc = "Field `BSS0` writer - Blink Segment Selection 0"]
pub type Bss0W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[doc = "Field `BSS1` reader - Blink Segment Selection 1"]
pub type Bss1R = crate::FieldReader;
#[doc = "Field `BSS1` writer - Blink Segment Selection 1"]
pub type Bss1W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
impl R {
    #[doc = "Bit 0 - Blinking Mode"]
    #[inline(always)]
    pub fn mode(&self) -> ModeR {
        ModeR::new((self.bits & 1) != 0)
    }
    #[doc = "Bits 1:2 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&self) -> FcsR {
        FcsR::new(((self.bits >> 1) & 3) as u8)
    }
    #[doc = "Bits 8:15 - Blink Segment Selection 0"]
    #[inline(always)]
    pub fn bss0(&self) -> Bss0R {
        Bss0R::new(((self.bits >> 8) & 0xff) as u8)
    }
    #[doc = "Bits 16:23 - Blink Segment Selection 1"]
    #[inline(always)]
    pub fn bss1(&self) -> Bss1R {
        Bss1R::new(((self.bits >> 16) & 0xff) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Blinking Mode"]
    #[inline(always)]
    pub fn mode(&mut self) -> ModeW<BcfgSpec> {
        ModeW::new(self, 0)
    }
    #[doc = "Bits 1:2 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&mut self) -> FcsW<BcfgSpec> {
        FcsW::new(self, 1)
    }
    #[doc = "Bits 8:15 - Blink Segment Selection 0"]
    #[inline(always)]
    pub fn bss0(&mut self) -> Bss0W<BcfgSpec> {
        Bss0W::new(self, 8)
    }
    #[doc = "Bits 16:23 - Blink Segment Selection 1"]
    #[inline(always)]
    pub fn bss1(&mut self) -> Bss1W<BcfgSpec> {
        Bss1W::new(self, 16)
    }
}
#[doc = "Blink Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`bcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct BcfgSpec;
impl crate::RegisterSpec for BcfgSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`bcfg::R`](R) reader structure"]
impl crate::Readable for BcfgSpec {}
#[doc = "`write(|w| ..)` method takes [`bcfg::W`](W) writer structure"]
impl crate::Writable for BcfgSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets BCFG to value 0"]
impl crate::Resettable for BcfgSpec {
    const RESET_VALUE: u32 = 0;
}
