#[doc = "Register `CFG3` reader"]
pub struct R(crate::R<CFG3_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG3_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CFG3_SPEC>> for R {
    fn from(reader: crate::R<CFG3_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG3` writer"]
pub struct W(crate::W<CFG3_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG3_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<CFG3_SPEC>> for W {
    fn from(writer: crate::W<CFG3_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Select one of four inputs to serve as the reset control to the block.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum RES_IN_SEL_A {
    #[doc = "0: No description available"]
    PIN_RC = 0,
    #[doc = "1: No description available"]
    DSI_RC_0 = 1,
    #[doc = "2: No description available"]
    DSI_RC_1 = 2,
    #[doc = "3: No description available"]
    DSI_RC_2 = 3,
}
impl From<RES_IN_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: RES_IN_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `RES_IN_SEL` reader - Select one of four inputs to serve as the reset control to the block."]
pub struct RES_IN_SEL_R(crate::FieldReader<u8, RES_IN_SEL_A>);
impl RES_IN_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        RES_IN_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_IN_SEL_A {
        match self.bits {
            0 => RES_IN_SEL_A::PIN_RC,
            1 => RES_IN_SEL_A::DSI_RC_0,
            2 => RES_IN_SEL_A::DSI_RC_1,
            3 => RES_IN_SEL_A::DSI_RC_2,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `PIN_RC`"]
    #[inline(always)]
    pub fn is_pin_rc(&self) -> bool {
        **self == RES_IN_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 == RES_IN_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 == RES_IN_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 == RES_IN_SEL_A::DSI_RC_2
    }
}
impl core::ops::Deref for RES_IN_SEL_R {
    type Target = crate::FieldReader<u8, RES_IN_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_IN_SEL` writer - Select one of four inputs to serve as the reset control to the block."]
pub struct RES_IN_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_IN_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_IN_SEL_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn pin_rc(self) -> &'a mut W {
        self.variant(RES_IN_SEL_A::PIN_RC)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_0(self) -> &'a mut W {
        self.variant(RES_IN_SEL_A::DSI_RC_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_1(self) -> &'a mut W {
        self.variant(RES_IN_SEL_A::DSI_RC_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_2(self) -> &'a mut W {
        self.variant(RES_IN_SEL_A::DSI_RC_2)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x03) | (value as u8 & 0x03);
        self.w
    }
}
#[doc = "Select the polarity of the reset control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RES_IN_INV_A {
    #[doc = "0: No description available"]
    NOINV = 0,
    #[doc = "1: No description available"]
    INV = 1,
}
impl From<RES_IN_INV_A> for bool {
    #[inline(always)]
    fn from(variant: RES_IN_INV_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RES_IN_INV` reader - Select the polarity of the reset control."]
pub struct RES_IN_INV_R(crate::FieldReader<bool, RES_IN_INV_A>);
impl RES_IN_INV_R {
    pub(crate) fn new(bits: bool) -> Self {
        RES_IN_INV_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_IN_INV_A {
        match self.bits {
            false => RES_IN_INV_A::NOINV,
            true => RES_IN_INV_A::INV,
        }
    }
    #[doc = "Checks if the value of the field is `NOINV`"]
    #[inline(always)]
    pub fn is_noinv(&self) -> bool {
        **self == RES_IN_INV_A::NOINV
    }
    #[doc = "Checks if the value of the field is `INV`"]
    #[inline(always)]
    pub fn is_inv(&self) -> bool {
        **self == RES_IN_INV_A::INV
    }
}
impl core::ops::Deref for RES_IN_INV_R {
    type Target = crate::FieldReader<bool, RES_IN_INV_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_IN_INV` writer - Select the polarity of the reset control."]
pub struct RES_IN_INV_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_IN_INV_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_IN_INV_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn noinv(self) -> &'a mut W {
        self.variant(RES_IN_INV_A::NOINV)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn inv(self) -> &'a mut W {
        self.variant(RES_IN_INV_A::INV)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u8 & 0x01) << 2);
        self.w
    }
}
#[doc = "Field `NC0` reader - Spare register bit"]
pub struct NC0_R(crate::FieldReader<bool, bool>);
impl NC0_R {
    pub(crate) fn new(bits: bool) -> Self {
        NC0_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for NC0_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `NC0` writer - Spare register bit"]
pub struct NC0_W<'a> {
    w: &'a mut W,
}
impl<'a> NC0_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u8 & 0x01) << 3);
        self.w
    }
}
#[doc = "Select one of four inputs to serve as the reset control to the block.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum RES_OUT_SEL_A {
    #[doc = "0: No description available"]
    PIN_RC = 0,
    #[doc = "1: No description available"]
    DSI_RC_0 = 1,
    #[doc = "2: No description available"]
    DSI_RC_1 = 2,
    #[doc = "3: No description available"]
    DSI_RC_2 = 3,
}
impl From<RES_OUT_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: RES_OUT_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `RES_OUT_SEL` reader - Select one of four inputs to serve as the reset control to the block."]
pub struct RES_OUT_SEL_R(crate::FieldReader<u8, RES_OUT_SEL_A>);
impl RES_OUT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        RES_OUT_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_OUT_SEL_A {
        match self.bits {
            0 => RES_OUT_SEL_A::PIN_RC,
            1 => RES_OUT_SEL_A::DSI_RC_0,
            2 => RES_OUT_SEL_A::DSI_RC_1,
            3 => RES_OUT_SEL_A::DSI_RC_2,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `PIN_RC`"]
    #[inline(always)]
    pub fn is_pin_rc(&self) -> bool {
        **self == RES_OUT_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 == RES_OUT_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 == RES_OUT_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 == RES_OUT_SEL_A::DSI_RC_2
    }
}
impl core::ops::Deref for RES_OUT_SEL_R {
    type Target = crate::FieldReader<u8, RES_OUT_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_OUT_SEL` writer - Select one of four inputs to serve as the reset control to the block."]
pub struct RES_OUT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_OUT_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_OUT_SEL_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn pin_rc(self) -> &'a mut W {
        self.variant(RES_OUT_SEL_A::PIN_RC)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_0(self) -> &'a mut W {
        self.variant(RES_OUT_SEL_A::DSI_RC_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_1(self) -> &'a mut W {
        self.variant(RES_OUT_SEL_A::DSI_RC_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_rc_2(self) -> &'a mut W {
        self.variant(RES_OUT_SEL_A::DSI_RC_2)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u8 & 0x03) << 4);
        self.w
    }
}
#[doc = "Select the polarity of the reset control.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RES_OUT_INV_A {
    #[doc = "0: No description available"]
    NOINV = 0,
    #[doc = "1: No description available"]
    INV = 1,
}
impl From<RES_OUT_INV_A> for bool {
    #[inline(always)]
    fn from(variant: RES_OUT_INV_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RES_OUT_INV` reader - Select the polarity of the reset control."]
pub struct RES_OUT_INV_R(crate::FieldReader<bool, RES_OUT_INV_A>);
impl RES_OUT_INV_R {
    pub(crate) fn new(bits: bool) -> Self {
        RES_OUT_INV_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_OUT_INV_A {
        match self.bits {
            false => RES_OUT_INV_A::NOINV,
            true => RES_OUT_INV_A::INV,
        }
    }
    #[doc = "Checks if the value of the field is `NOINV`"]
    #[inline(always)]
    pub fn is_noinv(&self) -> bool {
        **self == RES_OUT_INV_A::NOINV
    }
    #[doc = "Checks if the value of the field is `INV`"]
    #[inline(always)]
    pub fn is_inv(&self) -> bool {
        **self == RES_OUT_INV_A::INV
    }
}
impl core::ops::Deref for RES_OUT_INV_R {
    type Target = crate::FieldReader<bool, RES_OUT_INV_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_OUT_INV` writer - Select the polarity of the reset control."]
pub struct RES_OUT_INV_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_OUT_INV_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_OUT_INV_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn noinv(self) -> &'a mut W {
        self.variant(RES_OUT_INV_A::NOINV)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn inv(self) -> &'a mut W {
        self.variant(RES_OUT_INV_A::INV)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u8 & 0x01) << 6);
        self.w
    }
}
#[doc = "Field `NC7` reader - Spare register bit"]
pub struct NC7_R(crate::FieldReader<bool, bool>);
impl NC7_R {
    pub(crate) fn new(bits: bool) -> Self {
        NC7_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for NC7_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `NC7` writer - Spare register bit"]
pub struct NC7_W<'a> {
    w: &'a mut W,
}
impl<'a> NC7_W<'a> {
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u8 & 0x01) << 7);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:1 - Select one of four inputs to serve as the reset control to the block."]
    #[inline(always)]
    pub fn res_in_sel(&self) -> RES_IN_SEL_R {
        RES_IN_SEL_R::new((self.bits & 0x03) as u8)
    }
    #[doc = "Bit 2 - Select the polarity of the reset control."]
    #[inline(always)]
    pub fn res_in_inv(&self) -> RES_IN_INV_R {
        RES_IN_INV_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - Spare register bit"]
    #[inline(always)]
    pub fn nc0(&self) -> NC0_R {
        NC0_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bits 4:5 - Select one of four inputs to serve as the reset control to the block."]
    #[inline(always)]
    pub fn res_out_sel(&self) -> RES_OUT_SEL_R {
        RES_OUT_SEL_R::new(((self.bits >> 4) & 0x03) as u8)
    }
    #[doc = "Bit 6 - Select the polarity of the reset control."]
    #[inline(always)]
    pub fn res_out_inv(&self) -> RES_OUT_INV_R {
        RES_OUT_INV_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 7 - Spare register bit"]
    #[inline(always)]
    pub fn nc7(&self) -> NC7_R {
        NC7_R::new(((self.bits >> 7) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:1 - Select one of four inputs to serve as the reset control to the block."]
    #[inline(always)]
    pub fn res_in_sel(&mut self) -> RES_IN_SEL_W {
        RES_IN_SEL_W { w: self }
    }
    #[doc = "Bit 2 - Select the polarity of the reset control."]
    #[inline(always)]
    pub fn res_in_inv(&mut self) -> RES_IN_INV_W {
        RES_IN_INV_W { w: self }
    }
    #[doc = "Bit 3 - Spare register bit"]
    #[inline(always)]
    pub fn nc0(&mut self) -> NC0_W {
        NC0_W { w: self }
    }
    #[doc = "Bits 4:5 - Select one of four inputs to serve as the reset control to the block."]
    #[inline(always)]
    pub fn res_out_sel(&mut self) -> RES_OUT_SEL_W {
        RES_OUT_SEL_W { w: self }
    }
    #[doc = "Bit 6 - Select the polarity of the reset control."]
    #[inline(always)]
    pub fn res_out_inv(&mut self) -> RES_OUT_INV_W {
        RES_OUT_INV_W { w: self }
    }
    #[doc = "Bit 7 - Spare register bit"]
    #[inline(always)]
    pub fn nc7(&mut self) -> NC7_W {
        NC7_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 Reset 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 [cfg3](index.html) module"]
pub struct CFG3_SPEC;
impl crate::RegisterSpec for CFG3_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [cfg3::R](R) reader structure"]
impl crate::Readable for CFG3_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg3::W](W) writer structure"]
impl crate::Writable for CFG3_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CFG3 to value 0"]
impl crate::Resettable for CFG3_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
