#[doc = "Register `CFG4` reader"]
pub struct R(crate::R<CFG4_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CFG4_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CFG4_SPEC>> for R {
    fn from(reader: crate::R<CFG4_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CFG4` writer"]
pub struct W(crate::W<CFG4_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CFG4_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<CFG4_SPEC>> for W {
    fn from(writer: crate::W<CFG4_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Enable the selected reset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RES_IN_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<RES_IN_EN_A> for bool {
    #[inline(always)]
    fn from(variant: RES_IN_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RES_IN_EN` reader - Enable the selected reset"]
pub struct RES_IN_EN_R(crate::FieldReader<bool, RES_IN_EN_A>);
impl RES_IN_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        RES_IN_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_IN_EN_A {
        match self.bits {
            false => RES_IN_EN_A::DISABLE,
            true => RES_IN_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == RES_IN_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == RES_IN_EN_A::ENABLE
    }
}
impl core::ops::Deref for RES_IN_EN_R {
    type Target = crate::FieldReader<bool, RES_IN_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_IN_EN` writer - Enable the selected reset"]
pub struct RES_IN_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_IN_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_IN_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(RES_IN_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(RES_IN_EN_A::ENABLE)
    }
    #[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) | (value as u8 & 0x01);
        self.w
    }
}
#[doc = "Enable the selected reset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RES_OUT_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<RES_OUT_EN_A> for bool {
    #[inline(always)]
    fn from(variant: RES_OUT_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RES_OUT_EN` reader - Enable the selected reset"]
pub struct RES_OUT_EN_R(crate::FieldReader<bool, RES_OUT_EN_A>);
impl RES_OUT_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        RES_OUT_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_OUT_EN_A {
        match self.bits {
            false => RES_OUT_EN_A::DISABLE,
            true => RES_OUT_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == RES_OUT_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == RES_OUT_EN_A::ENABLE
    }
}
impl core::ops::Deref for RES_OUT_EN_R {
    type Target = crate::FieldReader<bool, RES_OUT_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_OUT_EN` writer - Enable the selected reset"]
pub struct RES_OUT_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_OUT_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_OUT_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(RES_OUT_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(RES_OUT_EN_A::ENABLE)
    }
    #[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 << 1)) | ((value as u8 & 0x01) << 1);
        self.w
    }
}
#[doc = "Enable the selected reset\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RES_OE_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<RES_OE_EN_A> for bool {
    #[inline(always)]
    fn from(variant: RES_OE_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RES_OE_EN` reader - Enable the selected reset"]
pub struct RES_OE_EN_R(crate::FieldReader<bool, RES_OE_EN_A>);
impl RES_OE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        RES_OE_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RES_OE_EN_A {
        match self.bits {
            false => RES_OE_EN_A::DISABLE,
            true => RES_OE_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == RES_OE_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == RES_OE_EN_A::ENABLE
    }
}
impl core::ops::Deref for RES_OE_EN_R {
    type Target = crate::FieldReader<bool, RES_OE_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RES_OE_EN` writer - Enable the selected reset"]
pub struct RES_OE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> RES_OE_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RES_OE_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(RES_OE_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(RES_OE_EN_A::ENABLE)
    }
    #[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 `NC7654` reader - Spare register bits"]
pub struct NC7654_R(crate::FieldReader<u8, u8>);
impl NC7654_R {
    pub(crate) fn new(bits: u8) -> Self {
        NC7654_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for NC7654_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `NC7654` writer - Spare register bits"]
pub struct NC7654_W<'a> {
    w: &'a mut W,
}
impl<'a> NC7654_W<'a> {
    #[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 & !(0x1f << 3)) | ((value as u8 & 0x1f) << 3);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_in_en(&self) -> RES_IN_EN_R {
        RES_IN_EN_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_out_en(&self) -> RES_OUT_EN_R {
        RES_OUT_EN_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_oe_en(&self) -> RES_OE_EN_R {
        RES_OE_EN_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bits 3:7 - Spare register bits"]
    #[inline(always)]
    pub fn nc7654(&self) -> NC7654_R {
        NC7654_R::new(((self.bits >> 3) & 0x1f) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_in_en(&mut self) -> RES_IN_EN_W {
        RES_IN_EN_W { w: self }
    }
    #[doc = "Bit 1 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_out_en(&mut self) -> RES_OUT_EN_W {
        RES_OUT_EN_W { w: self }
    }
    #[doc = "Bit 2 - Enable the selected reset"]
    #[inline(always)]
    pub fn res_oe_en(&mut self) -> RES_OE_EN_W {
        RES_OE_EN_W { w: self }
    }
    #[doc = "Bits 3:7 - Spare register bits"]
    #[inline(always)]
    pub fn nc7654(&mut self) -> NC7654_W {
        NC7654_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 Enable 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 [cfg4](index.html) module"]
pub struct CFG4_SPEC;
impl crate::RegisterSpec for CFG4_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [cfg4::R](R) reader structure"]
impl crate::Readable for CFG4_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [cfg4::W](W) writer structure"]
impl crate::Writable for CFG4_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CFG4 to value 0"]
impl crate::Resettable for CFG4_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
