#[doc = "Register `CTRLA` reader"]
pub type R = crate::R<CtrlaSpec>;
#[doc = "Register `CTRLA` writer"]
pub type W = crate::W<CtrlaSpec>;
#[doc = "Field `SWRST` reader - Software Reset"]
pub type SwrstR = crate::BitReader;
#[doc = "Field `SWRST` writer - Software Reset"]
pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `ENABLE` reader - Enable"]
pub type EnableR = crate::BitReader;
#[doc = "Field `ENABLE` writer - Enable"]
pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `AESMODE` reader - AES Modes of operation"]
pub type AesmodeR = crate::FieldReader;
#[doc = "Field `AESMODE` writer - AES Modes of operation"]
pub type AesmodeW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Field `CFBS` reader - CFB Types"]
pub type CfbsR = crate::FieldReader;
#[doc = "Field `CFBS` writer - CFB Types"]
pub type CfbsW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[doc = "Field `KEYSIZE` reader - Keysize"]
pub type KeysizeR = crate::FieldReader;
#[doc = "Field `KEYSIZE` writer - Keysize"]
pub type KeysizeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Field `CIPHER` reader - Cipher mode"]
pub type CipherR = crate::BitReader;
#[doc = "Field `CIPHER` writer - Cipher mode"]
pub type CipherW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `STARTMODE` reader - Start mode"]
pub type StartmodeR = crate::BitReader;
#[doc = "Field `STARTMODE` writer - Start mode"]
pub type StartmodeW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `LOD` reader - LOD Enable"]
pub type LodR = crate::BitReader;
#[doc = "Field `LOD` writer - LOD Enable"]
pub type LodW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `KEYGEN` reader - Last key generation"]
pub type KeygenR = crate::BitReader;
#[doc = "Field `KEYGEN` writer - Last key generation"]
pub type KeygenW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `XORKEY` reader - Xor Key operation"]
pub type XorkeyR = crate::BitReader;
#[doc = "Field `XORKEY` writer - Xor Key operation"]
pub type XorkeyW<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `CTYPE` reader - Counter measure types"]
pub type CtypeR = crate::FieldReader;
#[doc = "Field `CTYPE` writer - Counter measure types"]
pub type CtypeW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
impl R {
    #[doc = "Bit 0 - Software Reset"]
    #[inline(always)]
    pub fn swrst(&self) -> SwrstR {
        SwrstR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Enable"]
    #[inline(always)]
    pub fn enable(&self) -> EnableR {
        EnableR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bits 2:4 - AES Modes of operation"]
    #[inline(always)]
    pub fn aesmode(&self) -> AesmodeR {
        AesmodeR::new(((self.bits >> 2) & 7) as u8)
    }
    #[doc = "Bits 5:7 - CFB Types"]
    #[inline(always)]
    pub fn cfbs(&self) -> CfbsR {
        CfbsR::new(((self.bits >> 5) & 7) as u8)
    }
    #[doc = "Bits 8:9 - Keysize"]
    #[inline(always)]
    pub fn keysize(&self) -> KeysizeR {
        KeysizeR::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bit 10 - Cipher mode"]
    #[inline(always)]
    pub fn cipher(&self) -> CipherR {
        CipherR::new(((self.bits >> 10) & 1) != 0)
    }
    #[doc = "Bit 11 - Start mode"]
    #[inline(always)]
    pub fn startmode(&self) -> StartmodeR {
        StartmodeR::new(((self.bits >> 11) & 1) != 0)
    }
    #[doc = "Bit 12 - LOD Enable"]
    #[inline(always)]
    pub fn lod(&self) -> LodR {
        LodR::new(((self.bits >> 12) & 1) != 0)
    }
    #[doc = "Bit 13 - Last key generation"]
    #[inline(always)]
    pub fn keygen(&self) -> KeygenR {
        KeygenR::new(((self.bits >> 13) & 1) != 0)
    }
    #[doc = "Bit 14 - Xor Key operation"]
    #[inline(always)]
    pub fn xorkey(&self) -> XorkeyR {
        XorkeyR::new(((self.bits >> 14) & 1) != 0)
    }
    #[doc = "Bits 16:19 - Counter measure types"]
    #[inline(always)]
    pub fn ctype(&self) -> CtypeR {
        CtypeR::new(((self.bits >> 16) & 0x0f) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Software Reset"]
    #[inline(always)]
    pub fn swrst(&mut self) -> SwrstW<CtrlaSpec> {
        SwrstW::new(self, 0)
    }
    #[doc = "Bit 1 - Enable"]
    #[inline(always)]
    pub fn enable(&mut self) -> EnableW<CtrlaSpec> {
        EnableW::new(self, 1)
    }
    #[doc = "Bits 2:4 - AES Modes of operation"]
    #[inline(always)]
    pub fn aesmode(&mut self) -> AesmodeW<CtrlaSpec> {
        AesmodeW::new(self, 2)
    }
    #[doc = "Bits 5:7 - CFB Types"]
    #[inline(always)]
    pub fn cfbs(&mut self) -> CfbsW<CtrlaSpec> {
        CfbsW::new(self, 5)
    }
    #[doc = "Bits 8:9 - Keysize"]
    #[inline(always)]
    pub fn keysize(&mut self) -> KeysizeW<CtrlaSpec> {
        KeysizeW::new(self, 8)
    }
    #[doc = "Bit 10 - Cipher mode"]
    #[inline(always)]
    pub fn cipher(&mut self) -> CipherW<CtrlaSpec> {
        CipherW::new(self, 10)
    }
    #[doc = "Bit 11 - Start mode"]
    #[inline(always)]
    pub fn startmode(&mut self) -> StartmodeW<CtrlaSpec> {
        StartmodeW::new(self, 11)
    }
    #[doc = "Bit 12 - LOD Enable"]
    #[inline(always)]
    pub fn lod(&mut self) -> LodW<CtrlaSpec> {
        LodW::new(self, 12)
    }
    #[doc = "Bit 13 - Last key generation"]
    #[inline(always)]
    pub fn keygen(&mut self) -> KeygenW<CtrlaSpec> {
        KeygenW::new(self, 13)
    }
    #[doc = "Bit 14 - Xor Key operation"]
    #[inline(always)]
    pub fn xorkey(&mut self) -> XorkeyW<CtrlaSpec> {
        XorkeyW::new(self, 14)
    }
    #[doc = "Bits 16:19 - Counter measure types"]
    #[inline(always)]
    pub fn ctype(&mut self) -> CtypeW<CtrlaSpec> {
        CtypeW::new(self, 16)
    }
}
#[doc = "Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrla::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrla::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct CtrlaSpec;
impl crate::RegisterSpec for CtrlaSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
impl crate::Readable for CtrlaSpec {}
#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
impl crate::Writable for CtrlaSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets CTRLA to value 0"]
impl crate::Resettable for CtrlaSpec {
    const RESET_VALUE: u32 = 0;
}
