#[doc = "Register `DFT_CTRL` reader"]
pub struct R(crate::R<DFT_CTRL_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<DFT_CTRL_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<DFT_CTRL_SPEC>> for R {
    fn from(reader: crate::R<DFT_CTRL_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `DFT_CTRL` writer"]
pub struct W(crate::W<DFT_CTRL_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<DFT_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<DFT_CTRL_SPEC>> for W {
    fn from(writer: crate::W<DFT_CTRL_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "DDFT select signal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DDFT_SEL_A {
    #[doc = "0: No description available"]
    OFF = 0,
    #[doc = "1: No description available"]
    DP_SE = 1,
    #[doc = "2: No description available"]
    DM_SE = 2,
    #[doc = "3: No description available"]
    RCV_DF = 3,
    #[doc = "4: No description available"]
    CHRG_DET = 4,
    #[doc = "5: No description available"]
    VBUS_DET = 5,
}
impl From<DDFT_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: DDFT_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `DDFT_SEL` reader - DDFT select signal"]
pub struct DDFT_SEL_R(crate::FieldReader<u8, DDFT_SEL_A>);
impl DDFT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        DDFT_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<DDFT_SEL_A> {
        match self.bits {
            0 => Some(DDFT_SEL_A::OFF),
            1 => Some(DDFT_SEL_A::DP_SE),
            2 => Some(DDFT_SEL_A::DM_SE),
            3 => Some(DDFT_SEL_A::RCV_DF),
            4 => Some(DDFT_SEL_A::CHRG_DET),
            5 => Some(DDFT_SEL_A::VBUS_DET),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `OFF`"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        **self == DDFT_SEL_A::OFF
    }
    #[doc = "Checks if the value of the field is `DP_SE`"]
    #[inline(always)]
    pub fn is_dp_se(&self) -> bool {
        **self == DDFT_SEL_A::DP_SE
    }
    #[doc = "Checks if the value of the field is `DM_SE`"]
    #[inline(always)]
    pub fn is_dm_se(&self) -> bool {
        **self == DDFT_SEL_A::DM_SE
    }
    #[doc = "Checks if the value of the field is `RCV_DF`"]
    #[inline(always)]
    pub fn is_rcv_df(&self) -> bool {
        **self == DDFT_SEL_A::RCV_DF
    }
    #[doc = "Checks if the value of the field is `CHRG_DET`"]
    #[inline(always)]
    pub fn is_chrg_det(&self) -> bool {
        **self == DDFT_SEL_A::CHRG_DET
    }
    #[doc = "Checks if the value of the field is `VBUS_DET`"]
    #[inline(always)]
    pub fn is_vbus_det(&self) -> bool {
        **self == DDFT_SEL_A::VBUS_DET
    }
}
impl core::ops::Deref for DDFT_SEL_R {
    type Target = crate::FieldReader<u8, DDFT_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DDFT_SEL` writer - DDFT select signal"]
pub struct DDFT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> DDFT_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DDFT_SEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn off(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::OFF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dp_se(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::DP_SE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn dm_se(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::DM_SE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn rcv_df(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::RCV_DF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn chrg_det(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::CHRG_DET)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn vbus_det(self) -> &'a mut W {
        self.variant(DDFT_SEL_A::VBUS_DET)
    }
    #[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) | (value as u32 & 0x07);
        self.w
    }
}
#[doc = "Select ADFT connection for VREF_OUT\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum ADFT_VREFOUT_SEL_A {
    #[doc = "0: No description available"]
    OPEN = 0,
    #[doc = "1: No description available"]
    AMUXA = 1,
    #[doc = "2: No description available"]
    AMUXB = 2,
    #[doc = "3: No description available"]
    RSVD = 3,
}
impl From<ADFT_VREFOUT_SEL_A> for u8 {
    #[inline(always)]
    fn from(variant: ADFT_VREFOUT_SEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `ADFT_VREFOUT_SEL` reader - Select ADFT connection for VREF_OUT"]
pub struct ADFT_VREFOUT_SEL_R(crate::FieldReader<u8, ADFT_VREFOUT_SEL_A>);
impl ADFT_VREFOUT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        ADFT_VREFOUT_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> ADFT_VREFOUT_SEL_A {
        match self.bits {
            0 => ADFT_VREFOUT_SEL_A::OPEN,
            1 => ADFT_VREFOUT_SEL_A::AMUXA,
            2 => ADFT_VREFOUT_SEL_A::AMUXB,
            3 => ADFT_VREFOUT_SEL_A::RSVD,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `OPEN`"]
    #[inline(always)]
    pub fn is_open(&self) -> bool {
        **self == ADFT_VREFOUT_SEL_A::OPEN
    }
    #[doc = "Checks if the value of the field is `AMUXA`"]
    #[inline(always)]
    pub fn is_amuxa(&self) -> bool {
        **self == ADFT_VREFOUT_SEL_A::AMUXA
    }
    #[doc = "Checks if the value of the field is `AMUXB`"]
    #[inline(always)]
    pub fn is_amuxb(&self) -> bool {
        **self == ADFT_VREFOUT_SEL_A::AMUXB
    }
    #[doc = "Checks if the value of the field is `RSVD`"]
    #[inline(always)]
    pub fn is_rsvd(&self) -> bool {
        **self == ADFT_VREFOUT_SEL_A::RSVD
    }
}
impl core::ops::Deref for ADFT_VREFOUT_SEL_R {
    type Target = crate::FieldReader<u8, ADFT_VREFOUT_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFT_VREFOUT_SEL` writer - Select ADFT connection for VREF_OUT"]
pub struct ADFT_VREFOUT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFT_VREFOUT_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: ADFT_VREFOUT_SEL_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn open(self) -> &'a mut W {
        self.variant(ADFT_VREFOUT_SEL_A::OPEN)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxa(self) -> &'a mut W {
        self.variant(ADFT_VREFOUT_SEL_A::AMUXA)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxb(self) -> &'a mut W {
        self.variant(ADFT_VREFOUT_SEL_A::AMUXB)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn rsvd(self) -> &'a mut W {
        self.variant(ADFT_VREFOUT_SEL_A::RSVD)
    }
    #[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 << 8)) | ((value as u32 & 0x03) << 8);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:2 - DDFT select signal"]
    #[inline(always)]
    pub fn ddft_sel(&self) -> DDFT_SEL_R {
        DDFT_SEL_R::new((self.bits & 0x07) as u8)
    }
    #[doc = "Bits 8:9 - Select ADFT connection for VREF_OUT"]
    #[inline(always)]
    pub fn adft_vrefout_sel(&self) -> ADFT_VREFOUT_SEL_R {
        ADFT_VREFOUT_SEL_R::new(((self.bits >> 8) & 0x03) as u8)
    }
}
impl W {
    #[doc = "Bits 0:2 - DDFT select signal"]
    #[inline(always)]
    pub fn ddft_sel(&mut self) -> DDFT_SEL_W {
        DDFT_SEL_W { w: self }
    }
    #[doc = "Bits 8:9 - Select ADFT connection for VREF_OUT"]
    #[inline(always)]
    pub fn adft_vrefout_sel(&mut self) -> ADFT_VREFOUT_SEL_W {
        ADFT_VREFOUT_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 = "DFT 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 [dft_ctrl](index.html) module"]
pub struct DFT_CTRL_SPEC;
impl crate::RegisterSpec for DFT_CTRL_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [dft_ctrl::R](R) reader structure"]
impl crate::Readable for DFT_CTRL_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [dft_ctrl::W](W) writer structure"]
impl crate::Writable for DFT_CTRL_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets DFT_CTRL to value 0"]
impl crate::Resettable for DFT_CTRL_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
