#[doc = "Register `CTRLC` reader"]
pub type R = crate::R<CtrlcSpec>;
#[doc = "Register `CTRLC` writer"]
pub type W = crate::W<CtrlcSpec>;
#[doc = "Field `CLEAR` reader - Clear Display Memory"]
pub type ClearR = crate::BitReader;
#[doc = "Field `CLEAR` writer - Clear Display Memory"]
pub type ClearW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `LOCK` reader - Lock Shadow Memory"]
pub type LockR = crate::BitReader;
#[doc = "Field `LOCK` writer - Lock Shadow Memory"]
pub type LockW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `ABMEN` reader - Automated Bit Mapping Enable"]
pub type AbmenR = crate::BitReader;
#[doc = "Field `ABMEN` writer - Automated Bit Mapping Enable"]
pub type AbmenW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `ACMEN` reader - Automated Character Mapping Enable"]
pub type AcmenR = crate::BitReader;
#[doc = "Field `ACMEN` writer - Automated Character Mapping Enable"]
pub type AcmenW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `CTST` reader - Contrast Adjustment"]
pub type CtstR = crate::FieldReader;
#[doc = "Field `CTST` writer - Contrast Adjustment"]
pub type CtstW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
#[doc = "LCD Power Macro Power mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Lppmselect {
    #[doc = "0: LCD power automatically select regualation mode or pump mode"]
    Auto = 0,
    #[doc = "1: LCD power use step-up pump loop only"]
    Stepup = 1,
    #[doc = "2: LCD power use step-down drop-out regulation loop only"]
    Stepdown = 2,
}
impl From<Lppmselect> for u8 {
    #[inline(always)]
    fn from(variant: Lppmselect) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Lppmselect {
    type Ux = u8;
}
impl crate::IsEnum for Lppmselect {}
#[doc = "Field `LPPM` reader - LCD Power Macro Power mode"]
pub type LppmR = crate::FieldReader<Lppmselect>;
impl LppmR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Lppmselect> {
        match self.bits {
            0 => Some(Lppmselect::Auto),
            1 => Some(Lppmselect::Stepup),
            2 => Some(Lppmselect::Stepdown),
            _ => None,
        }
    }
    #[doc = "LCD power automatically select regualation mode or pump mode"]
    #[inline(always)]
    pub fn is_auto(&self) -> bool {
        *self == Lppmselect::Auto
    }
    #[doc = "LCD power use step-up pump loop only"]
    #[inline(always)]
    pub fn is_stepup(&self) -> bool {
        *self == Lppmselect::Stepup
    }
    #[doc = "LCD power use step-down drop-out regulation loop only"]
    #[inline(always)]
    pub fn is_stepdown(&self) -> bool {
        *self == Lppmselect::Stepdown
    }
}
#[doc = "Field `LPPM` writer - LCD Power Macro Power mode"]
pub type LppmW<'a, REG> = crate::FieldWriter<'a, REG, 2, Lppmselect>;
impl<'a, REG> LppmW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "LCD power automatically select regualation mode or pump mode"]
    #[inline(always)]
    pub fn auto(self) -> &'a mut crate::W<REG> {
        self.variant(Lppmselect::Auto)
    }
    #[doc = "LCD power use step-up pump loop only"]
    #[inline(always)]
    pub fn stepup(self) -> &'a mut crate::W<REG> {
        self.variant(Lppmselect::Stepup)
    }
    #[doc = "LCD power use step-down drop-out regulation loop only"]
    #[inline(always)]
    pub fn stepdown(self) -> &'a mut crate::W<REG> {
        self.variant(Lppmselect::Stepdown)
    }
}
impl R {
    #[doc = "Bit 0 - Clear Display Memory"]
    #[inline(always)]
    pub fn clear(&self) -> ClearR {
        ClearR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Lock Shadow Memory"]
    #[inline(always)]
    pub fn lock(&self) -> LockR {
        LockR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 2 - Automated Bit Mapping Enable"]
    #[inline(always)]
    pub fn abmen(&self) -> AbmenR {
        AbmenR::new(((self.bits >> 2) & 1) != 0)
    }
    #[doc = "Bit 3 - Automated Character Mapping Enable"]
    #[inline(always)]
    pub fn acmen(&self) -> AcmenR {
        AcmenR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bits 4:7 - Contrast Adjustment"]
    #[inline(always)]
    pub fn ctst(&self) -> CtstR {
        CtstR::new(((self.bits >> 4) & 0x0f) as u8)
    }
    #[doc = "Bits 8:9 - LCD Power Macro Power mode"]
    #[inline(always)]
    pub fn lppm(&self) -> LppmR {
        LppmR::new(((self.bits >> 8) & 3) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Clear Display Memory"]
    #[inline(always)]
    pub fn clear(&mut self) -> ClearW<CtrlcSpec> {
        ClearW::new(self, 0)
    }
    #[doc = "Bit 1 - Lock Shadow Memory"]
    #[inline(always)]
    pub fn lock(&mut self) -> LockW<CtrlcSpec> {
        LockW::new(self, 1)
    }
    #[doc = "Bit 2 - Automated Bit Mapping Enable"]
    #[inline(always)]
    pub fn abmen(&mut self) -> AbmenW<CtrlcSpec> {
        AbmenW::new(self, 2)
    }
    #[doc = "Bit 3 - Automated Character Mapping Enable"]
    #[inline(always)]
    pub fn acmen(&mut self) -> AcmenW<CtrlcSpec> {
        AcmenW::new(self, 3)
    }
    #[doc = "Bits 4:7 - Contrast Adjustment"]
    #[inline(always)]
    pub fn ctst(&mut self) -> CtstW<CtrlcSpec> {
        CtstW::new(self, 4)
    }
    #[doc = "Bits 8:9 - LCD Power Macro Power mode"]
    #[inline(always)]
    pub fn lppm(&mut self) -> LppmW<CtrlcSpec> {
        LppmW::new(self, 8)
    }
}
#[doc = "Control C\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrlc::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrlc::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CtrlcSpec;
impl crate::RegisterSpec for CtrlcSpec {
    type Ux = u16;
}
#[doc = "`read()` method returns [`ctrlc::R`](R) reader structure"]
impl crate::Readable for CtrlcSpec {}
#[doc = "`write(|w| ..)` method takes [`ctrlc::W`](W) writer structure"]
impl crate::Writable for CtrlcSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
}
#[doc = "`reset()` method sets CTRLC to value 0"]
impl crate::Resettable for CtrlcSpec {
    const RESET_VALUE: u16 = 0;
}
