#[doc = "Register `ADFT_CTRL` reader"]
pub struct R(crate::R<ADFT_CTRL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<ADFT_CTRL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<ADFT_CTRL_SPEC>> for R {
    fn from(reader: crate::R<ADFT_CTRL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `ADFT_CTRL` writer"]
pub struct W(crate::W<ADFT_CTRL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<ADFT_CTRL_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<ADFT_CTRL_SPEC>> for W {
    fn from(writer: crate::W<ADFT_CTRL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "ADFT Mux 0A, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum ADFT_MUX_SEL_0A_A {
    #[doc = "0: No description available"]
    NC0 = 0,
    #[doc = "1: No description available"]
    IN1 = 1,
    #[doc = "2: No description available"]
    IN2 = 2,
    #[doc = "3: No description available"]
    IN3 = 3,
    #[doc = "4: No description available"]
    IN4 = 4,
    #[doc = "5: No description available"]
    IN5 = 5,
    #[doc = "6: No description available"]
    IN6 = 6,
    #[doc = "7: No description available"]
    NC7 = 7,
}
impl From<ADFT_MUX_SEL_0A_A> for u8 {
    #[inline(always)]
    fn from(variant: ADFT_MUX_SEL_0A_A) -> Self {
        variant as _
    }
}
#[doc = "Field `ADFT_MUX_SEL_0A` reader - ADFT Mux 0A, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_0A_R(crate::FieldReader<u8, ADFT_MUX_SEL_0A_A>);
impl ADFT_MUX_SEL_0A_R {
    pub(crate) fn new(bits: u8) -> Self {
        ADFT_MUX_SEL_0A_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ADFT_MUX_SEL_0A_A {
        match self.bits {
            0 => ADFT_MUX_SEL_0A_A::NC0,
            1 => ADFT_MUX_SEL_0A_A::IN1,
            2 => ADFT_MUX_SEL_0A_A::IN2,
            3 => ADFT_MUX_SEL_0A_A::IN3,
            4 => ADFT_MUX_SEL_0A_A::IN4,
            5 => ADFT_MUX_SEL_0A_A::IN5,
            6 => ADFT_MUX_SEL_0A_A::IN6,
            7 => ADFT_MUX_SEL_0A_A::NC7,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `NC0`"]
    #[inline(always)]
    pub fn is_nc0(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::NC0
    }
    #[doc = "Checks if the value of the field is `IN1`"]
    #[inline(always)]
    pub fn is_in1(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN1
    }
    #[doc = "Checks if the value of the field is `IN2`"]
    #[inline(always)]
    pub fn is_in2(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN2
    }
    #[doc = "Checks if the value of the field is `IN3`"]
    #[inline(always)]
    pub fn is_in3(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN3
    }
    #[doc = "Checks if the value of the field is `IN4`"]
    #[inline(always)]
    pub fn is_in4(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN4
    }
    #[doc = "Checks if the value of the field is `IN5`"]
    #[inline(always)]
    pub fn is_in5(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN5
    }
    #[doc = "Checks if the value of the field is `IN6`"]
    #[inline(always)]
    pub fn is_in6(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::IN6
    }
    #[doc = "Checks if the value of the field is `NC7`"]
    #[inline(always)]
    pub fn is_nc7(&self) -> bool {
        **self == ADFT_MUX_SEL_0A_A::NC7
    }
}
impl core::ops::Deref for ADFT_MUX_SEL_0A_R {
    type Target = crate::FieldReader<u8, ADFT_MUX_SEL_0A_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFT_MUX_SEL_0A` writer - ADFT Mux 0A, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_0A_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFT_MUX_SEL_0A_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ADFT_MUX_SEL_0A_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn nc0(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::NC0)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in1(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in2(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in3(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN3)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in4(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN4)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in5(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN5)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn in6(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::IN6)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn nc7(self) -> &'a mut W {
        self.variant(ADFT_MUX_SEL_0A_A::NC7)
    }
    #[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 & !0x07) | (value as u32 & 0x07);
        self.w
    }
}
#[doc = "Field `ADFT_MUX_SEL_1A` reader - ADFT Mux 1A, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_1A_R(crate::FieldReader<u8, u8>);
impl ADFT_MUX_SEL_1A_R {
    pub(crate) fn new(bits: u8) -> Self {
        ADFT_MUX_SEL_1A_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for ADFT_MUX_SEL_1A_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFT_MUX_SEL_1A` writer - ADFT Mux 1A, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_1A_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFT_MUX_SEL_1A_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 & !(0x07 << 3)) | ((value as u32 & 0x07) << 3);
        self.w
    }
}
#[doc = "Field `ADFT_MUX_SEL_0B` reader - ADFT Mux 0B, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_0B_R(crate::FieldReader<u8, u8>);
impl ADFT_MUX_SEL_0B_R {
    pub(crate) fn new(bits: u8) -> Self {
        ADFT_MUX_SEL_0B_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for ADFT_MUX_SEL_0B_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFT_MUX_SEL_0B` writer - ADFT Mux 0B, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_0B_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFT_MUX_SEL_0B_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 & !(0x07 << 6)) | ((value as u32 & 0x07) << 6);
        self.w
    }
}
#[doc = "Field `ADFT_MUX_SEL_1B` reader - ADFT Mux 1B, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_1B_R(crate::FieldReader<u8, u8>);
impl ADFT_MUX_SEL_1B_R {
    pub(crate) fn new(bits: u8) -> Self {
        ADFT_MUX_SEL_1B_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for ADFT_MUX_SEL_1B_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFT_MUX_SEL_1B` writer - ADFT Mux 1B, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
pub struct ADFT_MUX_SEL_1B_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFT_MUX_SEL_1B_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 & !(0x07 << 9)) | ((value as u32 & 0x07) << 9);
        self.w
    }
}
#[doc = "Field `ENABLE` reader - Enables ADFT functionality. Must be set for any of the ADFT switches and muxes to operate."]
pub struct ENABLE_R(crate::FieldReader<bool, bool>);
impl ENABLE_R {
    pub(crate) fn new(bits: bool) -> Self {
        ENABLE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for ENABLE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ENABLE` writer - Enables ADFT functionality. Must be set for any of the ADFT switches and muxes to operate."]
pub struct ENABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> ENABLE_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 << 31)) | ((value as u32 & 0x01) << 31);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:2 - ADFT Mux 0A, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_0a(&self) -> ADFT_MUX_SEL_0A_R {
        ADFT_MUX_SEL_0A_R::new((self.bits & 0x07) as u8)
    }
    #[doc = "Bits 3:5 - ADFT Mux 1A, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_1a(&self) -> ADFT_MUX_SEL_1A_R {
        ADFT_MUX_SEL_1A_R::new(((self.bits >> 3) & 0x07) as u8)
    }
    #[doc = "Bits 6:8 - ADFT Mux 0B, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_0b(&self) -> ADFT_MUX_SEL_0B_R {
        ADFT_MUX_SEL_0B_R::new(((self.bits >> 6) & 0x07) as u8)
    }
    #[doc = "Bits 9:11 - ADFT Mux 1B, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_1b(&self) -> ADFT_MUX_SEL_1B_R {
        ADFT_MUX_SEL_1B_R::new(((self.bits >> 9) & 0x07) as u8)
    }
    #[doc = "Bit 31 - Enables ADFT functionality. Must be set for any of the ADFT switches and muxes to operate."]
    #[inline(always)]
    pub fn enable(&self) -> ENABLE_R {
        ENABLE_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:2 - ADFT Mux 0A, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_0a(&mut self) -> ADFT_MUX_SEL_0A_W {
        ADFT_MUX_SEL_0A_W { w: self }
    }
    #[doc = "Bits 3:5 - ADFT Mux 1A, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_1a(&mut self) -> ADFT_MUX_SEL_1A_W {
        ADFT_MUX_SEL_1A_W { w: self }
    }
    #[doc = "Bits 6:8 - ADFT Mux 0B, connects inputs to ADFT bus adft0. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_0b(&mut self) -> ADFT_MUX_SEL_0B_W {
        ADFT_MUX_SEL_0B_W { w: self }
    }
    #[doc = "Bits 9:11 - ADFT Mux 1B, connects inputs to ADFT bus adft1. Refer to product definition for specific assignment."]
    #[inline(always)]
    pub fn adft_mux_sel_1b(&mut self) -> ADFT_MUX_SEL_1B_W {
        ADFT_MUX_SEL_1B_W { w: self }
    }
    #[doc = "Bit 31 - Enables ADFT functionality. Must be set for any of the ADFT switches and muxes to operate."]
    #[inline(always)]
    pub fn enable(&mut self) -> ENABLE_W {
        ENABLE_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 = "Analog DFT Control 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 [adft_ctrl](index.html) module"]
pub struct ADFT_CTRL_SPEC;
impl crate::RegisterSpec for ADFT_CTRL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [adft_ctrl::R](R) reader structure"]
impl crate::Readable for ADFT_CTRL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [adft_ctrl::W](W) writer structure"]
impl crate::Writable for ADFT_CTRL_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets ADFT_CTRL to value 0"]
impl crate::Resettable for ADFT_CTRL_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
