#[doc = "Register `TOPSEL_U` reader"]
pub struct R(crate::R<TOPSEL_U_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<TOPSEL_U_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<TOPSEL_U_SPEC>> for R {
    fn from(reader: crate::R<TOPSEL_U_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `TOPSEL_U` writer"]
pub struct W(crate::W<TOPSEL_U_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<TOPSEL_U_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<TOPSEL_U_SPEC>> for W {
    fn from(writer: crate::W<TOPSEL_U_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Clock selection control for digital clock\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLK_SEL4_A {
    #[doc = "0: No description available"]
    EDGE_ENABLES = 0,
    #[doc = "1: No description available"]
    PORT_INPUT = 1,
    #[doc = "2: No description available"]
    DSI_OUTPUT = 2,
    #[doc = "3: No description available"]
    SYNC_DSI_OUTPUT = 3,
}
impl From<CLK_SEL4_A> for u8 {
    #[inline(always)]
    fn from(variant: CLK_SEL4_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLK_SEL4` reader - Clock selection control for digital clock"]
pub struct CLK_SEL4_R(crate::FieldReader<u8, CLK_SEL4_A>);
impl CLK_SEL4_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLK_SEL4_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLK_SEL4_A {
        match self.bits {
            0 => CLK_SEL4_A::EDGE_ENABLES,
            1 => CLK_SEL4_A::PORT_INPUT,
            2 => CLK_SEL4_A::DSI_OUTPUT,
            3 => CLK_SEL4_A::SYNC_DSI_OUTPUT,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `EDGE_ENABLES`"]
    #[inline(always)]
    pub fn is_edge_enables(&self) -> bool {
        **self == CLK_SEL4_A::EDGE_ENABLES
    }
    #[doc = "Checks if the value of the field is `PORT_INPUT`"]
    #[inline(always)]
    pub fn is_port_input(&self) -> bool {
        **self == CLK_SEL4_A::PORT_INPUT
    }
    #[doc = "Checks if the value of the field is `DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_dsi_output(&self) -> bool {
        **self == CLK_SEL4_A::DSI_OUTPUT
    }
    #[doc = "Checks if the value of the field is `SYNC_DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_sync_dsi_output(&self) -> bool {
        **self == CLK_SEL4_A::SYNC_DSI_OUTPUT
    }
}
impl core::ops::Deref for CLK_SEL4_R {
    type Target = crate::FieldReader<u8, CLK_SEL4_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLK_SEL4` writer - Clock selection control for digital clock"]
pub struct CLK_SEL4_W<'a> {
    w: &'a mut W,
}
impl<'a> CLK_SEL4_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLK_SEL4_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn edge_enables(self) -> &'a mut W {
        self.variant(CLK_SEL4_A::EDGE_ENABLES)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn port_input(self) -> &'a mut W {
        self.variant(CLK_SEL4_A::PORT_INPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL4_A::DSI_OUTPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sync_dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL4_A::SYNC_DSI_OUTPUT)
    }
    #[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 = "Clock selection control for digital clock\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLK_SEL5_A {
    #[doc = "0: No description available"]
    EDGE_ENABLES = 0,
    #[doc = "1: No description available"]
    PORT_INPUT = 1,
    #[doc = "2: No description available"]
    DSI_OUTPUT = 2,
    #[doc = "3: No description available"]
    SYNC_DSI_OUTPUT = 3,
}
impl From<CLK_SEL5_A> for u8 {
    #[inline(always)]
    fn from(variant: CLK_SEL5_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLK_SEL5` reader - Clock selection control for digital clock"]
pub struct CLK_SEL5_R(crate::FieldReader<u8, CLK_SEL5_A>);
impl CLK_SEL5_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLK_SEL5_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLK_SEL5_A {
        match self.bits {
            0 => CLK_SEL5_A::EDGE_ENABLES,
            1 => CLK_SEL5_A::PORT_INPUT,
            2 => CLK_SEL5_A::DSI_OUTPUT,
            3 => CLK_SEL5_A::SYNC_DSI_OUTPUT,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `EDGE_ENABLES`"]
    #[inline(always)]
    pub fn is_edge_enables(&self) -> bool {
        **self == CLK_SEL5_A::EDGE_ENABLES
    }
    #[doc = "Checks if the value of the field is `PORT_INPUT`"]
    #[inline(always)]
    pub fn is_port_input(&self) -> bool {
        **self == CLK_SEL5_A::PORT_INPUT
    }
    #[doc = "Checks if the value of the field is `DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_dsi_output(&self) -> bool {
        **self == CLK_SEL5_A::DSI_OUTPUT
    }
    #[doc = "Checks if the value of the field is `SYNC_DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_sync_dsi_output(&self) -> bool {
        **self == CLK_SEL5_A::SYNC_DSI_OUTPUT
    }
}
impl core::ops::Deref for CLK_SEL5_R {
    type Target = crate::FieldReader<u8, CLK_SEL5_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLK_SEL5` writer - Clock selection control for digital clock"]
pub struct CLK_SEL5_W<'a> {
    w: &'a mut W,
}
impl<'a> CLK_SEL5_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLK_SEL5_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn edge_enables(self) -> &'a mut W {
        self.variant(CLK_SEL5_A::EDGE_ENABLES)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn port_input(self) -> &'a mut W {
        self.variant(CLK_SEL5_A::PORT_INPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL5_A::DSI_OUTPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sync_dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL5_A::SYNC_DSI_OUTPUT)
    }
    #[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 << 2)) | ((value as u8 & 0x03) << 2);
        self.w
    }
}
#[doc = "Clock selection control for digital clock\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLK_SEL6_A {
    #[doc = "0: No description available"]
    EDGE_ENABLES = 0,
    #[doc = "1: No description available"]
    PORT_INPUT = 1,
    #[doc = "2: No description available"]
    DSI_OUTPUT = 2,
    #[doc = "3: No description available"]
    SYNC_DSI_OUTPUT = 3,
}
impl From<CLK_SEL6_A> for u8 {
    #[inline(always)]
    fn from(variant: CLK_SEL6_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLK_SEL6` reader - Clock selection control for digital clock"]
pub struct CLK_SEL6_R(crate::FieldReader<u8, CLK_SEL6_A>);
impl CLK_SEL6_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLK_SEL6_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLK_SEL6_A {
        match self.bits {
            0 => CLK_SEL6_A::EDGE_ENABLES,
            1 => CLK_SEL6_A::PORT_INPUT,
            2 => CLK_SEL6_A::DSI_OUTPUT,
            3 => CLK_SEL6_A::SYNC_DSI_OUTPUT,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `EDGE_ENABLES`"]
    #[inline(always)]
    pub fn is_edge_enables(&self) -> bool {
        **self == CLK_SEL6_A::EDGE_ENABLES
    }
    #[doc = "Checks if the value of the field is `PORT_INPUT`"]
    #[inline(always)]
    pub fn is_port_input(&self) -> bool {
        **self == CLK_SEL6_A::PORT_INPUT
    }
    #[doc = "Checks if the value of the field is `DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_dsi_output(&self) -> bool {
        **self == CLK_SEL6_A::DSI_OUTPUT
    }
    #[doc = "Checks if the value of the field is `SYNC_DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_sync_dsi_output(&self) -> bool {
        **self == CLK_SEL6_A::SYNC_DSI_OUTPUT
    }
}
impl core::ops::Deref for CLK_SEL6_R {
    type Target = crate::FieldReader<u8, CLK_SEL6_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLK_SEL6` writer - Clock selection control for digital clock"]
pub struct CLK_SEL6_W<'a> {
    w: &'a mut W,
}
impl<'a> CLK_SEL6_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLK_SEL6_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn edge_enables(self) -> &'a mut W {
        self.variant(CLK_SEL6_A::EDGE_ENABLES)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn port_input(self) -> &'a mut W {
        self.variant(CLK_SEL6_A::PORT_INPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL6_A::DSI_OUTPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sync_dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL6_A::SYNC_DSI_OUTPUT)
    }
    #[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 = "Clock selection control for digital clock\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CLK_SEL7_A {
    #[doc = "0: No description available"]
    EDGE_ENABLES = 0,
    #[doc = "1: No description available"]
    PORT_INPUT = 1,
    #[doc = "2: No description available"]
    DSI_OUTPUT = 2,
    #[doc = "3: No description available"]
    SYNC_DSI_OUTPUT = 3,
}
impl From<CLK_SEL7_A> for u8 {
    #[inline(always)]
    fn from(variant: CLK_SEL7_A) -> Self {
        variant as _
    }
}
#[doc = "Field `CLK_SEL7` reader - Clock selection control for digital clock"]
pub struct CLK_SEL7_R(crate::FieldReader<u8, CLK_SEL7_A>);
impl CLK_SEL7_R {
    pub(crate) fn new(bits: u8) -> Self {
        CLK_SEL7_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CLK_SEL7_A {
        match self.bits {
            0 => CLK_SEL7_A::EDGE_ENABLES,
            1 => CLK_SEL7_A::PORT_INPUT,
            2 => CLK_SEL7_A::DSI_OUTPUT,
            3 => CLK_SEL7_A::SYNC_DSI_OUTPUT,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `EDGE_ENABLES`"]
    #[inline(always)]
    pub fn is_edge_enables(&self) -> bool {
        **self == CLK_SEL7_A::EDGE_ENABLES
    }
    #[doc = "Checks if the value of the field is `PORT_INPUT`"]
    #[inline(always)]
    pub fn is_port_input(&self) -> bool {
        **self == CLK_SEL7_A::PORT_INPUT
    }
    #[doc = "Checks if the value of the field is `DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_dsi_output(&self) -> bool {
        **self == CLK_SEL7_A::DSI_OUTPUT
    }
    #[doc = "Checks if the value of the field is `SYNC_DSI_OUTPUT`"]
    #[inline(always)]
    pub fn is_sync_dsi_output(&self) -> bool {
        **self == CLK_SEL7_A::SYNC_DSI_OUTPUT
    }
}
impl core::ops::Deref for CLK_SEL7_R {
    type Target = crate::FieldReader<u8, CLK_SEL7_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `CLK_SEL7` writer - Clock selection control for digital clock"]
pub struct CLK_SEL7_W<'a> {
    w: &'a mut W,
}
impl<'a> CLK_SEL7_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: CLK_SEL7_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn edge_enables(self) -> &'a mut W {
        self.variant(CLK_SEL7_A::EDGE_ENABLES)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn port_input(self) -> &'a mut W {
        self.variant(CLK_SEL7_A::PORT_INPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL7_A::DSI_OUTPUT)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sync_dsi_output(self) -> &'a mut W {
        self.variant(CLK_SEL7_A::SYNC_DSI_OUTPUT)
    }
    #[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 << 6)) | ((value as u8 & 0x03) << 6);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:1 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel4(&self) -> CLK_SEL4_R {
        CLK_SEL4_R::new((self.bits & 0x03) as u8)
    }
    #[doc = "Bits 2:3 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel5(&self) -> CLK_SEL5_R {
        CLK_SEL5_R::new(((self.bits >> 2) & 0x03) as u8)
    }
    #[doc = "Bits 4:5 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel6(&self) -> CLK_SEL6_R {
        CLK_SEL6_R::new(((self.bits >> 4) & 0x03) as u8)
    }
    #[doc = "Bits 6:7 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel7(&self) -> CLK_SEL7_R {
        CLK_SEL7_R::new(((self.bits >> 6) & 0x03) as u8)
    }
}
impl W {
    #[doc = "Bits 0:1 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel4(&mut self) -> CLK_SEL4_W {
        CLK_SEL4_W { w: self }
    }
    #[doc = "Bits 2:3 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel5(&mut self) -> CLK_SEL5_W {
        CLK_SEL5_W { w: self }
    }
    #[doc = "Bits 4:5 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel6(&mut self) -> CLK_SEL6_W {
        CLK_SEL6_W { w: self }
    }
    #[doc = "Bits 6:7 - Clock selection control for digital clock"]
    #[inline(always)]
    pub fn clk_sel7(&mut self) -> CLK_SEL7_W {
        CLK_SEL7_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 = "Upper Nibble Top Digital 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 [topsel_u](index.html) module"]
pub struct TOPSEL_U_SPEC;
impl crate::RegisterSpec for TOPSEL_U_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [topsel_u::R](R) reader structure"]
impl crate::Readable for TOPSEL_U_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [topsel_u::W](W) writer structure"]
impl crate::Writable for TOPSEL_U_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets TOPSEL_U to value 0"]
impl crate::Resettable for TOPSEL_U_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
