#[doc = "Reader of register CKGR_MCFR"]
pub type R = crate::R<u32, super::CKGR_MCFR>;
#[doc = "Writer for register CKGR_MCFR"]
pub type W = crate::W<u32, super::CKGR_MCFR>;
#[doc = "Register CKGR_MCFR `reset()`'s with value 0"]
impl crate::ResetValue for super::CKGR_MCFR {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0
    }
}
#[doc = "Reader of field `MAINF`"]
pub type MAINF_R = crate::R<u16, u16>;
#[doc = "Write proxy for field `MAINF`"]
pub struct MAINF_W<'a> {
    w: &'a mut W,
}
impl<'a> MAINF_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xffff) | ((value as u32) & 0xffff);
        self.w
    }
}
#[doc = "Reader of field `MAINFRDY`"]
pub type MAINFRDY_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MAINFRDY`"]
pub struct MAINFRDY_W<'a> {
    w: &'a mut W,
}
impl<'a> MAINFRDY_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 << 16)) | (((value as u32) & 0x01) << 16);
        self.w
    }
}
#[doc = "Reader of field `RCMEAS`"]
pub type RCMEAS_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `RCMEAS`"]
pub struct RCMEAS_W<'a> {
    w: &'a mut W,
}
impl<'a> RCMEAS_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 << 20)) | (((value as u32) & 0x01) << 20);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:15 - Main Clock Frequency"]
    #[inline(always)]
    pub fn mainf(&self) -> MAINF_R {
        MAINF_R::new((self.bits & 0xffff) as u16)
    }
    #[doc = "Bit 16 - Main Clock Ready"]
    #[inline(always)]
    pub fn mainfrdy(&self) -> MAINFRDY_R {
        MAINFRDY_R::new(((self.bits >> 16) & 0x01) != 0)
    }
    #[doc = "Bit 20 - RC Oscillator Frequency Measure (write-only)"]
    #[inline(always)]
    pub fn rcmeas(&self) -> RCMEAS_R {
        RCMEAS_R::new(((self.bits >> 20) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:15 - Main Clock Frequency"]
    #[inline(always)]
    pub fn mainf(&mut self) -> MAINF_W {
        MAINF_W { w: self }
    }
    #[doc = "Bit 16 - Main Clock Ready"]
    #[inline(always)]
    pub fn mainfrdy(&mut self) -> MAINFRDY_W {
        MAINFRDY_W { w: self }
    }
    #[doc = "Bit 20 - RC Oscillator Frequency Measure (write-only)"]
    #[inline(always)]
    pub fn rcmeas(&mut self) -> RCMEAS_W {
        RCMEAS_W { w: self }
    }
}
