#[doc = "Reader of register SM2_CLKDIV"]
pub type R = crate::R<u32, super::SM2_CLKDIV>;
#[doc = "Writer for register SM2_CLKDIV"]
pub type W = crate::W<u32, super::SM2_CLKDIV>;
#[doc = "Register SM2_CLKDIV `reset()`'s with value 0x0001_0000"]
impl crate::ResetValue for super::SM2_CLKDIV {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x0001_0000
}
}
#[doc = "Reader of field `INT`"]
pub type INT_R = crate::R<u16, u16>;
#[doc = "Write proxy for field `INT`"]
pub struct INT_W<'a> {
w: &'a mut W,
}
impl<'a> INT_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 << 16)) | (((value as u32) & 0xffff) << 16);
self.w
}
}
#[doc = "Reader of field `FRAC`"]
pub type FRAC_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `FRAC`"]
pub struct FRAC_W<'a> {
w: &'a mut W,
}
impl<'a> FRAC_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 & !(0xff << 8)) | (((value as u32) & 0xff) << 8);
self.w
}
}
impl R {
#[doc = "Bits 16:31 - Effective frequency is sysclk/int.\\n Value of 0 is interpreted as max possible value"]
#[inline(always)]
pub fn int(&self) -> INT_R {
INT_R::new(((self.bits >> 16) & 0xffff) as u16)
}
#[doc = "Bits 8:15 - Fractional part of clock divider"]
#[inline(always)]
pub fn frac(&self) -> FRAC_R {
FRAC_R::new(((self.bits >> 8) & 0xff) as u8)
}
}
impl W {
#[doc = "Bits 16:31 - Effective frequency is sysclk/int.\\n Value of 0 is interpreted as max possible value"]
#[inline(always)]
pub fn int(&mut self) -> INT_W {
INT_W { w: self }
}
#[doc = "Bits 8:15 - Fractional part of clock divider"]
#[inline(always)]
pub fn frac(&mut self) -> FRAC_W {
FRAC_W { w: self }
}
}