#[doc = "Register `CLK_IMO_TRIM2` reader"]
pub struct R(crate::R<CLK_IMO_TRIM2_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<CLK_IMO_TRIM2_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<CLK_IMO_TRIM2_SPEC>> for R {
    fn from(reader: crate::R<CLK_IMO_TRIM2_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `CLK_IMO_TRIM2` writer"]
pub struct W(crate::W<CLK_IMO_TRIM2_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<CLK_IMO_TRIM2_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_IMO_TRIM2_SPEC>> for W {
    fn from(writer: crate::W<CLK_IMO_TRIM2_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `FREQ` reader - Frequency to be selected (default 24MHz). Frequencies can be selected from 3..48MHz. When changing this field approriate values for IMO_CLK_TRIM1, PWR_BG_TRIM4 and PWR_BG_TRIM5 must be selected from trim tables determined at manufacturing time and stored in SFLASH. This process is documented in the SAS under \"Clocks - Selecting IMO Frequency\". For encoding of this field a lookup table is required, where the frequency increases in 1MHz steps in the regions listed below. Unspecified values have undefined behavior. A complete lookup table is in BROS 001-59652 Sec 4.2.2. ?\\[3-12\\]
=> \\[3MHz-12MHz\\]?\\[14-25\\]
=> \\[13MHz-24MHz\\]?\\[27-35\\]
=> \\[25MHz-33MHz\\]?\\[37-43\\]
=> \\[34MHz-40MHz\\]?\\[46-53\\]
=> \\[41MHz-48MHz\\]"]
pub struct FREQ_R(crate::FieldReader<u8, u8>);
impl FREQ_R {
    pub(crate) fn new(bits: u8) -> Self {
        FREQ_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for FREQ_R {
    type Target = crate::FieldReader<u8, u8>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `FREQ` writer - Frequency to be selected (default 24MHz). Frequencies can be selected from 3..48MHz. When changing this field approriate values for IMO_CLK_TRIM1, PWR_BG_TRIM4 and PWR_BG_TRIM5 must be selected from trim tables determined at manufacturing time and stored in SFLASH. This process is documented in the SAS under \"Clocks - Selecting IMO Frequency\". For encoding of this field a lookup table is required, where the frequency increases in 1MHz steps in the regions listed below. Unspecified values have undefined behavior. A complete lookup table is in BROS 001-59652 Sec 4.2.2. ?\\[3-12\\]
=> \\[3MHz-12MHz\\]?\\[14-25\\]
=> \\[13MHz-24MHz\\]?\\[27-35\\]
=> \\[25MHz-33MHz\\]?\\[37-43\\]
=> \\[34MHz-40MHz\\]?\\[46-53\\]
=> \\[41MHz-48MHz\\]"]
pub struct FREQ_W<'a> {
    w: &'a mut W,
}
impl<'a> FREQ_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 & !0x3f) | (value as u32 & 0x3f);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:5 - Frequency to be selected (default 24MHz). Frequencies can be selected from 3..48MHz. When changing this field approriate values for IMO_CLK_TRIM1, PWR_BG_TRIM4 and PWR_BG_TRIM5 must be selected from trim tables determined at manufacturing time and stored in SFLASH. This process is documented in the SAS under \"Clocks - Selecting IMO Frequency\". For encoding of this field a lookup table is required, where the frequency increases in 1MHz steps in the regions listed below. Unspecified values have undefined behavior. A complete lookup table is in BROS 001-59652 Sec 4.2.2. ?\\[3-12\\]
=> \\[3MHz-12MHz\\]?\\[14-25\\]
=> \\[13MHz-24MHz\\]?\\[27-35\\]
=> \\[25MHz-33MHz\\]?\\[37-43\\]
=> \\[34MHz-40MHz\\]?\\[46-53\\]
=> \\[41MHz-48MHz\\]"]
    #[inline(always)]
    pub fn freq(&self) -> FREQ_R {
        FREQ_R::new((self.bits & 0x3f) as u8)
    }
}
impl W {
    #[doc = "Bits 0:5 - Frequency to be selected (default 24MHz). Frequencies can be selected from 3..48MHz. When changing this field approriate values for IMO_CLK_TRIM1, PWR_BG_TRIM4 and PWR_BG_TRIM5 must be selected from trim tables determined at manufacturing time and stored in SFLASH. This process is documented in the SAS under \"Clocks - Selecting IMO Frequency\". For encoding of this field a lookup table is required, where the frequency increases in 1MHz steps in the regions listed below. Unspecified values have undefined behavior. A complete lookup table is in BROS 001-59652 Sec 4.2.2. ?\\[3-12\\]
=> \\[3MHz-12MHz\\]?\\[14-25\\]
=> \\[13MHz-24MHz\\]?\\[27-35\\]
=> \\[25MHz-33MHz\\]?\\[37-43\\]
=> \\[34MHz-40MHz\\]?\\[46-53\\]
=> \\[41MHz-48MHz\\]"]
    #[inline(always)]
    pub fn freq(&mut self) -> FREQ_W {
        FREQ_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 = "IMO 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 [clk_imo_trim2](index.html) module"]
pub struct CLK_IMO_TRIM2_SPEC;
impl crate::RegisterSpec for CLK_IMO_TRIM2_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [clk_imo_trim2::R](R) reader structure"]
impl crate::Readable for CLK_IMO_TRIM2_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [clk_imo_trim2::W](W) writer structure"]
impl crate::Writable for CLK_IMO_TRIM2_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets CLK_IMO_TRIM2 to value 0"]
impl crate::Resettable for CLK_IMO_TRIM2_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
