#[doc = "Register `CLK_ILO_CONFIG` reader"]
pub struct R(crate::R<CLK_ILO_CONFIG_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CLK_ILO_CONFIG_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CLK_ILO_CONFIG_SPEC>> for R {
    fn from(reader: crate::R<CLK_ILO_CONFIG_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CLK_ILO_CONFIG` writer"]
pub struct W(crate::W<CLK_ILO_CONFIG_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CLK_ILO_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<CLK_ILO_CONFIG_SPEC>> for W {
    fn from(writer: crate::W<CLK_ILO_CONFIG_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Power down mode. Note: this bit must always be set to 0 and never changed. Behavior is undefined when set to 1.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PD_MODE_A {
    #[doc = "0: No description available"]
    SLEEP = 0,
    #[doc = "1: No description available"]
    COMA = 1,
}
impl From<PD_MODE_A> for bool {
    #[inline(always)]
    fn from(variant: PD_MODE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `PD_MODE` reader - Power down mode. Note: this bit must always be set to 0 and never changed. Behavior is undefined when set to 1."]
pub struct PD_MODE_R(crate::FieldReader<bool, PD_MODE_A>);
impl PD_MODE_R {
    pub(crate) fn new(bits: bool) -> Self {
        PD_MODE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PD_MODE_A {
        match self.bits {
            false => PD_MODE_A::SLEEP,
            true => PD_MODE_A::COMA,
        }
    }
    #[doc = "Checks if the value of the field is `SLEEP`"]
    #[inline(always)]
    pub fn is_sleep(&self) -> bool {
        **self == PD_MODE_A::SLEEP
    }
    #[doc = "Checks if the value of the field is `COMA`"]
    #[inline(always)]
    pub fn is_coma(&self) -> bool {
        **self == PD_MODE_A::COMA
    }
}
impl core::ops::Deref for PD_MODE_R {
    type Target = crate::FieldReader<bool, PD_MODE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `PD_MODE` writer - Power down mode. Note: this bit must always be set to 0 and never changed. Behavior is undefined when set to 1."]
pub struct PD_MODE_W<'a> {
    w: &'a mut W,
}
impl<'a> PD_MODE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PD_MODE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn sleep(self) -> &'a mut W {
        self.variant(PD_MODE_A::SLEEP)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn coma(self) -> &'a mut W {
        self.variant(PD_MODE_A::COMA)
    }
    #[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 `TURBO` reader - Turbo mode for faster startup from coma power down. Leave this bit at the default setting for normal operation. Engineering only.?0: turbo disabled?1: turbo enabled"]
pub struct TURBO_R(crate::FieldReader<bool, bool>);
impl TURBO_R {
    pub(crate) fn new(bits: bool) -> Self {
        TURBO_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for TURBO_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `TURBO` writer - Turbo mode for faster startup from coma power down. Leave this bit at the default setting for normal operation. Engineering only.?0: turbo disabled?1: turbo enabled"]
pub struct TURBO_W<'a> {
    w: &'a mut W,
}
impl<'a> TURBO_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 = "PFET bias. Leave this bit at the default setting for normal operation. Engineering only.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SATBIAS_A {
    #[doc = "0: No description available"]
    SATURATED = 0,
    #[doc = "1: No description available"]
    SUBTHRESHOLD = 1,
}
impl From<SATBIAS_A> for bool {
    #[inline(always)]
    fn from(variant: SATBIAS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SATBIAS` reader - PFET bias. Leave this bit at the default setting for normal operation. Engineering only."]
pub struct SATBIAS_R(crate::FieldReader<bool, SATBIAS_A>);
impl SATBIAS_R {
    pub(crate) fn new(bits: bool) -> Self {
        SATBIAS_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> SATBIAS_A {
        match self.bits {
            false => SATBIAS_A::SATURATED,
            true => SATBIAS_A::SUBTHRESHOLD,
        }
    }
    #[doc = "Checks if the value of the field is `SATURATED`"]
    #[inline(always)]
    pub fn is_saturated(&self) -> bool {
        **self == SATBIAS_A::SATURATED
    }
    #[doc = "Checks if the value of the field is `SUBTHRESHOLD`"]
    #[inline(always)]
    pub fn is_subthreshold(&self) -> bool {
        **self == SATBIAS_A::SUBTHRESHOLD
    }
}
impl core::ops::Deref for SATBIAS_R {
    type Target = crate::FieldReader<bool, SATBIAS_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `SATBIAS` writer - PFET bias. Leave this bit at the default setting for normal operation. Engineering only."]
pub struct SATBIAS_W<'a> {
    w: &'a mut W,
}
impl<'a> SATBIAS_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SATBIAS_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn saturated(self) -> &'a mut W {
        self.variant(SATBIAS_A::SATURATED)
    }
    #[doc = "No description available"]
    #[inline(always)]
    pub fn subthreshold(self) -> &'a mut W {
        self.variant(SATBIAS_A::SUBTHRESHOLD)
    }
    #[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 = "Field `ENABLE` reader - Master enable for ILO oscillator"]
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 for ILO oscillator"]
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 - Power down mode. Note: this bit must always be set to 0 and never changed. Behavior is undefined when set to 1."]
    #[inline(always)]
    pub fn pd_mode(&self) -> PD_MODE_R {
        PD_MODE_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 1 - Turbo mode for faster startup from coma power down. Leave this bit at the default setting for normal operation. Engineering only.?0: turbo disabled?1: turbo enabled"]
    #[inline(always)]
    pub fn turbo(&self) -> TURBO_R {
        TURBO_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 2 - PFET bias. Leave this bit at the default setting for normal operation. Engineering only."]
    #[inline(always)]
    pub fn satbias(&self) -> SATBIAS_R {
        SATBIAS_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 31 - Master enable for ILO oscillator"]
    #[inline(always)]
    pub fn enable(&self) -> ENABLE_R {
        ENABLE_R::new(((self.bits >> 31) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Power down mode. Note: this bit must always be set to 0 and never changed. Behavior is undefined when set to 1."]
    #[inline(always)]
    pub fn pd_mode(&mut self) -> PD_MODE_W {
        PD_MODE_W { w: self }
    }
    #[doc = "Bit 1 - Turbo mode for faster startup from coma power down. Leave this bit at the default setting for normal operation. Engineering only.?0: turbo disabled?1: turbo enabled"]
    #[inline(always)]
    pub fn turbo(&mut self) -> TURBO_W {
        TURBO_W { w: self }
    }
    #[doc = "Bit 2 - PFET bias. Leave this bit at the default setting for normal operation. Engineering only."]
    #[inline(always)]
    pub fn satbias(&mut self) -> SATBIAS_W {
        SATBIAS_W { w: self }
    }
    #[doc = "Bit 31 - Master enable for ILO oscillator"]
    #[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 = "ILO 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 [clk_ilo_config](index.html) module"]
pub struct CLK_ILO_CONFIG_SPEC;
impl crate::RegisterSpec for CLK_ILO_CONFIG_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [clk_ilo_config::R](R) reader structure"]
impl crate::Readable for CLK_ILO_CONFIG_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [clk_ilo_config::W](W) writer structure"]
impl crate::Writable for CLK_ILO_CONFIG_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CLK_ILO_CONFIG to value 0"]
impl crate::Resettable for CLK_ILO_CONFIG_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
