#[doc = "Register `ACMCFG` reader"]
pub type R = crate::R<AcmcfgSpec>;
#[doc = "Register `ACMCFG` writer"]
pub type W = crate::W<AcmcfgSpec>;
#[doc = "Field `NCOM` reader - COM Lines per Row"]
pub type NcomR = crate::FieldReader;
#[doc = "Field `NCOM` writer - COM Lines per Row"]
pub type NcomW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Field `NDIG` reader - Number of Digit"]
pub type NdigR = crate::FieldReader;
#[doc = "Field `NDIG` writer - Number of Digit"]
pub type NdigW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[doc = "Field `STEPS` reader - Scrolling Steps"]
pub type StepsR = crate::FieldReader;
#[doc = "Field `STEPS` writer - Scrolling Steps"]
pub type StepsW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
#[doc = "Field `NDROW` reader - Number of Digit per Row"]
pub type NdrowR = crate::FieldReader;
#[doc = "Field `NDROW` writer - Number of Digit per Row"]
pub type NdrowW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
#[doc = "Mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Modeselect {
    #[doc = "0: Sequential Display Mode"]
    Seq = 0,
    #[doc = "1: Scrolling Display Mode"]
    Scroll = 1,
}
impl From<Modeselect> for bool {
    #[inline(always)]
    fn from(variant: Modeselect) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MODE` reader - 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::Seq,
            true => Modeselect::Scroll,
        }
    }
    #[doc = "Sequential Display Mode"]
    #[inline(always)]
    pub fn is_seq(&self) -> bool {
        *self == Modeselect::Seq
    }
    #[doc = "Scrolling Display Mode"]
    #[inline(always)]
    pub fn is_scroll(&self) -> bool {
        *self == Modeselect::Scroll
    }
}
#[doc = "Field `MODE` writer - Mode"]
pub type ModeW<'a, REG> = crate::BitWriter<'a, REG, Modeselect>;
impl<'a, REG> ModeW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Sequential Display Mode"]
    #[inline(always)]
    pub fn seq(self) -> &'a mut crate::W<REG> {
        self.variant(Modeselect::Seq)
    }
    #[doc = "Scrolling Display Mode"]
    #[inline(always)]
    pub fn scroll(self) -> &'a mut crate::W<REG> {
        self.variant(Modeselect::Scroll)
    }
}
#[doc = "Field `STSEG` reader - Start SEG Line"]
pub type StsegR = crate::FieldReader;
#[doc = "Field `STSEG` writer - Start SEG Line"]
pub type StsegW<'a, REG> = crate::FieldWriter<'a, REG, 6>;
#[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)
    }
}
impl R {
    #[doc = "Bits 0:2 - COM Lines per Row"]
    #[inline(always)]
    pub fn ncom(&self) -> NcomR {
        NcomR::new((self.bits & 7) as u8)
    }
    #[doc = "Bits 4:7 - Number of Digit"]
    #[inline(always)]
    pub fn ndig(&self) -> NdigR {
        NdigR::new(((self.bits >> 4) & 0x0f) as u8)
    }
    #[doc = "Bits 8:15 - Scrolling Steps"]
    #[inline(always)]
    pub fn steps(&self) -> StepsR {
        StepsR::new(((self.bits >> 8) & 0xff) as u8)
    }
    #[doc = "Bits 16:21 - Number of Digit per Row"]
    #[inline(always)]
    pub fn ndrow(&self) -> NdrowR {
        NdrowR::new(((self.bits >> 16) & 0x3f) as u8)
    }
    #[doc = "Bit 23 - Mode"]
    #[inline(always)]
    pub fn mode(&self) -> ModeR {
        ModeR::new(((self.bits >> 23) & 1) != 0)
    }
    #[doc = "Bits 24:29 - Start SEG Line"]
    #[inline(always)]
    pub fn stseg(&self) -> StsegR {
        StsegR::new(((self.bits >> 24) & 0x3f) as u8)
    }
    #[doc = "Bits 30:31 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&self) -> FcsR {
        FcsR::new(((self.bits >> 30) & 3) as u8)
    }
}
impl W {
    #[doc = "Bits 0:2 - COM Lines per Row"]
    #[inline(always)]
    pub fn ncom(&mut self) -> NcomW<AcmcfgSpec> {
        NcomW::new(self, 0)
    }
    #[doc = "Bits 4:7 - Number of Digit"]
    #[inline(always)]
    pub fn ndig(&mut self) -> NdigW<AcmcfgSpec> {
        NdigW::new(self, 4)
    }
    #[doc = "Bits 8:15 - Scrolling Steps"]
    #[inline(always)]
    pub fn steps(&mut self) -> StepsW<AcmcfgSpec> {
        StepsW::new(self, 8)
    }
    #[doc = "Bits 16:21 - Number of Digit per Row"]
    #[inline(always)]
    pub fn ndrow(&mut self) -> NdrowW<AcmcfgSpec> {
        NdrowW::new(self, 16)
    }
    #[doc = "Bit 23 - Mode"]
    #[inline(always)]
    pub fn mode(&mut self) -> ModeW<AcmcfgSpec> {
        ModeW::new(self, 23)
    }
    #[doc = "Bits 24:29 - Start SEG Line"]
    #[inline(always)]
    pub fn stseg(&mut self) -> StsegW<AcmcfgSpec> {
        StsegW::new(self, 24)
    }
    #[doc = "Bits 30:31 - Frame Counter Selection"]
    #[inline(always)]
    pub fn fcs(&mut self) -> FcsW<AcmcfgSpec> {
        FcsW::new(self, 30)
    }
}
#[doc = "Automated Character Mapping Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`acmcfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`acmcfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct AcmcfgSpec;
impl crate::RegisterSpec for AcmcfgSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`acmcfg::R`](R) reader structure"]
impl crate::Readable for AcmcfgSpec {}
#[doc = "`write(|w| ..)` method takes [`acmcfg::W`](W) writer structure"]
impl crate::Writable for AcmcfgSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets ACMCFG to value 0"]
impl crate::Resettable for AcmcfgSpec {
    const RESET_VALUE: u32 = 0;
}
