stm32wb_pac/pwr/
c2cr1.rs

1#[doc = "Reader of register C2CR1"]
2pub type R = crate::R<u32, super::C2CR1>;
3#[doc = "Writer for register C2CR1"]
4pub type W = crate::W<u32, super::C2CR1>;
5#[doc = "Register C2CR1 `reset()`'s with value 0"]
6impl crate::ResetValue for super::C2CR1 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `802EWKUP`"]
14pub type _802EWKUP_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `802EWKUP`"]
16pub struct _802EWKUP_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> _802EWKUP_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 `BLEEWKUP`"]
38pub type BLEEWKUP_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `BLEEWKUP`"]
40pub struct BLEEWKUP_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> BLEEWKUP_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 `FPDS`"]
62pub type FPDS_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `FPDS`"]
64pub struct FPDS_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> FPDS_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 << 5)) | (((value as u32) & 0x01) << 5);
82        self.w
83    }
84}
85#[doc = "Reader of field `FPDR`"]
86pub type FPDR_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `FPDR`"]
88pub struct FPDR_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> FPDR_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 << 4)) | (((value as u32) & 0x01) << 4);
106        self.w
107    }
108}
109#[doc = "Reader of field `LPMS`"]
110pub type LPMS_R = crate::R<u8, u8>;
111#[doc = "Write proxy for field `LPMS`"]
112pub struct LPMS_W<'a> {
113    w: &'a mut W,
114}
115impl<'a> LPMS_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) | ((value as u32) & 0x07);
120        self.w
121    }
122}
123impl R {
124    #[doc = "Bit 15 - 802.15.4 external wakeup signal"]
125    #[inline(always)]
126    pub fn _802ewkup(&self) -> _802EWKUP_R {
127        _802EWKUP_R::new(((self.bits >> 15) & 0x01) != 0)
128    }
129    #[doc = "Bit 14 - BLE external wakeup signal"]
130    #[inline(always)]
131    pub fn bleewkup(&self) -> BLEEWKUP_R {
132        BLEEWKUP_R::new(((self.bits >> 14) & 0x01) != 0)
133    }
134    #[doc = "Bit 5 - Flash power down mode during LPSleep for CPU2"]
135    #[inline(always)]
136    pub fn fpds(&self) -> FPDS_R {
137        FPDS_R::new(((self.bits >> 5) & 0x01) != 0)
138    }
139    #[doc = "Bit 4 - Flash power down mode during LPRun for CPU2"]
140    #[inline(always)]
141    pub fn fpdr(&self) -> FPDR_R {
142        FPDR_R::new(((self.bits >> 4) & 0x01) != 0)
143    }
144    #[doc = "Bits 0:2 - Low-power mode selection for CPU2"]
145    #[inline(always)]
146    pub fn lpms(&self) -> LPMS_R {
147        LPMS_R::new((self.bits & 0x07) as u8)
148    }
149}
150impl W {
151    #[doc = "Bit 15 - 802.15.4 external wakeup signal"]
152    #[inline(always)]
153    pub fn _802ewkup(&mut self) -> _802EWKUP_W {
154        _802EWKUP_W { w: self }
155    }
156    #[doc = "Bit 14 - BLE external wakeup signal"]
157    #[inline(always)]
158    pub fn bleewkup(&mut self) -> BLEEWKUP_W {
159        BLEEWKUP_W { w: self }
160    }
161    #[doc = "Bit 5 - Flash power down mode during LPSleep for CPU2"]
162    #[inline(always)]
163    pub fn fpds(&mut self) -> FPDS_W {
164        FPDS_W { w: self }
165    }
166    #[doc = "Bit 4 - Flash power down mode during LPRun for CPU2"]
167    #[inline(always)]
168    pub fn fpdr(&mut self) -> FPDR_W {
169        FPDR_W { w: self }
170    }
171    #[doc = "Bits 0:2 - Low-power mode selection for CPU2"]
172    #[inline(always)]
173    pub fn lpms(&mut self) -> LPMS_W {
174        LPMS_W { w: self }
175    }
176}