#[doc = "Register `CFG2` reader"]
pub struct R(crate::R<CFG2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CFG2_SPEC>> for R {
    fn from(reader: crate::R<CFG2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG2` writer"]
pub struct W(crate::W<CFG2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<CFG2_SPEC>> for W {
    fn from(writer: crate::W<CFG2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Select one of four choices for clock enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLKIN_SEL_A {
    #[doc = "0: No description available"]
    GCLK0 = 0,
    #[doc = "1: No description available"]
    GCLK1 = 1,
    #[doc = "2: No description available"]
    GCLK2 = 2,
    #[doc = "3: No description available"]
    GCLK3 = 3,
    #[doc = "4: No description available"]
    GCLK4 = 4,
    #[doc = "5: No description available"]
    GCLK5 = 5,
    #[doc = "6: No description available"]
    GCLK6 = 6,
    #[doc = "7: No description available"]
    GCLK7 = 7,
    #[doc = "9: No description available"]
    BUS_CLK_APP = 9,
    #[doc = "12: No description available"]
    PIN_RC = 12,
    #[doc = "13: No description available"]
    DSI_RC_0 = 13,
    #[doc = "14: No description available"]
    DSI_RC_1 = 14,
    #[doc = "15: No description available"]
    DSI_RC_2 = 15,
}
impl From<CLKIN_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: CLKIN_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLKIN_SEL` reader - Select one of four choices for clock enable"]
pub struct CLKIN_SEL_R(crate::FieldReader<u8, CLKIN_SEL_A>);
impl CLKIN_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLKIN_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<CLKIN_SEL_A> {
        match self.bits {
            0 => Some(CLKIN_SEL_A::GCLK0),
            1 => Some(CLKIN_SEL_A::GCLK1),
            2 => Some(CLKIN_SEL_A::GCLK2),
            3 => Some(CLKIN_SEL_A::GCLK3),
            4 => Some(CLKIN_SEL_A::GCLK4),
            5 => Some(CLKIN_SEL_A::GCLK5),
            6 => Some(CLKIN_SEL_A::GCLK6),
            7 => Some(CLKIN_SEL_A::GCLK7),
            9 => Some(CLKIN_SEL_A::BUS_CLK_APP),
            12 => Some(CLKIN_SEL_A::PIN_RC),
            13 => Some(CLKIN_SEL_A::DSI_RC_0),
            14 => Some(CLKIN_SEL_A::DSI_RC_1),
            15 => Some(CLKIN_SEL_A::DSI_RC_2),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `GCLK0`"]
    #[inline(always)]
    pub fn is_gclk0(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK0
    }
    #[doc = "Checks if the value of the field is `GCLK1`"]
    #[inline(always)]
    pub fn is_gclk1(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK1
    }
    #[doc = "Checks if the value of the field is `GCLK2`"]
    #[inline(always)]
    pub fn is_gclk2(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK2
    }
    #[doc = "Checks if the value of the field is `GCLK3`"]
    #[inline(always)]
    pub fn is_gclk3(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK3
    }
    #[doc = "Checks if the value of the field is `GCLK4`"]
    #[inline(always)]
    pub fn is_gclk4(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK4
    }
    #[doc = "Checks if the value of the field is `GCLK5`"]
    #[inline(always)]
    pub fn is_gclk5(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK5
    }
    #[doc = "Checks if the value of the field is `GCLK6`"]
    #[inline(always)]
    pub fn is_gclk6(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK6
    }
    #[doc = "Checks if the value of the field is `GCLK7`"]
    #[inline(always)]
    pub fn is_gclk7(&self) -> bool {
        **self == CLKIN_SEL_A::GCLK7
    }
    #[doc = "Checks if the value of the field is `BUS_CLK_APP`"]
    #[inline(always)]
    pub fn is_bus_clk_app(&self) -> bool {
        **self == CLKIN_SEL_A::BUS_CLK_APP
    }
    #[doc = "Checks if the value of the field is `PIN_RC`"]
    #[inline(always)]
    pub fn is_pin_rc(&self) -> bool {
        **self == CLKIN_SEL_A::PIN_RC
    }
    #[doc = "Checks if the value of the field is `DSI_RC_0`"]
    #[inline(always)]
    pub fn is_dsi_rc_0(&self) -> bool {
        **self == CLKIN_SEL_A::DSI_RC_0
    }
    #[doc = "Checks if the value of the field is `DSI_RC_1`"]
    #[inline(always)]
    pub fn is_dsi_rc_1(&self) -> bool {
        **self == CLKIN_SEL_A::DSI_RC_1
    }
    #[doc = "Checks if the value of the field is `DSI_RC_2`"]
    #[inline(always)]
    pub fn is_dsi_rc_2(&self) -> bool {
        **self == CLKIN_SEL_A::DSI_RC_2
    }
}
impl core::ops::Deref for CLKIN_SEL_R {
    type Target = crate::FieldReader<u8, CLKIN_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLKIN_SEL` writer - Select one of four choices for clock enable"]
pub struct CLKIN_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> CLKIN_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLKIN_SEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk0(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk1(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk2(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk3(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK3)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk4(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK4)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk5(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK5)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk6(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK6)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk7(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::GCLK7)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn bus_clk_app(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::BUS_CLK_APP)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn pin_rc(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::PIN_RC)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_0(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::DSI_RC_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_1(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::DSI_RC_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_2(self) -> &'a mut W {
        self.variant(CLKIN_SEL_A::DSI_RC_2)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x0f) | (value as u8 & 0x0f);
        self.w
    }
}
#[doc = "Select one of four choices for clock enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLKOUT_SEL_A {
    #[doc = "0: No description available"]
    GCLK0 = 0,
    #[doc = "1: No description available"]
    GCLK1 = 1,
    #[doc = "2: No description available"]
    GCLK2 = 2,
    #[doc = "3: No description available"]
    GCLK3 = 3,
    #[doc = "4: No description available"]
    GCLK4 = 4,
    #[doc = "5: No description available"]
    GCLK5 = 5,
    #[doc = "6: No description available"]
    GCLK6 = 6,
    #[doc = "7: No description available"]
    GCLK7 = 7,
    #[doc = "9: No description available"]
    BUS_CLK_APP = 9,
    #[doc = "12: No description available"]
    PIN_RC = 12,
    #[doc = "13: No description available"]
    DSI_RC_0 = 13,
    #[doc = "14: No description available"]
    DSI_RC_1 = 14,
    #[doc = "15: No description available"]
    DSI_RC_2 = 15,
}
impl From<CLKOUT_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: CLKOUT_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLKOUT_SEL` reader - Select one of four choices for clock enable"]
pub struct CLKOUT_SEL_R(crate::FieldReader<u8, CLKOUT_SEL_A>);
impl CLKOUT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLKOUT_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<CLKOUT_SEL_A> {
        match self.bits {
            0 => Some(CLKOUT_SEL_A::GCLK0),
            1 => Some(CLKOUT_SEL_A::GCLK1),
            2 => Some(CLKOUT_SEL_A::GCLK2),
            3 => Some(CLKOUT_SEL_A::GCLK3),
            4 => Some(CLKOUT_SEL_A::GCLK4),
            5 => Some(CLKOUT_SEL_A::GCLK5),
            6 => Some(CLKOUT_SEL_A::GCLK6),
            7 => Some(CLKOUT_SEL_A::GCLK7),
            9 => Some(CLKOUT_SEL_A::BUS_CLK_APP),
            12 => Some(CLKOUT_SEL_A::PIN_RC),
            13 => Some(CLKOUT_SEL_A::DSI_RC_0),
            14 => Some(CLKOUT_SEL_A::DSI_RC_1),
            15 => Some(CLKOUT_SEL_A::DSI_RC_2),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `GCLK0`"]
    #[inline(always)]
    pub fn is_gclk0(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK0
    }
    #[doc = "Checks if the value of the field is `GCLK1`"]
    #[inline(always)]
    pub fn is_gclk1(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK1
    }
    #[doc = "Checks if the value of the field is `GCLK2`"]
    #[inline(always)]
    pub fn is_gclk2(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK2
    }
    #[doc = "Checks if the value of the field is `GCLK3`"]
    #[inline(always)]
    pub fn is_gclk3(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK3
    }
    #[doc = "Checks if the value of the field is `GCLK4`"]
    #[inline(always)]
    pub fn is_gclk4(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK4
    }
    #[doc = "Checks if the value of the field is `GCLK5`"]
    #[inline(always)]
    pub fn is_gclk5(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK5
    }
    #[doc = "Checks if the value of the field is `GCLK6`"]
    #[inline(always)]
    pub fn is_gclk6(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK6
    }
    #[doc = "Checks if the value of the field is `GCLK7`"]
    #[inline(always)]
    pub fn is_gclk7(&self) -> bool {
        **self == CLKOUT_SEL_A::GCLK7
    }
    #[doc = "Checks if the value of the field is `BUS_CLK_APP`"]
    #[inline(always)]
    pub fn is_bus_clk_app(&self) -> bool {
        **self == CLKOUT_SEL_A::BUS_CLK_APP
    }
    #[doc = "Checks if the value of the field is `PIN_RC`"]
    #[inline(always)]
    pub fn is_pin_rc(&self) -> bool {
        **self == CLKOUT_SEL_A::PIN_RC
    }
    #[doc = "Checks if the value of the field is `DSI_RC_0`"]
    #[inline(always)]
    pub fn is_dsi_rc_0(&self) -> bool {
        **self == CLKOUT_SEL_A::DSI_RC_0
    }
    #[doc = "Checks if the value of the field is `DSI_RC_1`"]
    #[inline(always)]
    pub fn is_dsi_rc_1(&self) -> bool {
        **self == CLKOUT_SEL_A::DSI_RC_1
    }
    #[doc = "Checks if the value of the field is `DSI_RC_2`"]
    #[inline(always)]
    pub fn is_dsi_rc_2(&self) -> bool {
        **self == CLKOUT_SEL_A::DSI_RC_2
    }
}
impl core::ops::Deref for CLKOUT_SEL_R {
    type Target = crate::FieldReader<u8, CLKOUT_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLKOUT_SEL` writer - Select one of four choices for clock enable"]
pub struct CLKOUT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> CLKOUT_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLKOUT_SEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk0(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk1(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk2(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk3(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK3)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk4(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK4)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk5(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK5)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk6(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK6)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gclk7(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::GCLK7)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn bus_clk_app(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::BUS_CLK_APP)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn pin_rc(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::PIN_RC)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_0(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::DSI_RC_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_1(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::DSI_RC_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_2(self) -> &'a mut W {
        self.variant(CLKOUT_SEL_A::DSI_RC_2)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x0f << 4)) | ((value as u8 & 0x0f) << 4);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:3 - Select one of four choices for clock enable"]
    #[inline(always)]
    pub fn clkin_sel(&self) -> CLKIN_SEL_R {
        CLKIN_SEL_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 4:7 - Select one of four choices for clock enable"]
    #[inline(always)]
    pub fn clkout_sel(&self) -> CLKOUT_SEL_R {
        CLKOUT_SEL_R::new(((self.bits >> 4) & 0x0f) as u8)
    }
}
impl W {
    #[doc = "Bits 0:3 - Select one of four choices for clock enable"]
    #[inline(always)]
    pub fn clkin_sel(&mut self) -> CLKIN_SEL_W {
        CLKIN_SEL_W { w: self }
    }
    #[doc = "Bits 4:7 - Select one of four choices for clock enable"]
    #[inline(always)]
    pub fn clkout_sel(&mut self) -> CLKOUT_SEL_W {
        CLKOUT_SEL_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "PA Clock Select Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cfg2](index.html) module"]
pub struct CFG2_SPEC;
impl crate::RegisterSpec for CFG2_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [cfg2::R](R) reader structure"]
impl crate::Readable for CFG2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg2::W](W) writer structure"]
impl crate::Writable for CFG2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CFG2 to value 0"]
impl crate::Resettable for CFG2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
