stm32g0/stm32g030/pwr/
cr4.rs

1///Register `CR4` reader
2pub type R = crate::R<CR4rs>;
3///Register `CR4` writer
4pub type W = crate::W<CR4rs>;
5///Field `WP1` reader - Wakeup pin WKUP1 polarity
6pub type WP1_R = crate::BitReader;
7///Field `WP1` writer - Wakeup pin WKUP1 polarity
8pub type WP1_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `WP2` reader - Wakeup pin WKUP2 polarity
10pub type WP2_R = crate::BitReader;
11///Field `WP2` writer - Wakeup pin WKUP2 polarity
12pub type WP2_W<'a, REG> = crate::BitWriter<'a, REG>;
13///Field `WP3` reader - Wakeup pin WKUP3 polarity
14pub type WP3_R = crate::BitReader;
15///Field `WP3` writer - Wakeup pin WKUP3 polarity
16pub type WP3_W<'a, REG> = crate::BitWriter<'a, REG>;
17///Field `WP4` reader - Wakeup pin WKUP4 polarity
18pub type WP4_R = crate::BitReader;
19///Field `WP4` writer - Wakeup pin WKUP4 polarity
20pub type WP4_W<'a, REG> = crate::BitWriter<'a, REG>;
21///Field `WP5` reader - Wakeup pin WKUP5 polarity
22pub type WP5_R = crate::BitReader;
23///Field `WP5` writer - Wakeup pin WKUP5 polarity
24pub type WP5_W<'a, REG> = crate::BitWriter<'a, REG>;
25///Field `WP6` reader - WKUP6 wakeup pin polarity
26pub type WP6_R = crate::BitReader;
27///Field `WP6` writer - WKUP6 wakeup pin polarity
28pub type WP6_W<'a, REG> = crate::BitWriter<'a, REG>;
29///Field `VBE` reader - VBAT battery charging enable
30pub type VBE_R = crate::BitReader;
31///Field `VBE` writer - VBAT battery charging enable
32pub type VBE_W<'a, REG> = crate::BitWriter<'a, REG>;
33///Field `VBRS` reader - VBAT battery charging resistor selection
34pub type VBRS_R = crate::BitReader;
35///Field `VBRS` writer - VBAT battery charging resistor selection
36pub type VBRS_W<'a, REG> = crate::BitWriter<'a, REG>;
37impl R {
38    ///Bit 0 - Wakeup pin WKUP1 polarity
39    #[inline(always)]
40    pub fn wp1(&self) -> WP1_R {
41        WP1_R::new((self.bits & 1) != 0)
42    }
43    ///Bit 1 - Wakeup pin WKUP2 polarity
44    #[inline(always)]
45    pub fn wp2(&self) -> WP2_R {
46        WP2_R::new(((self.bits >> 1) & 1) != 0)
47    }
48    ///Bit 2 - Wakeup pin WKUP3 polarity
49    #[inline(always)]
50    pub fn wp3(&self) -> WP3_R {
51        WP3_R::new(((self.bits >> 2) & 1) != 0)
52    }
53    ///Bit 3 - Wakeup pin WKUP4 polarity
54    #[inline(always)]
55    pub fn wp4(&self) -> WP4_R {
56        WP4_R::new(((self.bits >> 3) & 1) != 0)
57    }
58    ///Bit 4 - Wakeup pin WKUP5 polarity
59    #[inline(always)]
60    pub fn wp5(&self) -> WP5_R {
61        WP5_R::new(((self.bits >> 4) & 1) != 0)
62    }
63    ///Bit 5 - WKUP6 wakeup pin polarity
64    #[inline(always)]
65    pub fn wp6(&self) -> WP6_R {
66        WP6_R::new(((self.bits >> 5) & 1) != 0)
67    }
68    ///Bit 8 - VBAT battery charging enable
69    #[inline(always)]
70    pub fn vbe(&self) -> VBE_R {
71        VBE_R::new(((self.bits >> 8) & 1) != 0)
72    }
73    ///Bit 9 - VBAT battery charging resistor selection
74    #[inline(always)]
75    pub fn vbrs(&self) -> VBRS_R {
76        VBRS_R::new(((self.bits >> 9) & 1) != 0)
77    }
78}
79impl core::fmt::Debug for R {
80    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
81        f.debug_struct("CR4")
82            .field("wp1", &self.wp1())
83            .field("wp2", &self.wp2())
84            .field("wp3", &self.wp3())
85            .field("wp4", &self.wp4())
86            .field("wp5", &self.wp5())
87            .field("wp6", &self.wp6())
88            .field("vbe", &self.vbe())
89            .field("vbrs", &self.vbrs())
90            .finish()
91    }
92}
93impl W {
94    ///Bit 0 - Wakeup pin WKUP1 polarity
95    #[inline(always)]
96    pub fn wp1(&mut self) -> WP1_W<CR4rs> {
97        WP1_W::new(self, 0)
98    }
99    ///Bit 1 - Wakeup pin WKUP2 polarity
100    #[inline(always)]
101    pub fn wp2(&mut self) -> WP2_W<CR4rs> {
102        WP2_W::new(self, 1)
103    }
104    ///Bit 2 - Wakeup pin WKUP3 polarity
105    #[inline(always)]
106    pub fn wp3(&mut self) -> WP3_W<CR4rs> {
107        WP3_W::new(self, 2)
108    }
109    ///Bit 3 - Wakeup pin WKUP4 polarity
110    #[inline(always)]
111    pub fn wp4(&mut self) -> WP4_W<CR4rs> {
112        WP4_W::new(self, 3)
113    }
114    ///Bit 4 - Wakeup pin WKUP5 polarity
115    #[inline(always)]
116    pub fn wp5(&mut self) -> WP5_W<CR4rs> {
117        WP5_W::new(self, 4)
118    }
119    ///Bit 5 - WKUP6 wakeup pin polarity
120    #[inline(always)]
121    pub fn wp6(&mut self) -> WP6_W<CR4rs> {
122        WP6_W::new(self, 5)
123    }
124    ///Bit 8 - VBAT battery charging enable
125    #[inline(always)]
126    pub fn vbe(&mut self) -> VBE_W<CR4rs> {
127        VBE_W::new(self, 8)
128    }
129    ///Bit 9 - VBAT battery charging resistor selection
130    #[inline(always)]
131    pub fn vbrs(&mut self) -> VBRS_W<CR4rs> {
132        VBRS_W::new(self, 9)
133    }
134}
135/**Power control register 4
136
137You can [`read`](crate::Reg::read) this register and get [`cr4::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr4::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
138
139See register [structure](https://stm32-rs.github.io/stm32-rs/STM32G030.html#PWR:CR4)*/
140pub struct CR4rs;
141impl crate::RegisterSpec for CR4rs {
142    type Ux = u32;
143}
144///`read()` method returns [`cr4::R`](R) reader structure
145impl crate::Readable for CR4rs {}
146///`write(|w| ..)` method takes [`cr4::W`](W) writer structure
147impl crate::Writable for CR4rs {
148    type Safety = crate::Unsafe;
149}
150///`reset()` method sets CR4 to value 0
151impl crate::Resettable for CR4rs {}