stm32wb_pac/pwr/
cr5.rs

1#[doc = "Reader of register CR5"]
2pub type R = crate::R<u32, super::CR5>;
3#[doc = "Writer for register CR5"]
4pub type W = crate::W<u32, super::CR5>;
5#[doc = "Register CR5 `reset()`'s with value 0x4270"]
6impl crate::ResetValue for super::CR5 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x4270
11    }
12}
13#[doc = "Reader of field `SDEB`"]
14pub type SDEB_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `SDEB`"]
16pub struct SDEB_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SDEB_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
34        self.w
35    }
36}
37#[doc = "Reader of field `SDBEN`"]
38pub type SDBEN_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `SDBEN`"]
40pub struct SDBEN_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> SDBEN_W<'a> {
44    #[doc = r"Sets the field bit"]
45    #[inline(always)]
46    pub fn set_bit(self) -> &'a mut W {
47        self.bit(true)
48    }
49    #[doc = r"Clears the field bit"]
50    #[inline(always)]
51    pub fn clear_bit(self) -> &'a mut W {
52        self.bit(false)
53    }
54    #[doc = r"Writes raw bits to the field"]
55    #[inline(always)]
56    pub fn bit(self, value: bool) -> &'a mut W {
57        self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u32) & 0x01) << 14);
58        self.w
59    }
60}
61#[doc = "Reader of field `SMPSCFG`"]
62pub type SMPSCFG_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `SMPSCFG`"]
64pub struct SMPSCFG_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> SMPSCFG_W<'a> {
68    #[doc = r"Sets the field bit"]
69    #[inline(always)]
70    pub fn set_bit(self) -> &'a mut W {
71        self.bit(true)
72    }
73    #[doc = r"Clears the field bit"]
74    #[inline(always)]
75    pub fn clear_bit(self) -> &'a mut W {
76        self.bit(false)
77    }
78    #[doc = r"Writes raw bits to the field"]
79    #[inline(always)]
80    pub fn bit(self, value: bool) -> &'a mut W {
81        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
82        self.w
83    }
84}
85#[doc = "Reader of field `BORHC`"]
86pub type BORHC_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `BORHC`"]
88pub struct BORHC_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> BORHC_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
106        self.w
107    }
108}
109#[doc = "Reader of field `SDSC`"]
110pub type SDSC_R = crate::R<u8, u8>;
111#[doc = "Write proxy for field `SDSC`"]
112pub struct SDSC_W<'a> {
113    w: &'a mut W,
114}
115impl<'a> SDSC_W<'a> {
116    #[doc = r"Writes raw bits to the field"]
117    #[inline(always)]
118    pub unsafe fn bits(self, value: u8) -> &'a mut W {
119        self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
120        self.w
121    }
122}
123#[doc = "Reader of field `SDVOS`"]
124pub type SDVOS_R = crate::R<u8, u8>;
125#[doc = "Write proxy for field `SDVOS`"]
126pub struct SDVOS_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> SDVOS_W<'a> {
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub unsafe fn bits(self, value: u8) -> &'a mut W {
133        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
134        self.w
135    }
136}
137impl R {
138    #[doc = "Bit 15 - Enable Step Down converter SMPS mode enabled"]
139    #[inline(always)]
140    pub fn sdeb(&self) -> SDEB_R {
141        SDEB_R::new(((self.bits >> 15) & 0x01) != 0)
142    }
143    #[doc = "Bit 14 - Enable Step Down converter Bypass mode enabled"]
144    #[inline(always)]
145    pub fn sdben(&self) -> SDBEN_R {
146        SDBEN_R::new(((self.bits >> 14) & 0x01) != 0)
147    }
148    #[doc = "Bit 9 - VOS configuration selection (non user)"]
149    #[inline(always)]
150    pub fn smpscfg(&self) -> SMPSCFG_R {
151        SMPSCFG_R::new(((self.bits >> 9) & 0x01) != 0)
152    }
153    #[doc = "Bit 8 - BORH configuration selection"]
154    #[inline(always)]
155    pub fn borhc(&self) -> BORHC_R {
156        BORHC_R::new(((self.bits >> 8) & 0x01) != 0)
157    }
158    #[doc = "Bits 4:6 - Step Down converter supplt startup current selection"]
159    #[inline(always)]
160    pub fn sdsc(&self) -> SDSC_R {
161        SDSC_R::new(((self.bits >> 4) & 0x07) as u8)
162    }
163    #[doc = "Bits 0:3 - Step Down converter voltage output scaling"]
164    #[inline(always)]
165    pub fn sdvos(&self) -> SDVOS_R {
166        SDVOS_R::new((self.bits & 0x0f) as u8)
167    }
168}
169impl W {
170    #[doc = "Bit 15 - Enable Step Down converter SMPS mode enabled"]
171    #[inline(always)]
172    pub fn sdeb(&mut self) -> SDEB_W {
173        SDEB_W { w: self }
174    }
175    #[doc = "Bit 14 - Enable Step Down converter Bypass mode enabled"]
176    #[inline(always)]
177    pub fn sdben(&mut self) -> SDBEN_W {
178        SDBEN_W { w: self }
179    }
180    #[doc = "Bit 9 - VOS configuration selection (non user)"]
181    #[inline(always)]
182    pub fn smpscfg(&mut self) -> SMPSCFG_W {
183        SMPSCFG_W { w: self }
184    }
185    #[doc = "Bit 8 - BORH configuration selection"]
186    #[inline(always)]
187    pub fn borhc(&mut self) -> BORHC_W {
188        BORHC_W { w: self }
189    }
190    #[doc = "Bits 4:6 - Step Down converter supplt startup current selection"]
191    #[inline(always)]
192    pub fn sdsc(&mut self) -> SDSC_W {
193        SDSC_W { w: self }
194    }
195    #[doc = "Bits 0:3 - Step Down converter voltage output scaling"]
196    #[inline(always)]
197    pub fn sdvos(&mut self) -> SDVOS_W {
198        SDVOS_W { w: self }
199    }
200}