stm32l4x2_pac/rtc/
or.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::OR {
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 {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct RTC_ALARM_TYPER {
47    bits: bool,
48}
49impl RTC_ALARM_TYPER {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct RTC_OUT_RMPR {
68    bits: bool,
69}
70impl RTC_OUT_RMPR {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Proxy"]
88pub struct _RTC_ALARM_TYPEW<'a> {
89    w: &'a mut W,
90}
91impl<'a> _RTC_ALARM_TYPEW<'a> {
92    #[doc = r" Sets the field bit"]
93    pub fn set_bit(self) -> &'a mut W {
94        self.bit(true)
95    }
96    #[doc = r" Clears the field bit"]
97    pub fn clear_bit(self) -> &'a mut W {
98        self.bit(false)
99    }
100    #[doc = r" Writes raw bits to the field"]
101    #[inline]
102    pub fn bit(self, value: bool) -> &'a mut W {
103        const MASK: bool = true;
104        const OFFSET: u8 = 0;
105        self.w.bits &= !((MASK as u32) << OFFSET);
106        self.w.bits |= ((value & MASK) as u32) << OFFSET;
107        self.w
108    }
109}
110#[doc = r" Proxy"]
111pub struct _RTC_OUT_RMPW<'a> {
112    w: &'a mut W,
113}
114impl<'a> _RTC_OUT_RMPW<'a> {
115    #[doc = r" Sets the field bit"]
116    pub fn set_bit(self) -> &'a mut W {
117        self.bit(true)
118    }
119    #[doc = r" Clears the field bit"]
120    pub fn clear_bit(self) -> &'a mut W {
121        self.bit(false)
122    }
123    #[doc = r" Writes raw bits to the field"]
124    #[inline]
125    pub fn bit(self, value: bool) -> &'a mut W {
126        const MASK: bool = true;
127        const OFFSET: u8 = 1;
128        self.w.bits &= !((MASK as u32) << OFFSET);
129        self.w.bits |= ((value & MASK) as u32) << OFFSET;
130        self.w
131    }
132}
133impl R {
134    #[doc = r" Value of the register as raw bits"]
135    #[inline]
136    pub fn bits(&self) -> u32 {
137        self.bits
138    }
139    #[doc = "Bit 0 - RTC_ALARM on PC13 output type"]
140    #[inline]
141    pub fn rtc_alarm_type(&self) -> RTC_ALARM_TYPER {
142        let bits = {
143            const MASK: bool = true;
144            const OFFSET: u8 = 0;
145            ((self.bits >> OFFSET) & MASK as u32) != 0
146        };
147        RTC_ALARM_TYPER { bits }
148    }
149    #[doc = "Bit 1 - RTC_OUT remap"]
150    #[inline]
151    pub fn rtc_out_rmp(&self) -> RTC_OUT_RMPR {
152        let bits = {
153            const MASK: bool = true;
154            const OFFSET: u8 = 1;
155            ((self.bits >> OFFSET) & MASK as u32) != 0
156        };
157        RTC_OUT_RMPR { bits }
158    }
159}
160impl W {
161    #[doc = r" Reset value of the register"]
162    #[inline]
163    pub fn reset_value() -> W {
164        W { bits: 0 }
165    }
166    #[doc = r" Writes raw bits to the register"]
167    #[inline]
168    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
169        self.bits = bits;
170        self
171    }
172    #[doc = "Bit 0 - RTC_ALARM on PC13 output type"]
173    #[inline]
174    pub fn rtc_alarm_type(&mut self) -> _RTC_ALARM_TYPEW {
175        _RTC_ALARM_TYPEW { w: self }
176    }
177    #[doc = "Bit 1 - RTC_OUT remap"]
178    #[inline]
179    pub fn rtc_out_rmp(&mut self) -> _RTC_OUT_RMPW {
180        _RTC_OUT_RMPW { w: self }
181    }
182}