#[doc = "Register `ALT_P_VCTAT` reader"]
pub struct R(crate::R<ALT_P_VCTAT_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<ALT_P_VCTAT_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<ALT_P_VCTAT_SPEC>> for R {
    fn from(reader: crate::R<ALT_P_VCTAT_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `ALT_P_VCTAT` writer"]
pub struct W(crate::W<ALT_P_VCTAT_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<ALT_P_VCTAT_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<ALT_P_VCTAT_SPEC>> for W {
    fn from(writer: crate::W<ALT_P_VCTAT_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `VCTAT_SLOPE` reader - Output slope setting controls. The slope of the voltage with temperature varies from ~0% to ~15% from the value at 55C over the temperature range -40C to 150C based on control signal settings 0 to 15"]
pub struct VCTAT_SLOPE_R(crate::FieldReader<u8, u8>);
impl VCTAT_SLOPE_R {
    pub(crate) fn new(bits: u8) -> Self {
        VCTAT_SLOPE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VCTAT_SLOPE_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VCTAT_SLOPE` writer - Output slope setting controls. The slope of the voltage with temperature varies from ~0% to ~15% from the value at 55C over the temperature range -40C to 150C based on control signal settings 0 to 15"]
pub struct VCTAT_SLOPE_W<'a> {
    w: &'a mut W,
}
impl<'a> VCTAT_SLOPE_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) | (value as u8 & 0x0f);
        self.w
    }
}
#[doc = "Field `VCTAT_VOLTAGE` reader - Output voltage absolute trim"]
pub struct VCTAT_VOLTAGE_R(crate::FieldReader<u8, u8>);
impl VCTAT_VOLTAGE_R {
    pub(crate) fn new(bits: u8) -> Self {
        VCTAT_VOLTAGE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VCTAT_VOLTAGE_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VCTAT_VOLTAGE` writer - Output voltage absolute trim"]
pub struct VCTAT_VOLTAGE_W<'a> {
    w: &'a mut W,
}
impl<'a> VCTAT_VOLTAGE_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 << 4)) | ((value as u8 & 0x03) << 4);
        self.w
    }
}
#[doc = "Field `VCTAT_ENABLE` reader - Enable VCTAT block"]
pub struct VCTAT_ENABLE_R(crate::FieldReader<bool, bool>);
impl VCTAT_ENABLE_R {
    pub(crate) fn new(bits: bool) -> Self {
        VCTAT_ENABLE_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for VCTAT_ENABLE_R {
    type Target = crate::FieldReader<bool, bool>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `VCTAT_ENABLE` writer - Enable VCTAT block"]
pub struct VCTAT_ENABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> VCTAT_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 << 6)) | ((value as u8 & 0x01) << 6);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:3 - Output slope setting controls. The slope of the voltage with temperature varies from ~0% to ~15% from the value at 55C over the temperature range -40C to 150C based on control signal settings 0 to 15"]
    #[inline(always)]
    pub fn vctat_slope(&self) -> VCTAT_SLOPE_R {
        VCTAT_SLOPE_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bits 4:5 - Output voltage absolute trim"]
    #[inline(always)]
    pub fn vctat_voltage(&self) -> VCTAT_VOLTAGE_R {
        VCTAT_VOLTAGE_R::new(((self.bits >> 4) & 0x03) as u8)
    }
    #[doc = "Bit 6 - Enable VCTAT block"]
    #[inline(always)]
    pub fn vctat_enable(&self) -> VCTAT_ENABLE_R {
        VCTAT_ENABLE_R::new(((self.bits >> 6) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:3 - Output slope setting controls. The slope of the voltage with temperature varies from ~0% to ~15% from the value at 55C over the temperature range -40C to 150C based on control signal settings 0 to 15"]
    #[inline(always)]
    pub fn vctat_slope(&mut self) -> VCTAT_SLOPE_W {
        VCTAT_SLOPE_W { w: self }
    }
    #[doc = "Bits 4:5 - Output voltage absolute trim"]
    #[inline(always)]
    pub fn vctat_voltage(&mut self) -> VCTAT_VOLTAGE_W {
        VCTAT_VOLTAGE_W { w: self }
    }
    #[doc = "Bit 6 - Enable VCTAT block"]
    #[inline(always)]
    pub fn vctat_enable(&mut self) -> VCTAT_ENABLE_W {
        VCTAT_ENABLE_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Bandgap Trim Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [alt_p_vctat](index.html) module"]
pub struct ALT_P_VCTAT_SPEC;
impl crate::RegisterSpec for ALT_P_VCTAT_SPEC {
    type Ux = u8;
}
#[doc = "`read()` method returns [alt_p_vctat::R](R) reader structure"]
impl crate::Readable for ALT_P_VCTAT_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [alt_p_vctat::W](W) writer structure"]
impl crate::Writable for ALT_P_VCTAT_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets ALT_P_VCTAT to value 0"]
impl crate::Resettable for ALT_P_VCTAT_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
