#[doc = "Register `CONFIG` reader"]
pub struct R(crate::R<CONFIG_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CONFIG_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CONFIG_SPEC>> for R {
    fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CONFIG` writer"]
pub struct W(crate::W<CONFIG_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CONFIG_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<CONFIG_SPEC>> for W {
    fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `DSI_SAMPLE_EN` reader - Enables the use of the dsi_sample_in input instead of the comparator output to strobe COUNTER."]
pub struct DSI_SAMPLE_EN_R(crate::FieldReader<bool, bool>);
impl DSI_SAMPLE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        DSI_SAMPLE_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DSI_SAMPLE_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DSI_SAMPLE_EN` writer - Enables the use of the dsi_sample_in input instead of the comparator output to strobe COUNTER."]
pub struct DSI_SAMPLE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> DSI_SAMPLE_EN_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) | (value as u32 & 0x01);
        self.w
    }
}
#[doc = "Field `SAMPLE_SYNC` reader - Enables double synchronizing of sample input from DSI (only relevant when DSI_SAMPLE_EN=1)."]
pub struct SAMPLE_SYNC_R(crate::FieldReader<bool, bool>);
impl SAMPLE_SYNC_R {
    pub(crate) fn new(bits: bool) -> Self {
        SAMPLE_SYNC_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SAMPLE_SYNC_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SAMPLE_SYNC` writer - Enables double synchronizing of sample input from DSI (only relevant when DSI_SAMPLE_EN=1)."]
pub struct SAMPLE_SYNC_W<'a> {
    w: &'a mut W,
}
impl<'a> SAMPLE_SYNC_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 << 1)) | ((value as u32 & 0x01) << 1);
        self.w
    }
}
#[doc = "Selects whether to use CSD1 clock for modulation directly, or use PRS/Divide-by-2 modulation (default).\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BYPASS_SEL_A {
    #[doc = "0: No description available"]
    PRS_OR_DIV2 = 0,
    #[doc = "1: No description available"]
    DIRECT_CLOCK = 1,
}
impl From<BYPASS_SEL_A> for bool {
    #[inline(always)]
    fn from(variant: BYPASS_SEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BYPASS_SEL` reader - Selects whether to use CSD1 clock for modulation directly, or use PRS/Divide-by-2 modulation (default)."]
pub struct BYPASS_SEL_R(crate::FieldReader<bool, BYPASS_SEL_A>);
impl BYPASS_SEL_R {
    pub(crate) fn new(bits: bool) -> Self {
        BYPASS_SEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BYPASS_SEL_A {
        match self.bits {
            false => BYPASS_SEL_A::PRS_OR_DIV2,
            true => BYPASS_SEL_A::DIRECT_CLOCK,
        }
    }
    #[doc = "Checks if the value of the field is `PRS_OR_DIV2`"]
    #[inline(always)]
    pub fn is_prs_or_div2(&self) -> bool {
        **self == BYPASS_SEL_A::PRS_OR_DIV2
    }
    #[doc = "Checks if the value of the field is `DIRECT_CLOCK`"]
    #[inline(always)]
    pub fn is_direct_clock(&self) -> bool {
        **self == BYPASS_SEL_A::DIRECT_CLOCK
    }
}
impl core::ops::Deref for BYPASS_SEL_R {
    type Target = crate::FieldReader<bool, BYPASS_SEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `BYPASS_SEL` writer - Selects whether to use CSD1 clock for modulation directly, or use PRS/Divide-by-2 modulation (default)."]
pub struct BYPASS_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> BYPASS_SEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: BYPASS_SEL_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn prs_or_div2(self) -> &'a mut W {
        self.variant(BYPASS_SEL_A::PRS_OR_DIV2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn direct_clock(self) -> &'a mut W {
        self.variant(BYPASS_SEL_A::DIRECT_CLOCK)
    }
    #[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 u32 & 0x01) << 2);
        self.w
    }
}
#[doc = "Enables the digital filter on the CSD comparator.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FILTER_ENABLE_A {
    #[doc = "0: No description available"]
    FILTER_OFF = 0,
    #[doc = "1: No description available"]
    FILTER_ON = 1,
}
impl From<FILTER_ENABLE_A> for bool {
    #[inline(always)]
    fn from(variant: FILTER_ENABLE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `FILTER_ENABLE` reader - Enables the digital filter on the CSD comparator."]
pub struct FILTER_ENABLE_R(crate::FieldReader<bool, FILTER_ENABLE_A>);
impl FILTER_ENABLE_R {
    pub(crate) fn new(bits: bool) -> Self {
        FILTER_ENABLE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> FILTER_ENABLE_A {
        match self.bits {
            false => FILTER_ENABLE_A::FILTER_OFF,
            true => FILTER_ENABLE_A::FILTER_ON,
        }
    }
    #[doc = "Checks if the value of the field is `FILTER_OFF`"]
    #[inline(always)]
    pub fn is_filter_off(&self) -> bool {
        **self == FILTER_ENABLE_A::FILTER_OFF
    }
    #[doc = "Checks if the value of the field is `FILTER_ON`"]
    #[inline(always)]
    pub fn is_filter_on(&self) -> bool {
        **self == FILTER_ENABLE_A::FILTER_ON
    }
}
impl core::ops::Deref for FILTER_ENABLE_R {
    type Target = crate::FieldReader<bool, FILTER_ENABLE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `FILTER_ENABLE` writer - Enables the digital filter on the CSD comparator."]
pub struct FILTER_ENABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> FILTER_ENABLE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FILTER_ENABLE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn filter_off(self) -> &'a mut W {
        self.variant(FILTER_ENABLE_A::FILTER_OFF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn filter_on(self) -> &'a mut W {
        self.variant(FILTER_ENABLE_A::FILTER_ON)
    }
    #[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 u32 & 0x01) << 3);
        self.w
    }
}
#[doc = "Enables dual cap mode when MUTUAL_CAP=1, do not use when MUTUAL_CAP=0\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DUAL_CAP_EN_A {
    #[doc = "0: No description available"]
    DISABLE = 0,
    #[doc = "1: No description available"]
    ENABLE = 1,
}
impl From<DUAL_CAP_EN_A> for bool {
    #[inline(always)]
    fn from(variant: DUAL_CAP_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DUAL_CAP_EN` reader - Enables dual cap mode when MUTUAL_CAP=1, do not use when MUTUAL_CAP=0"]
pub struct DUAL_CAP_EN_R(crate::FieldReader<bool, DUAL_CAP_EN_A>);
impl DUAL_CAP_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        DUAL_CAP_EN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DUAL_CAP_EN_A {
        match self.bits {
            false => DUAL_CAP_EN_A::DISABLE,
            true => DUAL_CAP_EN_A::ENABLE,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLE`"]
    #[inline(always)]
    pub fn is_disable(&self) -> bool {
        **self == DUAL_CAP_EN_A::DISABLE
    }
    #[doc = "Checks if the value of the field is `ENABLE`"]
    #[inline(always)]
    pub fn is_enable(&self) -> bool {
        **self == DUAL_CAP_EN_A::ENABLE
    }
}
impl core::ops::Deref for DUAL_CAP_EN_R {
    type Target = crate::FieldReader<bool, DUAL_CAP_EN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DUAL_CAP_EN` writer - Enables dual cap mode when MUTUAL_CAP=1, do not use when MUTUAL_CAP=0"]
pub struct DUAL_CAP_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> DUAL_CAP_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DUAL_CAP_EN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn disable(self) -> &'a mut W {
        self.variant(DUAL_CAP_EN_A::DISABLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn enable(self) -> &'a mut W {
        self.variant(DUAL_CAP_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 << 4)) | ((value as u32 & 0x01) << 4);
        self.w
    }
}
#[doc = "Field `PRS_CLEAR` writer - When set, forces the pseudo-random generator to it's initial state. Note that it may take some time for this setting to take effect depending on the clock frequency used for clk_csd1. Hardware clears this bit at the same time PRS is cleared."]
pub struct PRS_CLEAR_W<'a> {
    w: &'a mut W,
}
impl<'a> PRS_CLEAR_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 << 5)) | ((value as u32 & 0x01) << 5);
        self.w
    }
}
#[doc = "Selects between PRS or simple divide by 2 sense modulation.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PRS_SELECT_A {
    #[doc = "0: No description available"]
    DIV2 = 0,
    #[doc = "1: No description available"]
    PRS = 1,
}
impl From<PRS_SELECT_A> for bool {
    #[inline(always)]
    fn from(variant: PRS_SELECT_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PRS_SELECT` reader - Selects between PRS or simple divide by 2 sense modulation."]
pub struct PRS_SELECT_R(crate::FieldReader<bool, PRS_SELECT_A>);
impl PRS_SELECT_R {
    pub(crate) fn new(bits: bool) -> Self {
        PRS_SELECT_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PRS_SELECT_A {
        match self.bits {
            false => PRS_SELECT_A::DIV2,
            true => PRS_SELECT_A::PRS,
        }
    }
    #[doc = "Checks if the value of the field is `DIV2`"]
    #[inline(always)]
    pub fn is_div2(&self) -> bool {
        **self == PRS_SELECT_A::DIV2
    }
    #[doc = "Checks if the value of the field is `PRS`"]
    #[inline(always)]
    pub fn is_prs(&self) -> bool {
        **self == PRS_SELECT_A::PRS
    }
}
impl core::ops::Deref for PRS_SELECT_R {
    type Target = crate::FieldReader<bool, PRS_SELECT_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `PRS_SELECT` writer - Selects between PRS or simple divide by 2 sense modulation."]
pub struct PRS_SELECT_W<'a> {
    w: &'a mut W,
}
impl<'a> PRS_SELECT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PRS_SELECT_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn div2(self) -> &'a mut W {
        self.variant(PRS_SELECT_A::DIV2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn prs(self) -> &'a mut W {
        self.variant(PRS_SELECT_A::PRS)
    }
    #[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 << 6)) | ((value as u32 & 0x01) << 6);
        self.w
    }
}
#[doc = "Selects between 8 or 12b PRS sequence\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PRS_12_8_A {
    #[doc = "0: No description available"]
    CY8B = 0,
    #[doc = "1: No description available"]
    CY12B = 1,
}
impl From<PRS_12_8_A> for bool {
    #[inline(always)]
    fn from(variant: PRS_12_8_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PRS_12_8` reader - Selects between 8 or 12b PRS sequence"]
pub struct PRS_12_8_R(crate::FieldReader<bool, PRS_12_8_A>);
impl PRS_12_8_R {
    pub(crate) fn new(bits: bool) -> Self {
        PRS_12_8_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PRS_12_8_A {
        match self.bits {
            false => PRS_12_8_A::CY8B,
            true => PRS_12_8_A::CY12B,
        }
    }
    #[doc = "Checks if the value of the field is `CY8B`"]
    #[inline(always)]
    pub fn is_cy8b(&self) -> bool {
        **self == PRS_12_8_A::CY8B
    }
    #[doc = "Checks if the value of the field is `CY12B`"]
    #[inline(always)]
    pub fn is_cy12b(&self) -> bool {
        **self == PRS_12_8_A::CY12B
    }
}
impl core::ops::Deref for PRS_12_8_R {
    type Target = crate::FieldReader<bool, PRS_12_8_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `PRS_12_8` writer - Selects between 8 or 12b PRS sequence"]
pub struct PRS_12_8_W<'a> {
    w: &'a mut W,
}
impl<'a> PRS_12_8_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PRS_12_8_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn cy8b(self) -> &'a mut W {
        self.variant(PRS_12_8_A::CY8B)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn cy12b(self) -> &'a mut W {
        self.variant(PRS_12_8_A::CY12B)
    }
    #[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 u32 & 0x01) << 7);
        self.w
    }
}
#[doc = "Field `DSI_SENSE_EN` reader - Enables the use of the dsi_sense_in input instead of the internally generated modulation signal to drive csd_sense and csd_shield signals."]
pub struct DSI_SENSE_EN_R(crate::FieldReader<bool, bool>);
impl DSI_SENSE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        DSI_SENSE_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for DSI_SENSE_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DSI_SENSE_EN` writer - Enables the use of the dsi_sense_in input instead of the internally generated modulation signal to drive csd_sense and csd_shield signals."]
pub struct DSI_SENSE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> DSI_SENSE_EN_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 << 8)) | ((value as u32 & 0x01) << 8);
        self.w
    }
}
#[doc = "Selects the delay by which csd_shield is delayed relative to csd_sense.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum SHIELD_DELAY_A {
    #[doc = "0: No description available"]
    OFF = 0,
    #[doc = "2: No description available"]
    CY50NS = 2,
    #[doc = "3: No description available"]
    CY10NS = 3,
}
impl From<SHIELD_DELAY_A> for u8 {
    #[inline(always)]
    fn from(variant: SHIELD_DELAY_A) -> Self {
        variant as _
    }
}
#[doc = "Field `SHIELD_DELAY` reader - Selects the delay by which csd_shield is delayed relative to csd_sense."]
pub struct SHIELD_DELAY_R(crate::FieldReader<u8, SHIELD_DELAY_A>);
impl SHIELD_DELAY_R {
    pub(crate) fn new(bits: u8) -> Self {
        SHIELD_DELAY_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<SHIELD_DELAY_A> {
        match self.bits {
            0 => Some(SHIELD_DELAY_A::OFF),
            2 => Some(SHIELD_DELAY_A::CY50NS),
            3 => Some(SHIELD_DELAY_A::CY10NS),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `OFF`"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        **self == SHIELD_DELAY_A::OFF
    }
    #[doc = "Checks if the value of the field is `CY50NS`"]
    #[inline(always)]
    pub fn is_cy50ns(&self) -> bool {
        **self == SHIELD_DELAY_A::CY50NS
    }
    #[doc = "Checks if the value of the field is `CY10NS`"]
    #[inline(always)]
    pub fn is_cy10ns(&self) -> bool {
        **self == SHIELD_DELAY_A::CY10NS
    }
}
impl core::ops::Deref for SHIELD_DELAY_R {
    type Target = crate::FieldReader<u8, SHIELD_DELAY_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SHIELD_DELAY` writer - Selects the delay by which csd_shield is delayed relative to csd_sense."]
pub struct SHIELD_DELAY_W<'a> {
    w: &'a mut W,
}
impl<'a> SHIELD_DELAY_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SHIELD_DELAY_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn off(self) -> &'a mut W {
        self.variant(SHIELD_DELAY_A::OFF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn cy50ns(self) -> &'a mut W {
        self.variant(SHIELD_DELAY_A::CY50NS)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn cy10ns(self) -> &'a mut W {
        self.variant(SHIELD_DELAY_A::CY10NS)
    }
    #[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 & !(0x03 << 9)) | ((value as u32 & 0x03) << 9);
        self.w
    }
}
#[doc = "Selects bandwidth for sensing comparator\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SENSE_COMP_BW_A {
    #[doc = "0: No description available"]
    LOW = 0,
    #[doc = "1: No description available"]
    HIGH = 1,
}
impl From<SENSE_COMP_BW_A> for bool {
    #[inline(always)]
    fn from(variant: SENSE_COMP_BW_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SENSE_COMP_BW` reader - Selects bandwidth for sensing comparator"]
pub struct SENSE_COMP_BW_R(crate::FieldReader<bool, SENSE_COMP_BW_A>);
impl SENSE_COMP_BW_R {
    pub(crate) fn new(bits: bool) -> Self {
        SENSE_COMP_BW_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SENSE_COMP_BW_A {
        match self.bits {
            false => SENSE_COMP_BW_A::LOW,
            true => SENSE_COMP_BW_A::HIGH,
        }
    }
    #[doc = "Checks if the value of the field is `LOW`"]
    #[inline(always)]
    pub fn is_low(&self) -> bool {
        **self == SENSE_COMP_BW_A::LOW
    }
    #[doc = "Checks if the value of the field is `HIGH`"]
    #[inline(always)]
    pub fn is_high(&self) -> bool {
        **self == SENSE_COMP_BW_A::HIGH
    }
}
impl core::ops::Deref for SENSE_COMP_BW_R {
    type Target = crate::FieldReader<bool, SENSE_COMP_BW_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SENSE_COMP_BW` writer - Selects bandwidth for sensing comparator"]
pub struct SENSE_COMP_BW_W<'a> {
    w: &'a mut W,
}
impl<'a> SENSE_COMP_BW_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SENSE_COMP_BW_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn low(self) -> &'a mut W {
        self.variant(SENSE_COMP_BW_A::LOW)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn high(self) -> &'a mut W {
        self.variant(SENSE_COMP_BW_A::HIGH)
    }
    #[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 << 11)) | ((value as u32 & 0x01) << 11);
        self.w
    }
}
#[doc = "Field `SENSE_EN` reader - Enables the sense modulator output. Also turns on the IDAC compensation current as selected by CSD_IDAC."]
pub struct SENSE_EN_R(crate::FieldReader<bool, bool>);
impl SENSE_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        SENSE_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SENSE_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SENSE_EN` writer - Enables the sense modulator output. Also turns on the IDAC compensation current as selected by CSD_IDAC."]
pub struct SENSE_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> SENSE_EN_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 << 12)) | ((value as u32 & 0x01) << 12);
        self.w
    }
}
#[doc = "Field `REFBUF_EN` reader - Enables the reference buffer/comparator circuits for charging Cmod/Csh_tank using the mode selected in COMP_MODE."]
pub struct REFBUF_EN_R(crate::FieldReader<bool, bool>);
impl REFBUF_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        REFBUF_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for REFBUF_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `REFBUF_EN` writer - Enables the reference buffer/comparator circuits for charging Cmod/Csh_tank using the mode selected in COMP_MODE."]
pub struct REFBUF_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> REFBUF_EN_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 << 13)) | ((value as u32 & 0x01) << 13);
        self.w
    }
}
#[doc = "Selects between charging of the Cmod/Csh_tank capacitor using the GPIO digital output buffer or the CSD reference buffer. Note that using the GPIO requires proper configuraiton of the GPIO pin.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP_MODE_A {
    #[doc = "0: No description available"]
    CHARGE_BUF = 0,
    #[doc = "1: No description available"]
    CHARGE_IO = 1,
}
impl From<COMP_MODE_A> for bool {
    #[inline(always)]
    fn from(variant: COMP_MODE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `COMP_MODE` reader - Selects between charging of the Cmod/Csh_tank capacitor using the GPIO digital output buffer or the CSD reference buffer. Note that using the GPIO requires proper configuraiton of the GPIO pin."]
pub struct COMP_MODE_R(crate::FieldReader<bool, COMP_MODE_A>);
impl COMP_MODE_R {
    pub(crate) fn new(bits: bool) -> Self {
        COMP_MODE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> COMP_MODE_A {
        match self.bits {
            false => COMP_MODE_A::CHARGE_BUF,
            true => COMP_MODE_A::CHARGE_IO,
        }
    }
    #[doc = "Checks if the value of the field is `CHARGE_BUF`"]
    #[inline(always)]
    pub fn is_charge_buf(&self) -> bool {
        **self == COMP_MODE_A::CHARGE_BUF
    }
    #[doc = "Checks if the value of the field is `CHARGE_IO`"]
    #[inline(always)]
    pub fn is_charge_io(&self) -> bool {
        **self == COMP_MODE_A::CHARGE_IO
    }
}
impl core::ops::Deref for COMP_MODE_R {
    type Target = crate::FieldReader<bool, COMP_MODE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `COMP_MODE` writer - Selects between charging of the Cmod/Csh_tank capacitor using the GPIO digital output buffer or the CSD reference buffer. Note that using the GPIO requires proper configuraiton of the GPIO pin."]
pub struct COMP_MODE_W<'a> {
    w: &'a mut W,
}
impl<'a> COMP_MODE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: COMP_MODE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn charge_buf(self) -> &'a mut W {
        self.variant(COMP_MODE_A::CHARGE_BUF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn charge_io(self) -> &'a mut W {
        self.variant(COMP_MODE_A::CHARGE_IO)
    }
    #[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 << 14)) | ((value as u32 & 0x01) << 14);
        self.w
    }
}
#[doc = "Connects either the Cmod or Csh_tank sense return line to the reference buffer comparator. This switch must be set to the same pin that is being charged up by the reference buffer (through the AMUXBUS settings in GPIO).\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COMP_PIN_A {
    #[doc = "0: No description available"]
    CHANNEL1 = 0,
    #[doc = "1: No description available"]
    CHANNEL2 = 1,
}
impl From<COMP_PIN_A> for bool {
    #[inline(always)]
    fn from(variant: COMP_PIN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `COMP_PIN` reader - Connects either the Cmod or Csh_tank sense return line to the reference buffer comparator. This switch must be set to the same pin that is being charged up by the reference buffer (through the AMUXBUS settings in GPIO)."]
pub struct COMP_PIN_R(crate::FieldReader<bool, COMP_PIN_A>);
impl COMP_PIN_R {
    pub(crate) fn new(bits: bool) -> Self {
        COMP_PIN_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> COMP_PIN_A {
        match self.bits {
            false => COMP_PIN_A::CHANNEL1,
            true => COMP_PIN_A::CHANNEL2,
        }
    }
    #[doc = "Checks if the value of the field is `CHANNEL1`"]
    #[inline(always)]
    pub fn is_channel1(&self) -> bool {
        **self == COMP_PIN_A::CHANNEL1
    }
    #[doc = "Checks if the value of the field is `CHANNEL2`"]
    #[inline(always)]
    pub fn is_channel2(&self) -> bool {
        **self == COMP_PIN_A::CHANNEL2
    }
}
impl core::ops::Deref for COMP_PIN_R {
    type Target = crate::FieldReader<bool, COMP_PIN_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `COMP_PIN` writer - Connects either the Cmod or Csh_tank sense return line to the reference buffer comparator. This switch must be set to the same pin that is being charged up by the reference buffer (through the AMUXBUS settings in GPIO)."]
pub struct COMP_PIN_W<'a> {
    w: &'a mut W,
}
impl<'a> COMP_PIN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: COMP_PIN_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn channel1(self) -> &'a mut W {
        self.variant(COMP_PIN_A::CHANNEL1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn channel2(self) -> &'a mut W {
        self.variant(COMP_PIN_A::CHANNEL2)
    }
    #[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 << 15)) | ((value as u32 & 0x01) << 15);
        self.w
    }
}
#[doc = "Selects the polarity of the sensing operation. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC1 polarity only.?The IDAC register below provides the same functionality through POLARITY1_MIR bit.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum POLARITY_A {
    #[doc = "0: No description available"]
    VSSIO = 0,
    #[doc = "1: No description available"]
    VDDIO = 1,
}
impl From<POLARITY_A> for bool {
    #[inline(always)]
    fn from(variant: POLARITY_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `POLARITY` reader - Selects the polarity of the sensing operation. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC1 polarity only.?The IDAC register below provides the same functionality through POLARITY1_MIR bit."]
pub struct POLARITY_R(crate::FieldReader<bool, POLARITY_A>);
impl POLARITY_R {
    pub(crate) fn new(bits: bool) -> Self {
        POLARITY_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> POLARITY_A {
        match self.bits {
            false => POLARITY_A::VSSIO,
            true => POLARITY_A::VDDIO,
        }
    }
    #[doc = "Checks if the value of the field is `VSSIO`"]
    #[inline(always)]
    pub fn is_vssio(&self) -> bool {
        **self == POLARITY_A::VSSIO
    }
    #[doc = "Checks if the value of the field is `VDDIO`"]
    #[inline(always)]
    pub fn is_vddio(&self) -> bool {
        **self == POLARITY_A::VDDIO
    }
}
impl core::ops::Deref for POLARITY_R {
    type Target = crate::FieldReader<bool, POLARITY_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `POLARITY` writer - Selects the polarity of the sensing operation. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC1 polarity only.?The IDAC register below provides the same functionality through POLARITY1_MIR bit."]
pub struct POLARITY_W<'a> {
    w: &'a mut W,
}
impl<'a> POLARITY_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: POLARITY_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn vssio(self) -> &'a mut W {
        self.variant(POLARITY_A::VSSIO)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn vddio(self) -> &'a mut W {
        self.variant(POLARITY_A::VDDIO)
    }
    #[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 << 16)) | ((value as u32 & 0x01) << 16);
        self.w
    }
}
#[doc = "For normal CSD operations this field is not used. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC2 polarity only.?The IDAC register below provides the same functionality through POLARITY2_MIR bit.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum POLARITY2_A {
    #[doc = "0: No description available"]
    VSSIO = 0,
    #[doc = "1: No description available"]
    VDDIO = 1,
}
impl From<POLARITY2_A> for bool {
    #[inline(always)]
    fn from(variant: POLARITY2_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `POLARITY2` reader - For normal CSD operations this field is not used. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC2 polarity only.?The IDAC register below provides the same functionality through POLARITY2_MIR bit."]
pub struct POLARITY2_R(crate::FieldReader<bool, POLARITY2_A>);
impl POLARITY2_R {
    pub(crate) fn new(bits: bool) -> Self {
        POLARITY2_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> POLARITY2_A {
        match self.bits {
            false => POLARITY2_A::VSSIO,
            true => POLARITY2_A::VDDIO,
        }
    }
    #[doc = "Checks if the value of the field is `VSSIO`"]
    #[inline(always)]
    pub fn is_vssio(&self) -> bool {
        **self == POLARITY2_A::VSSIO
    }
    #[doc = "Checks if the value of the field is `VDDIO`"]
    #[inline(always)]
    pub fn is_vddio(&self) -> bool {
        **self == POLARITY2_A::VDDIO
    }
}
impl core::ops::Deref for POLARITY2_R {
    type Target = crate::FieldReader<bool, POLARITY2_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `POLARITY2` writer - For normal CSD operations this field is not used. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC2 polarity only.?The IDAC register below provides the same functionality through POLARITY2_MIR bit."]
pub struct POLARITY2_W<'a> {
    w: &'a mut W,
}
impl<'a> POLARITY2_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: POLARITY2_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn vssio(self) -> &'a mut W {
        self.variant(POLARITY2_A::VSSIO)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn vddio(self) -> &'a mut W {
        self.variant(POLARITY2_A::VDDIO)
    }
    #[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 << 17)) | ((value as u32 & 0x01) << 17);
        self.w
    }
}
#[doc = "Enables mutual cap sensing mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MUTUAL_CAP_A {
    #[doc = "0: No description available"]
    SELFCAP = 0,
    #[doc = "1: No description available"]
    MUTUALCAP = 1,
}
impl From<MUTUAL_CAP_A> for bool {
    #[inline(always)]
    fn from(variant: MUTUAL_CAP_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MUTUAL_CAP` reader - Enables mutual cap sensing mode"]
pub struct MUTUAL_CAP_R(crate::FieldReader<bool, MUTUAL_CAP_A>);
impl MUTUAL_CAP_R {
    pub(crate) fn new(bits: bool) -> Self {
        MUTUAL_CAP_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> MUTUAL_CAP_A {
        match self.bits {
            false => MUTUAL_CAP_A::SELFCAP,
            true => MUTUAL_CAP_A::MUTUALCAP,
        }
    }
    #[doc = "Checks if the value of the field is `SELFCAP`"]
    #[inline(always)]
    pub fn is_selfcap(&self) -> bool {
        **self == MUTUAL_CAP_A::SELFCAP
    }
    #[doc = "Checks if the value of the field is `MUTUALCAP`"]
    #[inline(always)]
    pub fn is_mutualcap(&self) -> bool {
        **self == MUTUAL_CAP_A::MUTUALCAP
    }
}
impl core::ops::Deref for MUTUAL_CAP_R {
    type Target = crate::FieldReader<bool, MUTUAL_CAP_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `MUTUAL_CAP` writer - Enables mutual cap sensing mode"]
pub struct MUTUAL_CAP_W<'a> {
    w: &'a mut W,
}
impl<'a> MUTUAL_CAP_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: MUTUAL_CAP_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn selfcap(self) -> &'a mut W {
        self.variant(MUTUAL_CAP_A::SELFCAP)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn mutualcap(self) -> &'a mut W {
        self.variant(MUTUAL_CAP_A::MUTUALCAP)
    }
    #[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 << 18)) | ((value as u32 & 0x01) << 18);
        self.w
    }
}
#[doc = "Field `SENSE_COMP_EN` reader - Turns on the sense comparator circuit. Must be done some time before enable SENSE_EN.?0: Sense comparator is powered off.?1: Sense comparator is powered on."]
pub struct SENSE_COMP_EN_R(crate::FieldReader<bool, bool>);
impl SENSE_COMP_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        SENSE_COMP_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for SENSE_COMP_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SENSE_COMP_EN` writer - Turns on the sense comparator circuit. Must be done some time before enable SENSE_EN.?0: Sense comparator is powered off.?1: Sense comparator is powered on."]
pub struct SENSE_COMP_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> SENSE_COMP_EN_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 << 19)) | ((value as u32 & 0x01) << 19);
        self.w
    }
}
#[doc = "Selects which AMUXBUS the reference buffer connects to.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum REBUF_OUTSEL_A {
    #[doc = "0: No description available"]
    AMUXA = 0,
    #[doc = "1: No description available"]
    AMUXB = 1,
}
impl From<REBUF_OUTSEL_A> for bool {
    #[inline(always)]
    fn from(variant: REBUF_OUTSEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `REBUF_OUTSEL` reader - Selects which AMUXBUS the reference buffer connects to."]
pub struct REBUF_OUTSEL_R(crate::FieldReader<bool, REBUF_OUTSEL_A>);
impl REBUF_OUTSEL_R {
    pub(crate) fn new(bits: bool) -> Self {
        REBUF_OUTSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> REBUF_OUTSEL_A {
        match self.bits {
            false => REBUF_OUTSEL_A::AMUXA,
            true => REBUF_OUTSEL_A::AMUXB,
        }
    }
    #[doc = "Checks if the value of the field is `AMUXA`"]
    #[inline(always)]
    pub fn is_amuxa(&self) -> bool {
        **self == REBUF_OUTSEL_A::AMUXA
    }
    #[doc = "Checks if the value of the field is `AMUXB`"]
    #[inline(always)]
    pub fn is_amuxb(&self) -> bool {
        **self == REBUF_OUTSEL_A::AMUXB
    }
}
impl core::ops::Deref for REBUF_OUTSEL_R {
    type Target = crate::FieldReader<bool, REBUF_OUTSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `REBUF_OUTSEL` writer - Selects which AMUXBUS the reference buffer connects to."]
pub struct REBUF_OUTSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> REBUF_OUTSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: REBUF_OUTSEL_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxa(self) -> &'a mut W {
        self.variant(REBUF_OUTSEL_A::AMUXA)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn amuxb(self) -> &'a mut W {
        self.variant(REBUF_OUTSEL_A::AMUXB)
    }
    #[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 << 21)) | ((value as u32 & 0x01) << 21);
        self.w
    }
}
#[doc = "Selects how to connect the sensing comparator to the Cmod capacitor.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SENSE_INSEL_A {
    #[doc = "0: No description available"]
    SENSE_CHANNEL1 = 0,
    #[doc = "1: No description available"]
    SENSE_AMUXA = 1,
}
impl From<SENSE_INSEL_A> for bool {
    #[inline(always)]
    fn from(variant: SENSE_INSEL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SENSE_INSEL` reader - Selects how to connect the sensing comparator to the Cmod capacitor."]
pub struct SENSE_INSEL_R(crate::FieldReader<bool, SENSE_INSEL_A>);
impl SENSE_INSEL_R {
    pub(crate) fn new(bits: bool) -> Self {
        SENSE_INSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SENSE_INSEL_A {
        match self.bits {
            false => SENSE_INSEL_A::SENSE_CHANNEL1,
            true => SENSE_INSEL_A::SENSE_AMUXA,
        }
    }
    #[doc = "Checks if the value of the field is `SENSE_CHANNEL1`"]
    #[inline(always)]
    pub fn is_sense_channel1(&self) -> bool {
        **self == SENSE_INSEL_A::SENSE_CHANNEL1
    }
    #[doc = "Checks if the value of the field is `SENSE_AMUXA`"]
    #[inline(always)]
    pub fn is_sense_amuxa(&self) -> bool {
        **self == SENSE_INSEL_A::SENSE_AMUXA
    }
}
impl core::ops::Deref for SENSE_INSEL_R {
    type Target = crate::FieldReader<bool, SENSE_INSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SENSE_INSEL` writer - Selects how to connect the sensing comparator to the Cmod capacitor."]
pub struct SENSE_INSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> SENSE_INSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SENSE_INSEL_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sense_channel1(self) -> &'a mut W {
        self.variant(SENSE_INSEL_A::SENSE_CHANNEL1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sense_amuxa(self) -> &'a mut W {
        self.variant(SENSE_INSEL_A::SENSE_AMUXA)
    }
    #[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 << 22)) | ((value as u32 & 0x01) << 22);
        self.w
    }
}
#[doc = "Current drive strength for reference buffer.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum REFBUF_DRV_A {
    #[doc = "0: No description available"]
    OFF = 0,
    #[doc = "1: No description available"]
    DRV_1 = 1,
    #[doc = "2: No description available"]
    DRV_2 = 2,
    #[doc = "3: No description available"]
    DRV_3 = 3,
}
impl From<REFBUF_DRV_A> for u8 {
    #[inline(always)]
    fn from(variant: REFBUF_DRV_A) -> Self {
        variant as _
    }
}
#[doc = "Field `REFBUF_DRV` reader - Current drive strength for reference buffer."]
pub struct REFBUF_DRV_R(crate::FieldReader<u8, REFBUF_DRV_A>);
impl REFBUF_DRV_R {
    pub(crate) fn new(bits: u8) -> Self {
        REFBUF_DRV_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> REFBUF_DRV_A {
        match self.bits {
            0 => REFBUF_DRV_A::OFF,
            1 => REFBUF_DRV_A::DRV_1,
            2 => REFBUF_DRV_A::DRV_2,
            3 => REFBUF_DRV_A::DRV_3,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `OFF`"]
    #[inline(always)]
    pub fn is_off(&self) -> bool {
        **self == REFBUF_DRV_A::OFF
    }
    #[doc = "Checks if the value of the field is `DRV_1`"]
    #[inline(always)]
    pub fn is_drv_1(&self) -> bool {
        **self == REFBUF_DRV_A::DRV_1
    }
    #[doc = "Checks if the value of the field is `DRV_2`"]
    #[inline(always)]
    pub fn is_drv_2(&self) -> bool {
        **self == REFBUF_DRV_A::DRV_2
    }
    #[doc = "Checks if the value of the field is `DRV_3`"]
    #[inline(always)]
    pub fn is_drv_3(&self) -> bool {
        **self == REFBUF_DRV_A::DRV_3
    }
}
impl core::ops::Deref for REFBUF_DRV_R {
    type Target = crate::FieldReader<u8, REFBUF_DRV_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `REFBUF_DRV` writer - Current drive strength for reference buffer."]
pub struct REFBUF_DRV_W<'a> {
    w: &'a mut W,
}
impl<'a> REFBUF_DRV_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: REFBUF_DRV_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn off(self) -> &'a mut W {
        self.variant(REFBUF_DRV_A::OFF)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn drv_1(self) -> &'a mut W {
        self.variant(REFBUF_DRV_A::DRV_1)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn drv_2(self) -> &'a mut W {
        self.variant(REFBUF_DRV_A::DRV_2)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn drv_3(self) -> &'a mut W {
        self.variant(REFBUF_DRV_A::DRV_3)
    }
    #[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 << 23)) | ((value as u32 & 0x03) << 23);
        self.w
    }
}
#[doc = "Changes the dsi_sample_out signal from its normal function (sample_out) to a selection of other DDFT signals.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum DDFTSEL_A {
    #[doc = "0: No description available"]
    NORMAL = 0,
    #[doc = "1: No description available"]
    CSD_SENSE = 1,
    #[doc = "2: No description available"]
    CSD_SHIELD = 2,
    #[doc = "3: No description available"]
    CLK_SAMPLE = 3,
    #[doc = "4: No description available"]
    COMP_OUT = 4,
}
impl From<DDFTSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: DDFTSEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `DDFTSEL` reader - Changes the dsi_sample_out signal from its normal function (sample_out) to a selection of other DDFT signals."]
pub struct DDFTSEL_R(crate::FieldReader<u8, DDFTSEL_A>);
impl DDFTSEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        DDFTSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<DDFTSEL_A> {
        match self.bits {
            0 => Some(DDFTSEL_A::NORMAL),
            1 => Some(DDFTSEL_A::CSD_SENSE),
            2 => Some(DDFTSEL_A::CSD_SHIELD),
            3 => Some(DDFTSEL_A::CLK_SAMPLE),
            4 => Some(DDFTSEL_A::COMP_OUT),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `NORMAL`"]
    #[inline(always)]
    pub fn is_normal(&self) -> bool {
        **self == DDFTSEL_A::NORMAL
    }
    #[doc = "Checks if the value of the field is `CSD_SENSE`"]
    #[inline(always)]
    pub fn is_csd_sense(&self) -> bool {
        **self == DDFTSEL_A::CSD_SENSE
    }
    #[doc = "Checks if the value of the field is `CSD_SHIELD`"]
    #[inline(always)]
    pub fn is_csd_shield(&self) -> bool {
        **self == DDFTSEL_A::CSD_SHIELD
    }
    #[doc = "Checks if the value of the field is `CLK_SAMPLE`"]
    #[inline(always)]
    pub fn is_clk_sample(&self) -> bool {
        **self == DDFTSEL_A::CLK_SAMPLE
    }
    #[doc = "Checks if the value of the field is `COMP_OUT`"]
    #[inline(always)]
    pub fn is_comp_out(&self) -> bool {
        **self == DDFTSEL_A::COMP_OUT
    }
}
impl core::ops::Deref for DDFTSEL_R {
    type Target = crate::FieldReader<u8, DDFTSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DDFTSEL` writer - Changes the dsi_sample_out signal from its normal function (sample_out) to a selection of other DDFT signals."]
pub struct DDFTSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> DDFTSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DDFTSEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn normal(self) -> &'a mut W {
        self.variant(DDFTSEL_A::NORMAL)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn csd_sense(self) -> &'a mut W {
        self.variant(DDFTSEL_A::CSD_SENSE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn csd_shield(self) -> &'a mut W {
        self.variant(DDFTSEL_A::CSD_SHIELD)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn clk_sample(self) -> &'a mut W {
        self.variant(DDFTSEL_A::CLK_SAMPLE)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn comp_out(self) -> &'a mut W {
        self.variant(DDFTSEL_A::COMP_OUT)
    }
    #[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 << 26)) | ((value as u32 & 0x07) << 26);
        self.w
    }
}
#[doc = "Field `ADFTEN` reader - When selected, convert IDAC1/2 outputs from current to voltage before sending to AMUXBUS-A/B. IDAC1/2 output currents and connectivity are determined by other CSD_CONFIG/CSD_IDAC settings same as in normal mode."]
pub struct ADFTEN_R(crate::FieldReader<bool, bool>);
impl ADFTEN_R {
    pub(crate) fn new(bits: bool) -> Self {
        ADFTEN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for ADFTEN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `ADFTEN` writer - When selected, convert IDAC1/2 outputs from current to voltage before sending to AMUXBUS-A/B. IDAC1/2 output currents and connectivity are determined by other CSD_CONFIG/CSD_IDAC settings same as in normal mode."]
pub struct ADFTEN_W<'a> {
    w: &'a mut W,
}
impl<'a> ADFTEN_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 << 29)) | ((value as u32 & 0x01) << 29);
        self.w
    }
}
#[doc = "Changes comp_out signal for DFT purpose only. This signal can be routed to pins or other destinations using DDFTSEL\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DDFTCOMP_A {
    #[doc = "0: No description available"]
    REFBUFCOMP = 0,
    #[doc = "1: No description available"]
    SENSECOMP = 1,
}
impl From<DDFTCOMP_A> for bool {
    #[inline(always)]
    fn from(variant: DDFTCOMP_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `DDFTCOMP` reader - Changes comp_out signal for DFT purpose only. This signal can be routed to pins or other destinations using DDFTSEL"]
pub struct DDFTCOMP_R(crate::FieldReader<bool, DDFTCOMP_A>);
impl DDFTCOMP_R {
    pub(crate) fn new(bits: bool) -> Self {
        DDFTCOMP_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DDFTCOMP_A {
        match self.bits {
            false => DDFTCOMP_A::REFBUFCOMP,
            true => DDFTCOMP_A::SENSECOMP,
        }
    }
    #[doc = "Checks if the value of the field is `REFBUFCOMP`"]
    #[inline(always)]
    pub fn is_refbufcomp(&self) -> bool {
        **self == DDFTCOMP_A::REFBUFCOMP
    }
    #[doc = "Checks if the value of the field is `SENSECOMP`"]
    #[inline(always)]
    pub fn is_sensecomp(&self) -> bool {
        **self == DDFTCOMP_A::SENSECOMP
    }
}
impl core::ops::Deref for DDFTCOMP_R {
    type Target = crate::FieldReader<bool, DDFTCOMP_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `DDFTCOMP` writer - Changes comp_out signal for DFT purpose only. This signal can be routed to pins or other destinations using DDFTSEL"]
pub struct DDFTCOMP_W<'a> {
    w: &'a mut W,
}
impl<'a> DDFTCOMP_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DDFTCOMP_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn refbufcomp(self) -> &'a mut W {
        self.variant(DDFTCOMP_A::REFBUFCOMP)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sensecomp(self) -> &'a mut W {
        self.variant(DDFTCOMP_A::SENSECOMP)
    }
    #[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 << 30)) | ((value as u32 & 0x01) << 30);
        self.w
    }
}
#[doc = "Field `ENABLE` reader - Master enable of the CSD IP. Must be set to 1 for any CSD operation to function."]
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 - Master enable of the CSD IP. Must be set to 1 for any CSD operation to function."]
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 = "Bit 0 - Enables the use of the dsi_sample_in input instead of the comparator output to strobe COUNTER."]
    #[inline(always)]
    pub fn dsi_sample_en(&self) -> DSI_SAMPLE_EN_R {
        DSI_SAMPLE_EN_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - Enables double synchronizing of sample input from DSI (only relevant when DSI_SAMPLE_EN=1)."]
    #[inline(always)]
    pub fn sample_sync(&self) -> SAMPLE_SYNC_R {
        SAMPLE_SYNC_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Selects whether to use CSD1 clock for modulation directly, or use PRS/Divide-by-2 modulation (default)."]
    #[inline(always)]
    pub fn bypass_sel(&self) -> BYPASS_SEL_R {
        BYPASS_SEL_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 3 - Enables the digital filter on the CSD comparator."]
    #[inline(always)]
    pub fn filter_enable(&self) -> FILTER_ENABLE_R {
        FILTER_ENABLE_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 4 - Enables dual cap mode when MUTUAL_CAP=1, do not use when MUTUAL_CAP=0"]
    #[inline(always)]
    pub fn dual_cap_en(&self) -> DUAL_CAP_EN_R {
        DUAL_CAP_EN_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 6 - Selects between PRS or simple divide by 2 sense modulation."]
    #[inline(always)]
    pub fn prs_select(&self) -> PRS_SELECT_R {
        PRS_SELECT_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 7 - Selects between 8 or 12b PRS sequence"]
    #[inline(always)]
    pub fn prs_12_8(&self) -> PRS_12_8_R {
        PRS_12_8_R::new(((self.bits >> 7) & 0x01) != 0)
    }
    #[doc = "Bit 8 - Enables the use of the dsi_sense_in input instead of the internally generated modulation signal to drive csd_sense and csd_shield signals."]
    #[inline(always)]
    pub fn dsi_sense_en(&self) -> DSI_SENSE_EN_R {
        DSI_SENSE_EN_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bits 9:10 - Selects the delay by which csd_shield is delayed relative to csd_sense."]
    #[inline(always)]
    pub fn shield_delay(&self) -> SHIELD_DELAY_R {
        SHIELD_DELAY_R::new(((self.bits >> 9) & 0x03) as u8)
    }
    #[doc = "Bit 11 - Selects bandwidth for sensing comparator"]
    #[inline(always)]
    pub fn sense_comp_bw(&self) -> SENSE_COMP_BW_R {
        SENSE_COMP_BW_R::new(((self.bits >> 11) & 0x01) != 0)
    }
    #[doc = "Bit 12 - Enables the sense modulator output. Also turns on the IDAC compensation current as selected by CSD_IDAC."]
    #[inline(always)]
    pub fn sense_en(&self) -> SENSE_EN_R {
        SENSE_EN_R::new(((self.bits >> 12) & 0x01) != 0)
    }
    #[doc = "Bit 13 - Enables the reference buffer/comparator circuits for charging Cmod/Csh_tank using the mode selected in COMP_MODE."]
    #[inline(always)]
    pub fn refbuf_en(&self) -> REFBUF_EN_R {
        REFBUF_EN_R::new(((self.bits >> 13) & 0x01) != 0)
    }
    #[doc = "Bit 14 - Selects between charging of the Cmod/Csh_tank capacitor using the GPIO digital output buffer or the CSD reference buffer. Note that using the GPIO requires proper configuraiton of the GPIO pin."]
    #[inline(always)]
    pub fn comp_mode(&self) -> COMP_MODE_R {
        COMP_MODE_R::new(((self.bits >> 14) & 0x01) != 0)
    }
    #[doc = "Bit 15 - Connects either the Cmod or Csh_tank sense return line to the reference buffer comparator. This switch must be set to the same pin that is being charged up by the reference buffer (through the AMUXBUS settings in GPIO)."]
    #[inline(always)]
    pub fn comp_pin(&self) -> COMP_PIN_R {
        COMP_PIN_R::new(((self.bits >> 15) & 0x01) != 0)
    }
    #[doc = "Bit 16 - Selects the polarity of the sensing operation. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC1 polarity only.?The IDAC register below provides the same functionality through POLARITY1_MIR bit."]
    #[inline(always)]
    pub fn polarity(&self) -> POLARITY_R {
        POLARITY_R::new(((self.bits >> 16) & 0x01) != 0)
    }
    #[doc = "Bit 17 - For normal CSD operations this field is not used. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC2 polarity only.?The IDAC register below provides the same functionality through POLARITY2_MIR bit."]
    #[inline(always)]
    pub fn polarity2(&self) -> POLARITY2_R {
        POLARITY2_R::new(((self.bits >> 17) & 0x01) != 0)
    }
    #[doc = "Bit 18 - Enables mutual cap sensing mode"]
    #[inline(always)]
    pub fn mutual_cap(&self) -> MUTUAL_CAP_R {
        MUTUAL_CAP_R::new(((self.bits >> 18) & 0x01) != 0)
    }
    #[doc = "Bit 19 - Turns on the sense comparator circuit. Must be done some time before enable SENSE_EN.?0: Sense comparator is powered off.?1: Sense comparator is powered on."]
    #[inline(always)]
    pub fn sense_comp_en(&self) -> SENSE_COMP_EN_R {
        SENSE_COMP_EN_R::new(((self.bits >> 19) & 0x01) != 0)
    }
    #[doc = "Bit 21 - Selects which AMUXBUS the reference buffer connects to."]
    #[inline(always)]
    pub fn rebuf_outsel(&self) -> REBUF_OUTSEL_R {
        REBUF_OUTSEL_R::new(((self.bits >> 21) & 0x01) != 0)
    }
    #[doc = "Bit 22 - Selects how to connect the sensing comparator to the Cmod capacitor."]
    #[inline(always)]
    pub fn sense_insel(&self) -> SENSE_INSEL_R {
        SENSE_INSEL_R::new(((self.bits >> 22) & 0x01) != 0)
    }
    #[doc = "Bits 23:24 - Current drive strength for reference buffer."]
    #[inline(always)]
    pub fn refbuf_drv(&self) -> REFBUF_DRV_R {
        REFBUF_DRV_R::new(((self.bits >> 23) & 0x03) as u8)
    }
    #[doc = "Bits 26:28 - Changes the dsi_sample_out signal from its normal function (sample_out) to a selection of other DDFT signals."]
    #[inline(always)]
    pub fn ddftsel(&self) -> DDFTSEL_R {
        DDFTSEL_R::new(((self.bits >> 26) & 0x07) as u8)
    }
    #[doc = "Bit 29 - When selected, convert IDAC1/2 outputs from current to voltage before sending to AMUXBUS-A/B. IDAC1/2 output currents and connectivity are determined by other CSD_CONFIG/CSD_IDAC settings same as in normal mode."]
    #[inline(always)]
    pub fn adften(&self) -> ADFTEN_R {
        ADFTEN_R::new(((self.bits >> 29) & 0x01) != 0)
    }
    #[doc = "Bit 30 - Changes comp_out signal for DFT purpose only. This signal can be routed to pins or other destinations using DDFTSEL"]
    #[inline(always)]
    pub fn ddftcomp(&self) -> DDFTCOMP_R {
        DDFTCOMP_R::new(((self.bits >> 30) & 0x01) != 0)
    }
    #[doc = "Bit 31 - Master enable of the CSD IP. Must be set to 1 for any CSD operation to function."]
    #[inline(always)]
    pub fn enable(&self) -> ENABLE_R {
        ENABLE_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Enables the use of the dsi_sample_in input instead of the comparator output to strobe COUNTER."]
    #[inline(always)]
    pub fn dsi_sample_en(&mut self) -> DSI_SAMPLE_EN_W {
        DSI_SAMPLE_EN_W { w: self }
    }
    #[doc = "Bit 1 - Enables double synchronizing of sample input from DSI (only relevant when DSI_SAMPLE_EN=1)."]
    #[inline(always)]
    pub fn sample_sync(&mut self) -> SAMPLE_SYNC_W {
        SAMPLE_SYNC_W { w: self }
    }
    #[doc = "Bit 2 - Selects whether to use CSD1 clock for modulation directly, or use PRS/Divide-by-2 modulation (default)."]
    #[inline(always)]
    pub fn bypass_sel(&mut self) -> BYPASS_SEL_W {
        BYPASS_SEL_W { w: self }
    }
    #[doc = "Bit 3 - Enables the digital filter on the CSD comparator."]
    #[inline(always)]
    pub fn filter_enable(&mut self) -> FILTER_ENABLE_W {
        FILTER_ENABLE_W { w: self }
    }
    #[doc = "Bit 4 - Enables dual cap mode when MUTUAL_CAP=1, do not use when MUTUAL_CAP=0"]
    #[inline(always)]
    pub fn dual_cap_en(&mut self) -> DUAL_CAP_EN_W {
        DUAL_CAP_EN_W { w: self }
    }
    #[doc = "Bit 5 - When set, forces the pseudo-random generator to it's initial state. Note that it may take some time for this setting to take effect depending on the clock frequency used for clk_csd1. Hardware clears this bit at the same time PRS is cleared."]
    #[inline(always)]
    pub fn prs_clear(&mut self) -> PRS_CLEAR_W {
        PRS_CLEAR_W { w: self }
    }
    #[doc = "Bit 6 - Selects between PRS or simple divide by 2 sense modulation."]
    #[inline(always)]
    pub fn prs_select(&mut self) -> PRS_SELECT_W {
        PRS_SELECT_W { w: self }
    }
    #[doc = "Bit 7 - Selects between 8 or 12b PRS sequence"]
    #[inline(always)]
    pub fn prs_12_8(&mut self) -> PRS_12_8_W {
        PRS_12_8_W { w: self }
    }
    #[doc = "Bit 8 - Enables the use of the dsi_sense_in input instead of the internally generated modulation signal to drive csd_sense and csd_shield signals."]
    #[inline(always)]
    pub fn dsi_sense_en(&mut self) -> DSI_SENSE_EN_W {
        DSI_SENSE_EN_W { w: self }
    }
    #[doc = "Bits 9:10 - Selects the delay by which csd_shield is delayed relative to csd_sense."]
    #[inline(always)]
    pub fn shield_delay(&mut self) -> SHIELD_DELAY_W {
        SHIELD_DELAY_W { w: self }
    }
    #[doc = "Bit 11 - Selects bandwidth for sensing comparator"]
    #[inline(always)]
    pub fn sense_comp_bw(&mut self) -> SENSE_COMP_BW_W {
        SENSE_COMP_BW_W { w: self }
    }
    #[doc = "Bit 12 - Enables the sense modulator output. Also turns on the IDAC compensation current as selected by CSD_IDAC."]
    #[inline(always)]
    pub fn sense_en(&mut self) -> SENSE_EN_W {
        SENSE_EN_W { w: self }
    }
    #[doc = "Bit 13 - Enables the reference buffer/comparator circuits for charging Cmod/Csh_tank using the mode selected in COMP_MODE."]
    #[inline(always)]
    pub fn refbuf_en(&mut self) -> REFBUF_EN_W {
        REFBUF_EN_W { w: self }
    }
    #[doc = "Bit 14 - Selects between charging of the Cmod/Csh_tank capacitor using the GPIO digital output buffer or the CSD reference buffer. Note that using the GPIO requires proper configuraiton of the GPIO pin."]
    #[inline(always)]
    pub fn comp_mode(&mut self) -> COMP_MODE_W {
        COMP_MODE_W { w: self }
    }
    #[doc = "Bit 15 - Connects either the Cmod or Csh_tank sense return line to the reference buffer comparator. This switch must be set to the same pin that is being charged up by the reference buffer (through the AMUXBUS settings in GPIO)."]
    #[inline(always)]
    pub fn comp_pin(&mut self) -> COMP_PIN_W {
        COMP_PIN_W { w: self }
    }
    #[doc = "Bit 16 - Selects the polarity of the sensing operation. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC1 polarity only.?The IDAC register below provides the same functionality through POLARITY1_MIR bit."]
    #[inline(always)]
    pub fn polarity(&mut self) -> POLARITY_W {
        POLARITY_W { w: self }
    }
    #[doc = "Bit 17 - For normal CSD operations this field is not used. When using the IDAC's for other-than-CSD purposes, this bit controls the IDAC2 polarity only.?The IDAC register below provides the same functionality through POLARITY2_MIR bit."]
    #[inline(always)]
    pub fn polarity2(&mut self) -> POLARITY2_W {
        POLARITY2_W { w: self }
    }
    #[doc = "Bit 18 - Enables mutual cap sensing mode"]
    #[inline(always)]
    pub fn mutual_cap(&mut self) -> MUTUAL_CAP_W {
        MUTUAL_CAP_W { w: self }
    }
    #[doc = "Bit 19 - Turns on the sense comparator circuit. Must be done some time before enable SENSE_EN.?0: Sense comparator is powered off.?1: Sense comparator is powered on."]
    #[inline(always)]
    pub fn sense_comp_en(&mut self) -> SENSE_COMP_EN_W {
        SENSE_COMP_EN_W { w: self }
    }
    #[doc = "Bit 21 - Selects which AMUXBUS the reference buffer connects to."]
    #[inline(always)]
    pub fn rebuf_outsel(&mut self) -> REBUF_OUTSEL_W {
        REBUF_OUTSEL_W { w: self }
    }
    #[doc = "Bit 22 - Selects how to connect the sensing comparator to the Cmod capacitor."]
    #[inline(always)]
    pub fn sense_insel(&mut self) -> SENSE_INSEL_W {
        SENSE_INSEL_W { w: self }
    }
    #[doc = "Bits 23:24 - Current drive strength for reference buffer."]
    #[inline(always)]
    pub fn refbuf_drv(&mut self) -> REFBUF_DRV_W {
        REFBUF_DRV_W { w: self }
    }
    #[doc = "Bits 26:28 - Changes the dsi_sample_out signal from its normal function (sample_out) to a selection of other DDFT signals."]
    #[inline(always)]
    pub fn ddftsel(&mut self) -> DDFTSEL_W {
        DDFTSEL_W { w: self }
    }
    #[doc = "Bit 29 - When selected, convert IDAC1/2 outputs from current to voltage before sending to AMUXBUS-A/B. IDAC1/2 output currents and connectivity are determined by other CSD_CONFIG/CSD_IDAC settings same as in normal mode."]
    #[inline(always)]
    pub fn adften(&mut self) -> ADFTEN_W {
        ADFTEN_W { w: self }
    }
    #[doc = "Bit 30 - Changes comp_out signal for DFT purpose only. This signal can be routed to pins or other destinations using DDFTSEL"]
    #[inline(always)]
    pub fn ddftcomp(&mut self) -> DDFTCOMP_W {
        DDFTCOMP_W { w: self }
    }
    #[doc = "Bit 31 - Master enable of the CSD IP. Must be set to 1 for any CSD operation to function."]
    #[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 = "Configuration and 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 [config](index.html) module"]
pub struct CONFIG_SPEC;
impl crate::RegisterSpec for CONFIG_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [config::R](R) reader structure"]
impl crate::Readable for CONFIG_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
impl crate::Writable for CONFIG_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CONFIG to value 0"]
impl crate::Resettable for CONFIG_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
