stm32l1/stm32l100/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 - Tamper 1 detection enable
6pub type TAMP1E_R = crate::BitReader;
7///Field `TAMP1E` writer - Tamper 1 detection enable
8pub type TAMP1E_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `TAMP1ETRG` reader - Active level for tamper 1
10pub type TAMP1ETRG_R = crate::BitReader;
11///Field `TAMP1ETRG` writer - Active level for tamper 1
12pub type TAMP1ETRG_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 - Tamper 2 detection enable
18pub type TAMP2E_R = crate::BitReader;
19///Field `TAMP2E` writer - Tamper 2 detection enable
20pub type TAMP2E_W<'a, REG> = crate::BitWriter<'a, REG>;
21///Field `TAMP2TRG` reader - Active level for tamper 2
22pub type TAMP2TRG_R = crate::BitReader;
23///Field `TAMP2TRG` writer - Active level for tamper 2
24pub type TAMP2TRG_W<'a, REG> = crate::BitWriter<'a, REG>;
25///Field `TAMP3E` reader - TIMESTAMP mapping
26pub type TAMP3E_R = crate::BitReader;
27///Field `TAMP3E` writer - TIMESTAMP mapping
28pub type TAMP3E_W<'a, REG> = crate::BitWriter<'a, REG>;
29///Field `TAMP3TRG` reader - TAMPER1 mapping
30pub type TAMP3TRG_R = crate::BitReader;
31///Field `TAMP3TRG` writer - TAMPER1 mapping
32pub type TAMP3TRG_W<'a, REG> = crate::BitWriter<'a, REG>;
33///Field `TAMPTS` reader - Activate timestamp on tamper detection event
34pub type TAMPTS_R = crate::BitReader;
35///Field `TAMPTS` writer - Activate timestamp on tamper detection event
36pub type TAMPTS_W<'a, REG> = crate::BitWriter<'a, REG>;
37///Field `TAMPFREQ` reader - Tamper sampling frequency
38pub type TAMPFREQ_R = crate::FieldReader;
39///Field `TAMPFREQ` writer - Tamper sampling frequency
40pub type TAMPFREQ_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
41///Field `TAMPFLT` reader - Tamper filter count
42pub type TAMPFLT_R = crate::FieldReader;
43///Field `TAMPFLT` writer - Tamper filter count
44pub type TAMPFLT_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
45///Field `TAMPPRCH` reader - Tamper precharge duration
46pub type TAMPPRCH_R = crate::FieldReader;
47///Field `TAMPPRCH` writer - Tamper precharge duration
48pub type TAMPPRCH_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
49///Field `TAMPPUDIS` reader - TAMPER pull-up disable
50pub type TAMPPUDIS_R = crate::BitReader;
51///Field `TAMPPUDIS` writer - TAMPER pull-up disable
52pub type TAMPPUDIS_W<'a, REG> = crate::BitWriter<'a, REG>;
53///Field `ALARMOUTTYPE` reader - AFO_ALARM output type
54pub type ALARMOUTTYPE_R = crate::BitReader;
55///Field `ALARMOUTTYPE` writer - AFO_ALARM output type
56pub type ALARMOUTTYPE_W<'a, REG> = crate::BitWriter<'a, REG>;
57impl R {
58    ///Bit 0 - Tamper 1 detection enable
59    #[inline(always)]
60    pub fn tamp1e(&self) -> TAMP1E_R {
61        TAMP1E_R::new((self.bits & 1) != 0)
62    }
63    ///Bit 1 - Active level for tamper 1
64    #[inline(always)]
65    pub fn tamp1etrg(&self) -> TAMP1ETRG_R {
66        TAMP1ETRG_R::new(((self.bits >> 1) & 1) != 0)
67    }
68    ///Bit 2 - Tamper interrupt enable
69    #[inline(always)]
70    pub fn tampie(&self) -> TAMPIE_R {
71        TAMPIE_R::new(((self.bits >> 2) & 1) != 0)
72    }
73    ///Bit 3 - Tamper 2 detection enable
74    #[inline(always)]
75    pub fn tamp2e(&self) -> TAMP2E_R {
76        TAMP2E_R::new(((self.bits >> 3) & 1) != 0)
77    }
78    ///Bit 4 - Active level for tamper 2
79    #[inline(always)]
80    pub fn tamp2trg(&self) -> TAMP2TRG_R {
81        TAMP2TRG_R::new(((self.bits >> 4) & 1) != 0)
82    }
83    ///Bit 5 - TIMESTAMP mapping
84    #[inline(always)]
85    pub fn tamp3e(&self) -> TAMP3E_R {
86        TAMP3E_R::new(((self.bits >> 5) & 1) != 0)
87    }
88    ///Bit 6 - TAMPER1 mapping
89    #[inline(always)]
90    pub fn tamp3trg(&self) -> TAMP3TRG_R {
91        TAMP3TRG_R::new(((self.bits >> 6) & 1) != 0)
92    }
93    ///Bit 7 - Activate timestamp on tamper detection event
94    #[inline(always)]
95    pub fn tampts(&self) -> TAMPTS_R {
96        TAMPTS_R::new(((self.bits >> 7) & 1) != 0)
97    }
98    ///Bits 8:10 - Tamper sampling frequency
99    #[inline(always)]
100    pub fn tampfreq(&self) -> TAMPFREQ_R {
101        TAMPFREQ_R::new(((self.bits >> 8) & 7) as u8)
102    }
103    ///Bits 11:12 - Tamper filter count
104    #[inline(always)]
105    pub fn tampflt(&self) -> TAMPFLT_R {
106        TAMPFLT_R::new(((self.bits >> 11) & 3) as u8)
107    }
108    ///Bits 13:14 - Tamper precharge duration
109    #[inline(always)]
110    pub fn tampprch(&self) -> TAMPPRCH_R {
111        TAMPPRCH_R::new(((self.bits >> 13) & 3) as u8)
112    }
113    ///Bit 15 - TAMPER pull-up disable
114    #[inline(always)]
115    pub fn tamppudis(&self) -> TAMPPUDIS_R {
116        TAMPPUDIS_R::new(((self.bits >> 15) & 1) != 0)
117    }
118    ///Bit 18 - AFO_ALARM output type
119    #[inline(always)]
120    pub fn alarmouttype(&self) -> ALARMOUTTYPE_R {
121        ALARMOUTTYPE_R::new(((self.bits >> 18) & 1) != 0)
122    }
123}
124impl core::fmt::Debug for R {
125    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
126        f.debug_struct("TAFCR")
127            .field("alarmouttype", &self.alarmouttype())
128            .field("tamppudis", &self.tamppudis())
129            .field("tampprch", &self.tampprch())
130            .field("tampflt", &self.tampflt())
131            .field("tampfreq", &self.tampfreq())
132            .field("tampts", &self.tampts())
133            .field("tamp3trg", &self.tamp3trg())
134            .field("tamp3e", &self.tamp3e())
135            .field("tamp2trg", &self.tamp2trg())
136            .field("tamp2e", &self.tamp2e())
137            .field("tampie", &self.tampie())
138            .field("tamp1etrg", &self.tamp1etrg())
139            .field("tamp1e", &self.tamp1e())
140            .finish()
141    }
142}
143impl W {
144    ///Bit 0 - Tamper 1 detection enable
145    #[inline(always)]
146    pub fn tamp1e(&mut self) -> TAMP1E_W<TAFCRrs> {
147        TAMP1E_W::new(self, 0)
148    }
149    ///Bit 1 - Active level for tamper 1
150    #[inline(always)]
151    pub fn tamp1etrg(&mut self) -> TAMP1ETRG_W<TAFCRrs> {
152        TAMP1ETRG_W::new(self, 1)
153    }
154    ///Bit 2 - Tamper interrupt enable
155    #[inline(always)]
156    pub fn tampie(&mut self) -> TAMPIE_W<TAFCRrs> {
157        TAMPIE_W::new(self, 2)
158    }
159    ///Bit 3 - Tamper 2 detection enable
160    #[inline(always)]
161    pub fn tamp2e(&mut self) -> TAMP2E_W<TAFCRrs> {
162        TAMP2E_W::new(self, 3)
163    }
164    ///Bit 4 - Active level for tamper 2
165    #[inline(always)]
166    pub fn tamp2trg(&mut self) -> TAMP2TRG_W<TAFCRrs> {
167        TAMP2TRG_W::new(self, 4)
168    }
169    ///Bit 5 - TIMESTAMP mapping
170    #[inline(always)]
171    pub fn tamp3e(&mut self) -> TAMP3E_W<TAFCRrs> {
172        TAMP3E_W::new(self, 5)
173    }
174    ///Bit 6 - TAMPER1 mapping
175    #[inline(always)]
176    pub fn tamp3trg(&mut self) -> TAMP3TRG_W<TAFCRrs> {
177        TAMP3TRG_W::new(self, 6)
178    }
179    ///Bit 7 - Activate timestamp on tamper detection event
180    #[inline(always)]
181    pub fn tampts(&mut self) -> TAMPTS_W<TAFCRrs> {
182        TAMPTS_W::new(self, 7)
183    }
184    ///Bits 8:10 - Tamper sampling frequency
185    #[inline(always)]
186    pub fn tampfreq(&mut self) -> TAMPFREQ_W<TAFCRrs> {
187        TAMPFREQ_W::new(self, 8)
188    }
189    ///Bits 11:12 - Tamper filter count
190    #[inline(always)]
191    pub fn tampflt(&mut self) -> TAMPFLT_W<TAFCRrs> {
192        TAMPFLT_W::new(self, 11)
193    }
194    ///Bits 13:14 - Tamper precharge duration
195    #[inline(always)]
196    pub fn tampprch(&mut self) -> TAMPPRCH_W<TAFCRrs> {
197        TAMPPRCH_W::new(self, 13)
198    }
199    ///Bit 15 - TAMPER pull-up disable
200    #[inline(always)]
201    pub fn tamppudis(&mut self) -> TAMPPUDIS_W<TAFCRrs> {
202        TAMPPUDIS_W::new(self, 15)
203    }
204    ///Bit 18 - AFO_ALARM output type
205    #[inline(always)]
206    pub fn alarmouttype(&mut self) -> ALARMOUTTYPE_W<TAFCRrs> {
207        ALARMOUTTYPE_W::new(self, 18)
208    }
209}
210/**tamper and alternate function configuration register
211
212You 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).
213
214See register [structure](https://stm32-rs.github.io/stm32-rs/STM32L100.html#RTC:TAFCR)*/
215pub struct TAFCRrs;
216impl crate::RegisterSpec for TAFCRrs {
217    type Ux = u32;
218}
219///`read()` method returns [`tafcr::R`](R) reader structure
220impl crate::Readable for TAFCRrs {}
221///`write(|w| ..)` method takes [`tafcr::W`](W) writer structure
222impl crate::Writable for TAFCRrs {
223    type Safety = crate::Unsafe;
224}
225///`reset()` method sets TAFCR to value 0
226impl crate::Resettable for TAFCRrs {}