stm32wb_pac/rtc/
prer.rs

1#[doc = "Reader of register PRER"]
2pub type R = crate::R<u32, super::PRER>;
3#[doc = "Writer for register PRER"]
4pub type W = crate::W<u32, super::PRER>;
5#[doc = "Register PRER `reset()`'s with value 0x007f_00ff"]
6impl crate::ResetValue for super::PRER {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x007f_00ff
11    }
12}
13#[doc = "Reader of field `PREDIV_A`"]
14pub type PREDIV_A_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `PREDIV_A`"]
16pub struct PREDIV_A_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> PREDIV_A_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x7f << 16)) | (((value as u32) & 0x7f) << 16);
24        self.w
25    }
26}
27#[doc = "Reader of field `PREDIV_S`"]
28pub type PREDIV_S_R = crate::R<u16, u16>;
29#[doc = "Write proxy for field `PREDIV_S`"]
30pub struct PREDIV_S_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> PREDIV_S_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u16) -> &'a mut W {
37        self.w.bits = (self.w.bits & !0x7fff) | ((value as u32) & 0x7fff);
38        self.w
39    }
40}
41impl R {
42    #[doc = "Bits 16:22 - Asynchronous prescaler factor"]
43    #[inline(always)]
44    pub fn prediv_a(&self) -> PREDIV_A_R {
45        PREDIV_A_R::new(((self.bits >> 16) & 0x7f) as u8)
46    }
47    #[doc = "Bits 0:14 - Synchronous prescaler factor"]
48    #[inline(always)]
49    pub fn prediv_s(&self) -> PREDIV_S_R {
50        PREDIV_S_R::new((self.bits & 0x7fff) as u16)
51    }
52}
53impl W {
54    #[doc = "Bits 16:22 - Asynchronous prescaler factor"]
55    #[inline(always)]
56    pub fn prediv_a(&mut self) -> PREDIV_A_W {
57        PREDIV_A_W { w: self }
58    }
59    #[doc = "Bits 0:14 - Synchronous prescaler factor"]
60    #[inline(always)]
61    pub fn prediv_s(&mut self) -> PREDIV_S_W {
62        PREDIV_S_W { w: self }
63    }
64}