cc2650/prcm/
pdctl0.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::PDCTL0 {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R { bits: self.register.get() }
26    }
27    #[doc = r" Writes to the register"]
28    #[inline]
29    pub fn write<F>(&self, f: F)
30    where
31        F: FnOnce(&mut W) -> &mut W,
32    {
33        let mut w = W::reset_value();
34        f(&mut w);
35        self.register.set(w.bits);
36    }
37    #[doc = r" Writes the reset value to the register"]
38    #[inline]
39    pub fn reset(&self) {
40        self.write(|w| w)
41    }
42}
43#[doc = r" Value of the field"]
44pub struct RESERVED3R {
45    bits: u32,
46}
47impl RESERVED3R {
48    #[doc = r" Value of the field as raw bits"]
49    #[inline]
50    pub fn bits(&self) -> u32 {
51        self.bits
52    }
53}
54#[doc = r" Value of the field"]
55pub struct PERIPH_ONR {
56    bits: bool,
57}
58impl PERIPH_ONR {
59    #[doc = r" Value of the field as raw bits"]
60    #[inline]
61    pub fn bit(&self) -> bool {
62        self.bits
63    }
64    #[doc = r" Returns `true` if the bit is clear (0)"]
65    #[inline]
66    pub fn bit_is_clear(&self) -> bool {
67        !self.bit()
68    }
69    #[doc = r" Returns `true` if the bit is set (1)"]
70    #[inline]
71    pub fn bit_is_set(&self) -> bool {
72        self.bit()
73    }
74}
75#[doc = r" Value of the field"]
76pub struct SERIAL_ONR {
77    bits: bool,
78}
79impl SERIAL_ONR {
80    #[doc = r" Value of the field as raw bits"]
81    #[inline]
82    pub fn bit(&self) -> bool {
83        self.bits
84    }
85    #[doc = r" Returns `true` if the bit is clear (0)"]
86    #[inline]
87    pub fn bit_is_clear(&self) -> bool {
88        !self.bit()
89    }
90    #[doc = r" Returns `true` if the bit is set (1)"]
91    #[inline]
92    pub fn bit_is_set(&self) -> bool {
93        self.bit()
94    }
95}
96#[doc = r" Value of the field"]
97pub struct RFC_ONR {
98    bits: bool,
99}
100impl RFC_ONR {
101    #[doc = r" Value of the field as raw bits"]
102    #[inline]
103    pub fn bit(&self) -> bool {
104        self.bits
105    }
106    #[doc = r" Returns `true` if the bit is clear (0)"]
107    #[inline]
108    pub fn bit_is_clear(&self) -> bool {
109        !self.bit()
110    }
111    #[doc = r" Returns `true` if the bit is set (1)"]
112    #[inline]
113    pub fn bit_is_set(&self) -> bool {
114        self.bit()
115    }
116}
117#[doc = r" Proxy"]
118pub struct _PERIPH_ONW<'a> {
119    w: &'a mut W,
120}
121impl<'a> _PERIPH_ONW<'a> {
122    #[doc = r" Sets the field bit"]
123    pub fn set_bit(self) -> &'a mut W {
124        self.bit(true)
125    }
126    #[doc = r" Clears the field bit"]
127    pub fn clear_bit(self) -> &'a mut W {
128        self.bit(false)
129    }
130    #[doc = r" Writes raw bits to the field"]
131    #[inline]
132    pub fn bit(self, value: bool) -> &'a mut W {
133        const MASK: bool = true;
134        const OFFSET: u8 = 2;
135        self.w.bits &= !((MASK as u32) << OFFSET);
136        self.w.bits |= ((value & MASK) as u32) << OFFSET;
137        self.w
138    }
139}
140#[doc = r" Proxy"]
141pub struct _SERIAL_ONW<'a> {
142    w: &'a mut W,
143}
144impl<'a> _SERIAL_ONW<'a> {
145    #[doc = r" Sets the field bit"]
146    pub fn set_bit(self) -> &'a mut W {
147        self.bit(true)
148    }
149    #[doc = r" Clears the field bit"]
150    pub fn clear_bit(self) -> &'a mut W {
151        self.bit(false)
152    }
153    #[doc = r" Writes raw bits to the field"]
154    #[inline]
155    pub fn bit(self, value: bool) -> &'a mut W {
156        const MASK: bool = true;
157        const OFFSET: u8 = 1;
158        self.w.bits &= !((MASK as u32) << OFFSET);
159        self.w.bits |= ((value & MASK) as u32) << OFFSET;
160        self.w
161    }
162}
163#[doc = r" Proxy"]
164pub struct _RFC_ONW<'a> {
165    w: &'a mut W,
166}
167impl<'a> _RFC_ONW<'a> {
168    #[doc = r" Sets the field bit"]
169    pub fn set_bit(self) -> &'a mut W {
170        self.bit(true)
171    }
172    #[doc = r" Clears the field bit"]
173    pub fn clear_bit(self) -> &'a mut W {
174        self.bit(false)
175    }
176    #[doc = r" Writes raw bits to the field"]
177    #[inline]
178    pub fn bit(self, value: bool) -> &'a mut W {
179        const MASK: bool = true;
180        const OFFSET: u8 = 0;
181        self.w.bits &= !((MASK as u32) << OFFSET);
182        self.w.bits |= ((value & MASK) as u32) << OFFSET;
183        self.w
184    }
185}
186impl R {
187    #[doc = r" Value of the register as raw bits"]
188    #[inline]
189    pub fn bits(&self) -> u32 {
190        self.bits
191    }
192    #[doc = "Bits 3:31 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
193    #[inline]
194    pub fn reserved3(&self) -> RESERVED3R {
195        let bits = {
196            const MASK: u32 = 536870911;
197            const OFFSET: u8 = 3;
198            ((self.bits >> OFFSET) & MASK as u32) as u32
199        };
200        RESERVED3R { bits }
201    }
202    #[doc = "Bit 2 - PERIPH Power domain. 0: PERIPH power domain is powered down 1: PERIPH power domain is powered up"]
203    #[inline]
204    pub fn periph_on(&self) -> PERIPH_ONR {
205        let bits = {
206            const MASK: bool = true;
207            const OFFSET: u8 = 2;
208            ((self.bits >> OFFSET) & MASK as u32) != 0
209        };
210        PERIPH_ONR { bits }
211    }
212    #[doc = "Bit 1 - SERIAL Power domain. 0: SERIAL power domain is powered down 1: SERIAL power domain is powered up"]
213    #[inline]
214    pub fn serial_on(&self) -> SERIAL_ONR {
215        let bits = {
216            const MASK: bool = true;
217            const OFFSET: u8 = 1;
218            ((self.bits >> OFFSET) & MASK as u32) != 0
219        };
220        SERIAL_ONR { bits }
221    }
222    #[doc = "Bit 0 - 0: RFC power domain powered off if also PDCTL1.RFC_ON = 0 1: RFC power domain powered on"]
223    #[inline]
224    pub fn rfc_on(&self) -> RFC_ONR {
225        let bits = {
226            const MASK: bool = true;
227            const OFFSET: u8 = 0;
228            ((self.bits >> OFFSET) & MASK as u32) != 0
229        };
230        RFC_ONR { bits }
231    }
232}
233impl W {
234    #[doc = r" Reset value of the register"]
235    #[inline]
236    pub fn reset_value() -> W {
237        W { bits: 0 }
238    }
239    #[doc = r" Writes raw bits to the register"]
240    #[inline]
241    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
242        self.bits = bits;
243        self
244    }
245    #[doc = "Bit 2 - PERIPH Power domain. 0: PERIPH power domain is powered down 1: PERIPH power domain is powered up"]
246    #[inline]
247    pub fn periph_on(&mut self) -> _PERIPH_ONW {
248        _PERIPH_ONW { w: self }
249    }
250    #[doc = "Bit 1 - SERIAL Power domain. 0: SERIAL power domain is powered down 1: SERIAL power domain is powered up"]
251    #[inline]
252    pub fn serial_on(&mut self) -> _SERIAL_ONW {
253        _SERIAL_ONW { w: self }
254    }
255    #[doc = "Bit 0 - 0: RFC power domain powered off if also PDCTL1.RFC_ON = 0 1: RFC power domain powered on"]
256    #[inline]
257    pub fn rfc_on(&mut self) -> _RFC_ONW {
258        _RFC_ONW { w: self }
259    }
260}