stm32f0/stm32f0x1/rtc/
tafcr.rs

1///Register `TAFCR` reader
2pub type R = crate::R<TAFCRrs>;
3///Register `TAFCR` writer
4pub type W = crate::W<TAFCRrs>;
5///Field `TAMP1E` reader - RTC_TAMP1 input detection enable
6pub type TAMP1E_R = crate::BitReader;
7///Field `TAMP1E` writer - RTC_TAMP1 input detection enable
8pub type TAMP1E_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `TAMP1TRG` reader - Active level for RTC_TAMP1 input
10pub type TAMP1TRG_R = crate::BitReader;
11///Field `TAMP1TRG` writer - Active level for RTC_TAMP1 input
12pub type TAMP1TRG_W<'a, REG> = crate::BitWriter<'a, REG>;
13///Field `TAMPIE` reader - Tamper interrupt enable
14pub type TAMPIE_R = crate::BitReader;
15///Field `TAMPIE` writer - Tamper interrupt enable
16pub type TAMPIE_W<'a, REG> = crate::BitWriter<'a, REG>;
17///Field `TAMP2E` reader - RTC_TAMP2 input detection enable
18pub type TAMP2E_R = crate::BitReader;
19///Field `TAMP2E` writer - RTC_TAMP2 input detection enable
20pub type TAMP2E_W<'a, REG> = crate::BitWriter<'a, REG>;
21///Field `TAMP2_TRG` reader - Active level for RTC_TAMP2 input
22pub type TAMP2_TRG_R = crate::BitReader;
23///Field `TAMP2_TRG` writer - Active level for RTC_TAMP2 input
24pub type TAMP2_TRG_W<'a, REG> = crate::BitWriter<'a, REG>;
25///Field `TAMPTS` reader - Activate timestamp on tamper detection event
26pub type TAMPTS_R = crate::BitReader;
27///Field `TAMPTS` writer - Activate timestamp on tamper detection event
28pub type TAMPTS_W<'a, REG> = crate::BitWriter<'a, REG>;
29///Field `TAMPFREQ` reader - Tamper sampling frequency
30pub type TAMPFREQ_R = crate::FieldReader;
31///Field `TAMPFREQ` writer - Tamper sampling frequency
32pub type TAMPFREQ_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
33///Field `TAMPFLT` reader - RTC_TAMPx filter count
34pub type TAMPFLT_R = crate::FieldReader;
35///Field `TAMPFLT` writer - RTC_TAMPx filter count
36pub type TAMPFLT_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
37///Field `TAMP_PRCH` reader - RTC_TAMPx precharge duration
38pub type TAMP_PRCH_R = crate::FieldReader;
39///Field `TAMP_PRCH` writer - RTC_TAMPx precharge duration
40pub type TAMP_PRCH_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
41///Field `TAMP_PUDIS` reader - RTC_TAMPx pull-up disable
42pub type TAMP_PUDIS_R = crate::BitReader;
43///Field `TAMP_PUDIS` writer - RTC_TAMPx pull-up disable
44pub type TAMP_PUDIS_W<'a, REG> = crate::BitWriter<'a, REG>;
45///Field `PC13VALUE` reader - RTC_ALARM output type/PC13 value
46pub type PC13VALUE_R = crate::BitReader;
47///Field `PC13VALUE` writer - RTC_ALARM output type/PC13 value
48pub type PC13VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
49///Field `PC13MODE` reader - PC13 mode
50pub type PC13MODE_R = crate::BitReader;
51///Field `PC13MODE` writer - PC13 mode
52pub type PC13MODE_W<'a, REG> = crate::BitWriter<'a, REG>;
53///Field `PC14VALUE` reader - PC14 value
54pub type PC14VALUE_R = crate::BitReader;
55///Field `PC14VALUE` writer - PC14 value
56pub type PC14VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
57///Field `PC14MODE` reader - PC14 mode
58pub type PC14MODE_R = crate::BitReader;
59///Field `PC14MODE` writer - PC14 mode
60pub type PC14MODE_W<'a, REG> = crate::BitWriter<'a, REG>;
61///Field `PC15VALUE` reader - PC15 value
62pub type PC15VALUE_R = crate::BitReader;
63///Field `PC15VALUE` writer - PC15 value
64pub type PC15VALUE_W<'a, REG> = crate::BitWriter<'a, REG>;
65///Field `PC15MODE` reader - PC15 mode
66pub type PC15MODE_R = crate::BitReader;
67///Field `PC15MODE` writer - PC15 mode
68pub type PC15MODE_W<'a, REG> = crate::BitWriter<'a, REG>;
69impl R {
70    ///Bit 0 - RTC_TAMP1 input detection enable
71    #[inline(always)]
72    pub fn tamp1e(&self) -> TAMP1E_R {
73        TAMP1E_R::new((self.bits & 1) != 0)
74    }
75    ///Bit 1 - Active level for RTC_TAMP1 input
76    #[inline(always)]
77    pub fn tamp1trg(&self) -> TAMP1TRG_R {
78        TAMP1TRG_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    ///Bit 2 - Tamper interrupt enable
81    #[inline(always)]
82    pub fn tampie(&self) -> TAMPIE_R {
83        TAMPIE_R::new(((self.bits >> 2) & 1) != 0)
84    }
85    ///Bit 3 - RTC_TAMP2 input detection enable
86    #[inline(always)]
87    pub fn tamp2e(&self) -> TAMP2E_R {
88        TAMP2E_R::new(((self.bits >> 3) & 1) != 0)
89    }
90    ///Bit 4 - Active level for RTC_TAMP2 input
91    #[inline(always)]
92    pub fn tamp2_trg(&self) -> TAMP2_TRG_R {
93        TAMP2_TRG_R::new(((self.bits >> 4) & 1) != 0)
94    }
95    ///Bit 7 - Activate timestamp on tamper detection event
96    #[inline(always)]
97    pub fn tampts(&self) -> TAMPTS_R {
98        TAMPTS_R::new(((self.bits >> 7) & 1) != 0)
99    }
100    ///Bits 8:10 - Tamper sampling frequency
101    #[inline(always)]
102    pub fn tampfreq(&self) -> TAMPFREQ_R {
103        TAMPFREQ_R::new(((self.bits >> 8) & 7) as u8)
104    }
105    ///Bits 11:12 - RTC_TAMPx filter count
106    #[inline(always)]
107    pub fn tampflt(&self) -> TAMPFLT_R {
108        TAMPFLT_R::new(((self.bits >> 11) & 3) as u8)
109    }
110    ///Bits 13:14 - RTC_TAMPx precharge duration
111    #[inline(always)]
112    pub fn tamp_prch(&self) -> TAMP_PRCH_R {
113        TAMP_PRCH_R::new(((self.bits >> 13) & 3) as u8)
114    }
115    ///Bit 15 - RTC_TAMPx pull-up disable
116    #[inline(always)]
117    pub fn tamp_pudis(&self) -> TAMP_PUDIS_R {
118        TAMP_PUDIS_R::new(((self.bits >> 15) & 1) != 0)
119    }
120    ///Bit 18 - RTC_ALARM output type/PC13 value
121    #[inline(always)]
122    pub fn pc13value(&self) -> PC13VALUE_R {
123        PC13VALUE_R::new(((self.bits >> 18) & 1) != 0)
124    }
125    ///Bit 19 - PC13 mode
126    #[inline(always)]
127    pub fn pc13mode(&self) -> PC13MODE_R {
128        PC13MODE_R::new(((self.bits >> 19) & 1) != 0)
129    }
130    ///Bit 20 - PC14 value
131    #[inline(always)]
132    pub fn pc14value(&self) -> PC14VALUE_R {
133        PC14VALUE_R::new(((self.bits >> 20) & 1) != 0)
134    }
135    ///Bit 21 - PC14 mode
136    #[inline(always)]
137    pub fn pc14mode(&self) -> PC14MODE_R {
138        PC14MODE_R::new(((self.bits >> 21) & 1) != 0)
139    }
140    ///Bit 22 - PC15 value
141    #[inline(always)]
142    pub fn pc15value(&self) -> PC15VALUE_R {
143        PC15VALUE_R::new(((self.bits >> 22) & 1) != 0)
144    }
145    ///Bit 23 - PC15 mode
146    #[inline(always)]
147    pub fn pc15mode(&self) -> PC15MODE_R {
148        PC15MODE_R::new(((self.bits >> 23) & 1) != 0)
149    }
150}
151impl core::fmt::Debug for R {
152    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
153        f.debug_struct("TAFCR")
154            .field("pc15mode", &self.pc15mode())
155            .field("pc15value", &self.pc15value())
156            .field("pc14mode", &self.pc14mode())
157            .field("pc14value", &self.pc14value())
158            .field("pc13mode", &self.pc13mode())
159            .field("pc13value", &self.pc13value())
160            .field("tamp_pudis", &self.tamp_pudis())
161            .field("tamp_prch", &self.tamp_prch())
162            .field("tampflt", &self.tampflt())
163            .field("tampfreq", &self.tampfreq())
164            .field("tampts", &self.tampts())
165            .field("tamp2_trg", &self.tamp2_trg())
166            .field("tamp2e", &self.tamp2e())
167            .field("tampie", &self.tampie())
168            .field("tamp1trg", &self.tamp1trg())
169            .field("tamp1e", &self.tamp1e())
170            .finish()
171    }
172}
173impl W {
174    ///Bit 0 - RTC_TAMP1 input detection enable
175    #[inline(always)]
176    pub fn tamp1e(&mut self) -> TAMP1E_W<TAFCRrs> {
177        TAMP1E_W::new(self, 0)
178    }
179    ///Bit 1 - Active level for RTC_TAMP1 input
180    #[inline(always)]
181    pub fn tamp1trg(&mut self) -> TAMP1TRG_W<TAFCRrs> {
182        TAMP1TRG_W::new(self, 1)
183    }
184    ///Bit 2 - Tamper interrupt enable
185    #[inline(always)]
186    pub fn tampie(&mut self) -> TAMPIE_W<TAFCRrs> {
187        TAMPIE_W::new(self, 2)
188    }
189    ///Bit 3 - RTC_TAMP2 input detection enable
190    #[inline(always)]
191    pub fn tamp2e(&mut self) -> TAMP2E_W<TAFCRrs> {
192        TAMP2E_W::new(self, 3)
193    }
194    ///Bit 4 - Active level for RTC_TAMP2 input
195    #[inline(always)]
196    pub fn tamp2_trg(&mut self) -> TAMP2_TRG_W<TAFCRrs> {
197        TAMP2_TRG_W::new(self, 4)
198    }
199    ///Bit 7 - Activate timestamp on tamper detection event
200    #[inline(always)]
201    pub fn tampts(&mut self) -> TAMPTS_W<TAFCRrs> {
202        TAMPTS_W::new(self, 7)
203    }
204    ///Bits 8:10 - Tamper sampling frequency
205    #[inline(always)]
206    pub fn tampfreq(&mut self) -> TAMPFREQ_W<TAFCRrs> {
207        TAMPFREQ_W::new(self, 8)
208    }
209    ///Bits 11:12 - RTC_TAMPx filter count
210    #[inline(always)]
211    pub fn tampflt(&mut self) -> TAMPFLT_W<TAFCRrs> {
212        TAMPFLT_W::new(self, 11)
213    }
214    ///Bits 13:14 - RTC_TAMPx precharge duration
215    #[inline(always)]
216    pub fn tamp_prch(&mut self) -> TAMP_PRCH_W<TAFCRrs> {
217        TAMP_PRCH_W::new(self, 13)
218    }
219    ///Bit 15 - RTC_TAMPx pull-up disable
220    #[inline(always)]
221    pub fn tamp_pudis(&mut self) -> TAMP_PUDIS_W<TAFCRrs> {
222        TAMP_PUDIS_W::new(self, 15)
223    }
224    ///Bit 18 - RTC_ALARM output type/PC13 value
225    #[inline(always)]
226    pub fn pc13value(&mut self) -> PC13VALUE_W<TAFCRrs> {
227        PC13VALUE_W::new(self, 18)
228    }
229    ///Bit 19 - PC13 mode
230    #[inline(always)]
231    pub fn pc13mode(&mut self) -> PC13MODE_W<TAFCRrs> {
232        PC13MODE_W::new(self, 19)
233    }
234    ///Bit 20 - PC14 value
235    #[inline(always)]
236    pub fn pc14value(&mut self) -> PC14VALUE_W<TAFCRrs> {
237        PC14VALUE_W::new(self, 20)
238    }
239    ///Bit 21 - PC14 mode
240    #[inline(always)]
241    pub fn pc14mode(&mut self) -> PC14MODE_W<TAFCRrs> {
242        PC14MODE_W::new(self, 21)
243    }
244    ///Bit 22 - PC15 value
245    #[inline(always)]
246    pub fn pc15value(&mut self) -> PC15VALUE_W<TAFCRrs> {
247        PC15VALUE_W::new(self, 22)
248    }
249    ///Bit 23 - PC15 mode
250    #[inline(always)]
251    pub fn pc15mode(&mut self) -> PC15MODE_W<TAFCRrs> {
252        PC15MODE_W::new(self, 23)
253    }
254}
255/**tamper and alternate function configuration register
256
257You can [`read`](crate::Reg::read) this register and get [`tafcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tafcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
258
259See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F0x1.html#RTC:TAFCR)*/
260pub struct TAFCRrs;
261impl crate::RegisterSpec for TAFCRrs {
262    type Ux = u32;
263}
264///`read()` method returns [`tafcr::R`](R) reader structure
265impl crate::Readable for TAFCRrs {}
266///`write(|w| ..)` method takes [`tafcr::W`](W) writer structure
267impl crate::Writable for TAFCRrs {
268    type Safety = crate::Unsafe;
269}
270///`reset()` method sets TAFCR to value 0
271impl crate::Resettable for TAFCRrs {}