#[doc = "Register `PORT_SEL12` reader"]
pub struct R(crate::R<PORT_SEL12_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<PORT_SEL12_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<PORT_SEL12_SPEC>> for R {
    fn from(reader: crate::R<PORT_SEL12_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `PORT_SEL12` writer"]
pub struct W(crate::W<PORT_SEL12_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<PORT_SEL12_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<PORT_SEL12_SPEC>> for W {
    fn from(writer: crate::W<PORT_SEL12_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Selects connection for IO pad 0 route.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum IO0_SEL_A {
    #[doc = "0: No description available"]
    GPIO = 0,
    #[doc = "1: No description available"]
    GPIO_DSI = 1,
    #[doc = "2: No description available"]
    DSI_DSI = 2,
    #[doc = "3: No description available"]
    DSI_GPIO = 3,
    #[doc = "4: No description available"]
    CSD_SENSE = 4,
    #[doc = "5: No description available"]
    CSD_SHIELD = 5,
    #[doc = "6: No description available"]
    AMUXA = 6,
    #[doc = "7: No description available"]
    AMUXB = 7,
    #[doc = "8: No description available"]
    ACT_0 = 8,
    #[doc = "9: No description available"]
    ACT_1 = 9,
    #[doc = "10: No description available"]
    ACT_2 = 10,
    #[doc = "11: No description available"]
    ACT_3 = 11,
    #[doc = "12: No description available"]
    LCD_COM = 12,
    #[doc = "13: No description available"]
    LCD_SEG = 13,
    #[doc = "14: No description available"]
    DS_0 = 14,
    #[doc = "15: No description available"]
    DS_1 = 15,
    #[doc = "16: No description available"]
    DS_2 = 16,
    #[doc = "17: No description available"]
    DS_3 = 17,
}
impl From<IO0_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: IO0_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `IO0_SEL` reader - Selects connection for IO pad 0 route."]
pub struct IO0_SEL_R(crate::FieldReader<u8, IO0_SEL_A>);
impl IO0_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        IO0_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<IO0_SEL_A> {
        match self.bits {
            0 => Some(IO0_SEL_A::GPIO),
            1 => Some(IO0_SEL_A::GPIO_DSI),
            2 => Some(IO0_SEL_A::DSI_DSI),
            3 => Some(IO0_SEL_A::DSI_GPIO),
            4 => Some(IO0_SEL_A::CSD_SENSE),
            5 => Some(IO0_SEL_A::CSD_SHIELD),
            6 => Some(IO0_SEL_A::AMUXA),
            7 => Some(IO0_SEL_A::AMUXB),
            8 => Some(IO0_SEL_A::ACT_0),
            9 => Some(IO0_SEL_A::ACT_1),
            10 => Some(IO0_SEL_A::ACT_2),
            11 => Some(IO0_SEL_A::ACT_3),
            12 => Some(IO0_SEL_A::LCD_COM),
            13 => Some(IO0_SEL_A::LCD_SEG),
            12 => Some(IO0_SEL_A::DS_0),
            13 => Some(IO0_SEL_A::DS_1),
            14 => Some(IO0_SEL_A::DS_2),
            15 => Some(IO0_SEL_A::DS_3),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `GPIO`"]
    #[inline(always)]
    pub fn is_gpio(&self) -> bool {
        **self == IO0_SEL_A::GPIO
    }
    #[doc = "Checks if the value of the field is `GPIO_DSI`"]
    #[inline(always)]
    pub fn is_gpio_dsi(&self) -> bool {
        **self == IO0_SEL_A::GPIO_DSI
    }
    #[doc = "Checks if the value of the field is `DSI_DSI`"]
    #[inline(always)]
    pub fn is_dsi_dsi(&self) -> bool {
        **self == IO0_SEL_A::DSI_DSI
    }
    #[doc = "Checks if the value of the field is `DSI_GPIO`"]
    #[inline(always)]
    pub fn is_dsi_gpio(&self) -> bool {
        **self == IO0_SEL_A::DSI_GPIO
    }
    #[doc = "Checks if the value of the field is `CSD_SENSE`"]
    #[inline(always)]
    pub fn is_csd_sense(&self) -> bool {
        **self == IO0_SEL_A::CSD_SENSE
    }
    #[doc = "Checks if the value of the field is `CSD_SHIELD`"]
    #[inline(always)]
    pub fn is_csd_shield(&self) -> bool {
        **self == IO0_SEL_A::CSD_SHIELD
    }
    #[doc = "Checks if the value of the field is `AMUXA`"]
    #[inline(always)]
    pub fn is_amuxa(&self) -> bool {
        **self == IO0_SEL_A::AMUXA
    }
    #[doc = "Checks if the value of the field is `AMUXB`"]
    #[inline(always)]
    pub fn is_amuxb(&self) -> bool {
        **self == IO0_SEL_A::AMUXB
    }
    #[doc = "Checks if the value of the field is `ACT_0`"]
    #[inline(always)]
    pub fn is_act_0(&self) -> bool {
        **self == IO0_SEL_A::ACT_0
    }
    #[doc = "Checks if the value of the field is `ACT_1`"]
    #[inline(always)]
    pub fn is_act_1(&self) -> bool {
        **self == IO0_SEL_A::ACT_1
    }
    #[doc = "Checks if the value of the field is `ACT_2`"]
    #[inline(always)]
    pub fn is_act_2(&self) -> bool {
        **self == IO0_SEL_A::ACT_2
    }
    #[doc = "Checks if the value of the field is `ACT_3`"]
    #[inline(always)]
    pub fn is_act_3(&self) -> bool {
        **self == IO0_SEL_A::ACT_3
    }
    #[doc = "Checks if the value of the field is `LCD_COM`"]
    #[inline(always)]
    pub fn is_lcd_com(&self) -> bool {
        **self == IO0_SEL_A::LCD_COM
    }
    #[doc = "Checks if the value of the field is `LCD_SEG`"]
    #[inline(always)]
    pub fn is_lcd_seg(&self) -> bool {
        **self == IO0_SEL_A::LCD_SEG
    }
    #[doc = "Checks if the value of the field is `DS_0`"]
    #[inline(always)]
    pub fn is_ds_0(&self) -> bool {
        **self == IO0_SEL_A::DS_0
    }
    #[doc = "Checks if the value of the field is `DS_1`"]
    #[inline(always)]
    pub fn is_ds_1(&self) -> bool {
        **self == IO0_SEL_A::DS_1
    }
    #[doc = "Checks if the value of the field is `DS_2`"]
    #[inline(always)]
    pub fn is_ds_2(&self) -> bool {
        **self == IO0_SEL_A::DS_2
    }
    #[doc = "Checks if the value of the field is `DS_3`"]
    #[inline(always)]
    pub fn is_ds_3(&self) -> bool {
        **self == IO0_SEL_A::DS_3
    }
}
impl core::ops::Deref for IO0_SEL_R {
    type Target = crate::FieldReader<u8, IO0_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `IO0_SEL` writer - Selects connection for IO pad 0 route."]
pub struct IO0_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> IO0_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: IO0_SEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gpio(self) -> &'a mut W {
        self.variant(IO0_SEL_A::GPIO)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn gpio_dsi(self) -> &'a mut W {
        self.variant(IO0_SEL_A::GPIO_DSI)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_dsi(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DSI_DSI)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_gpio(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DSI_GPIO)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn csd_sense(self) -> &'a mut W {
        self.variant(IO0_SEL_A::CSD_SENSE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn csd_shield(self) -> &'a mut W {
        self.variant(IO0_SEL_A::CSD_SHIELD)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxa(self) -> &'a mut W {
        self.variant(IO0_SEL_A::AMUXA)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxb(self) -> &'a mut W {
        self.variant(IO0_SEL_A::AMUXB)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn act_0(self) -> &'a mut W {
        self.variant(IO0_SEL_A::ACT_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn act_1(self) -> &'a mut W {
        self.variant(IO0_SEL_A::ACT_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn act_2(self) -> &'a mut W {
        self.variant(IO0_SEL_A::ACT_2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn act_3(self) -> &'a mut W {
        self.variant(IO0_SEL_A::ACT_3)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn lcd_com(self) -> &'a mut W {
        self.variant(IO0_SEL_A::LCD_COM)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn lcd_seg(self) -> &'a mut W {
        self.variant(IO0_SEL_A::LCD_SEG)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn ds_0(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DS_0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn ds_1(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DS_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn ds_2(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DS_2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn ds_3(self) -> &'a mut W {
        self.variant(IO0_SEL_A::DS_3)
    }
    #[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 u32 & 0x0f);
        self.w
    }
}
#[doc = "Field `IO1_SEL` reader - Selects connection for IO pad 1 route."]
pub struct IO1_SEL_R(crate::FieldReader<u8, u8>);
impl IO1_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        IO1_SEL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for IO1_SEL_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `IO1_SEL` writer - Selects connection for IO pad 1 route."]
pub struct IO1_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> IO1_SEL_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 & !(0x0f << 4)) | ((value as u32 & 0x0f) << 4);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:3 - Selects connection for IO pad 0 route."]
    #[inline(always)]
    pub fn io0_sel(&self) -> IO0_SEL_R {
        IO0_SEL_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 4:7 - Selects connection for IO pad 1 route."]
    #[inline(always)]
    pub fn io1_sel(&self) -> IO1_SEL_R {
        IO1_SEL_R::new(((self.bits >> 4) & 0x0f) as u8)
    }
}
impl W {
    #[doc = "Bits 0:3 - Selects connection for IO pad 0 route."]
    #[inline(always)]
    pub fn io0_sel(&mut self) -> IO0_SEL_W {
        IO0_SEL_W { w: self }
    }
    #[doc = "Bits 4:7 - Selects connection for IO pad 1 route."]
    #[inline(always)]
    pub fn io1_sel(&mut self) -> IO1_SEL_W {
        IO1_SEL_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Port selection 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 [port_sel12](index.html) module"]
pub struct PORT_SEL12_SPEC;
impl crate::RegisterSpec for PORT_SEL12_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [port_sel12::R](R) reader structure"]
impl crate::Readable for PORT_SEL12_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [port_sel12::W](W) writer structure"]
impl crate::Writable for PORT_SEL12_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets PORT_SEL12 to value 0"]
impl crate::Resettable for PORT_SEL12_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
