#[doc = "Register `BANK_CTL` reader"]
pub struct R(crate::R<BANK_CTL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<BANK_CTL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<BANK_CTL_SPEC>> for R {
    fn from(reader: crate::R<BANK_CTL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `BANK_CTL` writer"]
pub struct W(crate::W<BANK_CTL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<BANK_CTL_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<BANK_CTL_SPEC>> for W {
    fn from(writer: crate::W<BANK_CTL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Selection of Clear-On-Read\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DIS_COR_A {
    #[doc = "0: No description available"]
    NORMAL = 0,
    #[doc = "1: No description available"]
    DISABLE = 1,
}
impl From<DIS_COR_A> for bool {
    #[inline(always)]
    fn from(variant: DIS_COR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DIS_COR` reader - Selection of Clear-On-Read"]
pub struct DIS_COR_R(crate::FieldReader<bool, DIS_COR_A>);
impl DIS_COR_R {
    pub(crate) fn new(bits: bool) -> Self {
        DIS_COR_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DIS_COR_A {
        match self.bits {
            false => DIS_COR_A::NORMAL,
            true => DIS_COR_A::DISABLE,
        }
    }
    #[doc = "Checks if the value of the field is `NORMAL`"]
    #[inline(always)]
    pub fn is_normal(&self) -> bool {
        **self == DIS_COR_A::NORMAL
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == DIS_COR_A::DISABLE
    }
}
impl core::ops::Deref for DIS_COR_R {
    type Target = crate::FieldReader<bool, DIS_COR_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DIS_COR` writer - Selection of Clear-On-Read"]
pub struct DIS_COR_W<'a> {
    w: &'a mut W,
}
impl<'a> DIS_COR_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DIS_COR_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn normal(self) -> &'a mut W {
        self.variant(DIS_COR_A::NORMAL)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(DIS_COR_A::DISABLE)
    }
    #[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 Routing\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ROUTE_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<ROUTE_EN_A> for bool {
    #[inline(always)]
    fn from(variant: ROUTE_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `ROUTE_EN` reader - Enable Routing"]
pub struct ROUTE_EN_R(crate::FieldReader<bool, ROUTE_EN_A>);
impl ROUTE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        ROUTE_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ROUTE_EN_A {
        match self.bits {
            false => ROUTE_EN_A::DISABLE,
            true => ROUTE_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == ROUTE_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == ROUTE_EN_A::ENABLE
    }
}
impl core::ops::Deref for ROUTE_EN_R {
    type Target = crate::FieldReader<bool, ROUTE_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ROUTE_EN` writer - Enable Routing"]
pub struct ROUTE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> ROUTE_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ROUTE_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(ROUTE_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(ROUTE_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 Bank\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BANK_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<BANK_EN_A> for bool {
    #[inline(always)]
    fn from(variant: BANK_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BANK_EN` reader - Enable Bank"]
pub struct BANK_EN_R(crate::FieldReader<bool, BANK_EN_A>);
impl BANK_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        BANK_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BANK_EN_A {
        match self.bits {
            false => BANK_EN_A::DISABLE,
            true => BANK_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == BANK_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == BANK_EN_A::ENABLE
    }
}
impl core::ops::Deref for BANK_EN_R {
    type Target = crate::FieldReader<bool, BANK_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `BANK_EN` writer - Enable Bank"]
pub struct BANK_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> BANK_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BANK_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(BANK_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(BANK_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 = "DO NOT USE - This bit is depricated (CDT 223393)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LOCK_A {
    #[doc = "0: No description available"]
    MUTABLE = 0,
    #[doc = "1: No description available"]
    LOCKED = 1,
}
impl From<LOCK_A> for bool {
    #[inline(always)]
    fn from(variant: LOCK_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `LOCK` reader - DO NOT USE - This bit is depricated (CDT 223393)"]
pub struct LOCK_R(crate::FieldReader<bool, LOCK_A>);
impl LOCK_R {
    pub(crate) fn new(bits: bool) -> Self {
        LOCK_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> LOCK_A {
        match self.bits {
            false => LOCK_A::MUTABLE,
            true => LOCK_A::LOCKED,
        }
    }
    #[doc = "Checks if the value of the field is `MUTABLE`"]
    #[inline(always)]
    pub fn is_mutable(&self) -> bool {
        **self == LOCK_A::MUTABLE
    }
    #[doc = "Checks if the value of the field is `LOCKED`"]
    #[inline(always)]
    pub fn is_locked(&self) -> bool {
        **self == LOCK_A::LOCKED
    }
}
impl core::ops::Deref for LOCK_R {
    type Target = crate::FieldReader<bool, LOCK_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LOCK` writer - DO NOT USE - This bit is depricated (CDT 223393)"]
pub struct LOCK_W<'a> {
    w: &'a mut W,
}
impl<'a> LOCK_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: LOCK_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn mutable(self) -> &'a mut W {
        self.variant(LOCK_A::MUTABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn locked(self) -> &'a mut W {
        self.variant(LOCK_A::LOCKED)
    }
    #[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 = "Pipelining Control\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PIPE_A {
    #[doc = "0: No description available"]
    BYPASS = 0,
    #[doc = "1: No description available"]
    PIPELINED = 1,
}
impl From<PIPE_A> for bool {
    #[inline(always)]
    fn from(variant: PIPE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PIPE` reader - Pipelining Control"]
pub struct PIPE_R(crate::FieldReader<bool, PIPE_A>);
impl PIPE_R {
    pub(crate) fn new(bits: bool) -> Self {
        PIPE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PIPE_A {
        match self.bits {
            false => PIPE_A::BYPASS,
            true => PIPE_A::PIPELINED,
        }
    }
    #[doc = "Checks if the value of the field is `BYPASS`"]
    #[inline(always)]
    pub fn is_bypass(&self) -> bool {
        **self == PIPE_A::BYPASS
    }
    #[doc = "Checks if the value of the field is `PIPELINED`"]
    #[inline(always)]
    pub fn is_pipelined(&self) -> bool {
        **self == PIPE_A::PIPELINED
    }
}
impl core::ops::Deref for PIPE_R {
    type Target = crate::FieldReader<bool, PIPE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `PIPE` writer - Pipelining Control"]
pub struct PIPE_W<'a> {
    w: &'a mut W,
}
impl<'a> PIPE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PIPE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn bypass(self) -> &'a mut W {
        self.variant(PIPE_A::BYPASS)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn pipelined(self) -> &'a mut W {
        self.variant(PIPE_A::PIPELINED)
    }
    #[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 << 4)) | ((value as u8 & 0x01) << 4);
        self.w
    }
}
#[doc = "UDB Array Global Writing Option\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum GLBL_WR_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<GLBL_WR_A> for bool {
    #[inline(always)]
    fn from(variant: GLBL_WR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `GLBL_WR` reader - UDB Array Global Writing Option"]
pub struct GLBL_WR_R(crate::FieldReader<bool, GLBL_WR_A>);
impl GLBL_WR_R {
    pub(crate) fn new(bits: bool) -> Self {
        GLBL_WR_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> GLBL_WR_A {
        match self.bits {
            false => GLBL_WR_A::DISABLE,
            true => GLBL_WR_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == GLBL_WR_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == GLBL_WR_A::ENABLE
    }
}
impl core::ops::Deref for GLBL_WR_R {
    type Target = crate::FieldReader<bool, GLBL_WR_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `GLBL_WR` writer - UDB Array Global Writing Option"]
pub struct GLBL_WR_W<'a> {
    w: &'a mut W,
}
impl<'a> GLBL_WR_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: GLBL_WR_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(GLBL_WR_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(GLBL_WR_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 << 7)) | ((value as u8 & 0x01) << 7);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - Selection of Clear-On-Read"]
    #[inline(always)]
    pub fn dis_cor(&self) -> DIS_COR_R {
        DIS_COR_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - Enable Routing"]
    #[inline(always)]
    pub fn route_en(&self) -> ROUTE_EN_R {
        ROUTE_EN_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Enable Bank"]
    #[inline(always)]
    pub fn bank_en(&self) -> BANK_EN_R {
        BANK_EN_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - DO NOT USE - This bit is depricated (CDT 223393)"]
    #[inline(always)]
    pub fn lock(&self) -> LOCK_R {
        LOCK_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 4 - Pipelining Control"]
    #[inline(always)]
    pub fn pipe(&self) -> PIPE_R {
        PIPE_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 7 - UDB Array Global Writing Option"]
    #[inline(always)]
    pub fn glbl_wr(&self) -> GLBL_WR_R {
        GLBL_WR_R::new(((self.bits >> 7) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Selection of Clear-On-Read"]
    #[inline(always)]
    pub fn dis_cor(&mut self) -> DIS_COR_W {
        DIS_COR_W { w: self }
    }
    #[doc = "Bit 1 - Enable Routing"]
    #[inline(always)]
    pub fn route_en(&mut self) -> ROUTE_EN_W {
        ROUTE_EN_W { w: self }
    }
    #[doc = "Bit 2 - Enable Bank"]
    #[inline(always)]
    pub fn bank_en(&mut self) -> BANK_EN_W {
        BANK_EN_W { w: self }
    }
    #[doc = "Bit 3 - DO NOT USE - This bit is depricated (CDT 223393)"]
    #[inline(always)]
    pub fn lock(&mut self) -> LOCK_W {
        LOCK_W { w: self }
    }
    #[doc = "Bit 4 - Pipelining Control"]
    #[inline(always)]
    pub fn pipe(&mut self) -> PIPE_W {
        PIPE_W { w: self }
    }
    #[doc = "Bit 7 - UDB Array Global Writing Option"]
    #[inline(always)]
    pub fn glbl_wr(&mut self) -> GLBL_WR_W {
        GLBL_WR_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 = "Bank Control\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 [bank_ctl](index.html) module"]
pub struct BANK_CTL_SPEC;
impl crate::RegisterSpec for BANK_CTL_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [bank_ctl::R](R) reader structure"]
impl crate::Readable for BANK_CTL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [bank_ctl::W](W) writer structure"]
impl crate::Writable for BANK_CTL_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets BANK_CTL to value 0"]
impl crate::Resettable for BANK_CTL_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
