#[doc = "Register `PWR_VMON_CONFIG` reader"]
pub struct R(crate::R<PWR_VMON_CONFIG_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<PWR_VMON_CONFIG_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<PWR_VMON_CONFIG_SPEC>> for R {
    fn from(reader: crate::R<PWR_VMON_CONFIG_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `PWR_VMON_CONFIG` writer"]
pub struct W(crate::W<PWR_VMON_CONFIG_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<PWR_VMON_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<PWR_VMON_CONFIG_SPEC>> for W {
    fn from(writer: crate::W<PWR_VMON_CONFIG_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `LVD_EN` reader - Enable Low Voltage Detect circuit."]
pub struct LVD_EN_R(crate::FieldReader<bool, bool>);
impl LVD_EN_R {
    pub(crate) fn new(bits: bool) -> Self {
        LVD_EN_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LVD_EN_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LVD_EN` writer - Enable Low Voltage Detect circuit."]
pub struct LVD_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> LVD_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 `LVD_SEL` reader - Threshold selection for Low Voltage Detect circuit. Disable the LVD (LVD_EN=0) before changing the threshold. Threshold variation is +/- 2.5% from these typical voltage choices:?0: 1.7500 V?1: 1.8000 V?2: 1.9000 V?3: 2.0000 V?4: 2.1000 V?5: 2.2000 V?6: 2.3000 V?7: 2.4000 V?8: 2.5000 V?9: 2.6000 V?10: 2.7000 V?11: 2.8000 V?12: 2.9000 V?13: 3.0000 V?14: 3.2000 V?15: 4.5000 V"]
pub struct LVD_SEL_R(crate::FieldReader<u8, u8>);
impl LVD_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        LVD_SEL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for LVD_SEL_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `LVD_SEL` writer - Threshold selection for Low Voltage Detect circuit. Disable the LVD (LVD_EN=0) before changing the threshold. Threshold variation is +/- 2.5% from these typical voltage choices:?0: 1.7500 V?1: 1.8000 V?2: 1.9000 V?3: 2.0000 V?4: 2.1000 V?5: 2.2000 V?6: 2.3000 V?7: 2.4000 V?8: 2.5000 V?9: 2.6000 V?10: 2.7000 V?11: 2.8000 V?12: 2.9000 V?13: 3.0000 V?14: 3.2000 V?15: 4.5000 V"]
pub struct LVD_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> LVD_SEL_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x0f << 1)) | ((value as u32 & 0x0f) << 1);
        self.w
    }
}
#[doc = "Field `VMON_DDFT_SEL` reader - DDFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: 0?1: pbod_out?2: Pulse Strecher output of pbod Monitor?3: hvpbod_out?4: Pulse Strecher output of hvpbod Monitor?5: lvi_out?6: Pulse Strecher output of lvi Monitor?7: 0"]
pub struct VMON_DDFT_SEL_R(crate::FieldReader<u8, u8>);
impl VMON_DDFT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        VMON_DDFT_SEL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VMON_DDFT_SEL_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VMON_DDFT_SEL` writer - DDFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: 0?1: pbod_out?2: Pulse Strecher output of pbod Monitor?3: hvpbod_out?4: Pulse Strecher output of hvpbod Monitor?5: lvi_out?6: Pulse Strecher output of lvi Monitor?7: 0"]
pub struct VMON_DDFT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> VMON_DDFT_SEL_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x07 << 5)) | ((value as u32 & 0x07) << 5);
        self.w
    }
}
#[doc = "Field `VMON_ADFT_SEL` reader - ADFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: Hi-Z?1: Comparator Input of pbod Monitor?2: Comparator Input of hvpbod Monitor?3: Comparator Input of lvi Monitor"]
pub struct VMON_ADFT_SEL_R(crate::FieldReader<u8, u8>);
impl VMON_ADFT_SEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        VMON_ADFT_SEL_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VMON_ADFT_SEL_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VMON_ADFT_SEL` writer - ADFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: Hi-Z?1: Comparator Input of pbod Monitor?2: Comparator Input of hvpbod Monitor?3: Comparator Input of lvi Monitor"]
pub struct VMON_ADFT_SEL_W<'a> {
    w: &'a mut W,
}
impl<'a> VMON_ADFT_SEL_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - Enable Low Voltage Detect circuit."]
    #[inline(always)]
    pub fn lvd_en(&self) -> LVD_EN_R {
        LVD_EN_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bits 1:4 - Threshold selection for Low Voltage Detect circuit. Disable the LVD (LVD_EN=0) before changing the threshold. Threshold variation is +/- 2.5% from these typical voltage choices:?0: 1.7500 V?1: 1.8000 V?2: 1.9000 V?3: 2.0000 V?4: 2.1000 V?5: 2.2000 V?6: 2.3000 V?7: 2.4000 V?8: 2.5000 V?9: 2.6000 V?10: 2.7000 V?11: 2.8000 V?12: 2.9000 V?13: 3.0000 V?14: 3.2000 V?15: 4.5000 V"]
    #[inline(always)]
    pub fn lvd_sel(&self) -> LVD_SEL_R {
        LVD_SEL_R::new(((self.bits >> 1) & 0x0f) as u8)
    }
    #[doc = "Bits 5:7 - DDFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: 0?1: pbod_out?2: Pulse Strecher output of pbod Monitor?3: hvpbod_out?4: Pulse Strecher output of hvpbod Monitor?5: lvi_out?6: Pulse Strecher output of lvi Monitor?7: 0"]
    #[inline(always)]
    pub fn vmon_ddft_sel(&self) -> VMON_DDFT_SEL_R {
        VMON_DDFT_SEL_R::new(((self.bits >> 5) & 0x07) as u8)
    }
    #[doc = "Bits 8:9 - ADFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: Hi-Z?1: Comparator Input of pbod Monitor?2: Comparator Input of hvpbod Monitor?3: Comparator Input of lvi Monitor"]
    #[inline(always)]
    pub fn vmon_adft_sel(&self) -> VMON_ADFT_SEL_R {
        VMON_ADFT_SEL_R::new(((self.bits >> 8) & 0x03) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Enable Low Voltage Detect circuit."]
    #[inline(always)]
    pub fn lvd_en(&mut self) -> LVD_EN_W {
        LVD_EN_W { w: self }
    }
    #[doc = "Bits 1:4 - Threshold selection for Low Voltage Detect circuit. Disable the LVD (LVD_EN=0) before changing the threshold. Threshold variation is +/- 2.5% from these typical voltage choices:?0: 1.7500 V?1: 1.8000 V?2: 1.9000 V?3: 2.0000 V?4: 2.1000 V?5: 2.2000 V?6: 2.3000 V?7: 2.4000 V?8: 2.5000 V?9: 2.6000 V?10: 2.7000 V?11: 2.8000 V?12: 2.9000 V?13: 3.0000 V?14: 3.2000 V?15: 4.5000 V"]
    #[inline(always)]
    pub fn lvd_sel(&mut self) -> LVD_SEL_W {
        LVD_SEL_W { w: self }
    }
    #[doc = "Bits 5:7 - DDFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: 0?1: pbod_out?2: Pulse Strecher output of pbod Monitor?3: hvpbod_out?4: Pulse Strecher output of hvpbod Monitor?5: lvi_out?6: Pulse Strecher output of lvi Monitor?7: 0"]
    #[inline(always)]
    pub fn vmon_ddft_sel(&mut self) -> VMON_DDFT_SEL_W {
        VMON_DDFT_SEL_W { w: self }
    }
    #[doc = "Bits 8:9 - ADFT mux select for HVPOR, PBOD, and LVD circuits (engineering only). Selects a signal to output on adft_vmon?0: Hi-Z?1: Comparator Input of pbod Monitor?2: Comparator Input of hvpbod Monitor?3: Comparator Input of lvi Monitor"]
    #[inline(always)]
    pub fn vmon_adft_sel(&mut self) -> VMON_ADFT_SEL_W {
        VMON_ADFT_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 = "Voltage Monitoring Trim and Configuration\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 [pwr_vmon_config](index.html) module"]
pub struct PWR_VMON_CONFIG_SPEC;
impl crate::RegisterSpec for PWR_VMON_CONFIG_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [pwr_vmon_config::R](R) reader structure"]
impl crate::Readable for PWR_VMON_CONFIG_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [pwr_vmon_config::W](W) writer structure"]
impl crate::Writable for PWR_VMON_CONFIG_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets PWR_VMON_CONFIG to value 0"]
impl crate::Resettable for PWR_VMON_CONFIG_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
