stm32wb_pac/rcc/
smpscr.rs

1#[doc = "Reader of register SMPSCR"]
2pub type R = crate::R<u32, super::SMPSCR>;
3#[doc = "Writer for register SMPSCR"]
4pub type W = crate::W<u32, super::SMPSCR>;
5#[doc = "Register SMPSCR `reset()`'s with value 0x0301"]
6impl crate::ResetValue for super::SMPSCR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x0301
11    }
12}
13#[doc = "Reader of field `SMPSSWS`"]
14pub type SMPSSWS_R = crate::R<u8, u8>;
15#[doc = "Reader of field `SMPSDIV`"]
16pub type SMPSDIV_R = crate::R<u8, u8>;
17#[doc = "Write proxy for field `SMPSDIV`"]
18pub struct SMPSDIV_W<'a> {
19    w: &'a mut W,
20}
21impl<'a> SMPSDIV_W<'a> {
22    #[doc = r"Writes raw bits to the field"]
23    #[inline(always)]
24    pub unsafe fn bits(self, value: u8) -> &'a mut W {
25        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
26        self.w
27    }
28}
29#[doc = "Reader of field `SMPSSEL`"]
30pub type SMPSSEL_R = crate::R<u8, u8>;
31#[doc = "Write proxy for field `SMPSSEL`"]
32pub struct SMPSSEL_W<'a> {
33    w: &'a mut W,
34}
35impl<'a> SMPSSEL_W<'a> {
36    #[doc = r"Writes raw bits to the field"]
37    #[inline(always)]
38    pub unsafe fn bits(self, value: u8) -> &'a mut W {
39        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
40        self.w
41    }
42}
43impl R {
44    #[doc = "Bits 8:9 - Step Down converter clock switch status"]
45    #[inline(always)]
46    pub fn smpssws(&self) -> SMPSSWS_R {
47        SMPSSWS_R::new(((self.bits >> 8) & 0x03) as u8)
48    }
49    #[doc = "Bits 4:5 - Step Down converter clock prescaler"]
50    #[inline(always)]
51    pub fn smpsdiv(&self) -> SMPSDIV_R {
52        SMPSDIV_R::new(((self.bits >> 4) & 0x03) as u8)
53    }
54    #[doc = "Bits 0:1 - Step Down converter clock selection"]
55    #[inline(always)]
56    pub fn smpssel(&self) -> SMPSSEL_R {
57        SMPSSEL_R::new((self.bits & 0x03) as u8)
58    }
59}
60impl W {
61    #[doc = "Bits 4:5 - Step Down converter clock prescaler"]
62    #[inline(always)]
63    pub fn smpsdiv(&mut self) -> SMPSDIV_W {
64        SMPSDIV_W { w: self }
65    }
66    #[doc = "Bits 0:1 - Step Down converter clock selection"]
67    #[inline(always)]
68    pub fn smpssel(&mut self) -> SMPSSEL_W {
69        SMPSSEL_W { w: self }
70    }
71}