ra2l1/iic0wu/
icwur.rs

1#[doc = "Register `ICWUR` reader"]
2pub struct R(crate::R<ICWUR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ICWUR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ICWUR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ICWUR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ICWUR` writer"]
17pub struct W(crate::W<ICWUR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ICWUR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<ICWUR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ICWUR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `WUAFA` reader - Wakeup Analog Filter Additional Selection"]
38pub type WUAFA_R = crate::BitReader<WUAFA_A>;
39#[doc = "Wakeup Analog Filter Additional Selection\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum WUAFA_A {
42    #[doc = "0: Do not add the wakeup analog filter"]
43    _0 = 0,
44    #[doc = "1: Add the wakeup analog filter"]
45    _1 = 1,
46}
47impl From<WUAFA_A> for bool {
48    #[inline(always)]
49    fn from(variant: WUAFA_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl WUAFA_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> WUAFA_A {
57        match self.bits {
58            false => WUAFA_A::_0,
59            true => WUAFA_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == WUAFA_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == WUAFA_A::_1
71    }
72}
73#[doc = "Field `WUAFA` writer - Wakeup Analog Filter Additional Selection"]
74pub type WUAFA_W<'a, const O: u8> = crate::BitWriter<'a, u8, ICWUR_SPEC, WUAFA_A, O>;
75impl<'a, const O: u8> WUAFA_W<'a, O> {
76    #[doc = "Do not add the wakeup analog filter"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(WUAFA_A::_0)
80    }
81    #[doc = "Add the wakeup analog filter"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(WUAFA_A::_1)
85    }
86}
87#[doc = "Field `WUACK` reader - ACK Bit for Wakeup Mode"]
88pub type WUACK_R = crate::BitReader<bool>;
89#[doc = "Field `WUACK` writer - ACK Bit for Wakeup Mode"]
90pub type WUACK_W<'a, const O: u8> = crate::BitWriter<'a, u8, ICWUR_SPEC, bool, O>;
91#[doc = "Field `WUF` reader - Wakeup Event Occurrence Flag"]
92pub type WUF_R = crate::BitReader<WUF_A>;
93#[doc = "Wakeup Event Occurrence Flag\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum WUF_A {
96    #[doc = "0: Slave address not matching during wakeup"]
97    _0 = 0,
98    #[doc = "1: Slave address matching during wakeup"]
99    _1 = 1,
100}
101impl From<WUF_A> for bool {
102    #[inline(always)]
103    fn from(variant: WUF_A) -> Self {
104        variant as u8 != 0
105    }
106}
107impl WUF_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> WUF_A {
111        match self.bits {
112            false => WUF_A::_0,
113            true => WUF_A::_1,
114        }
115    }
116    #[doc = "Checks if the value of the field is `_0`"]
117    #[inline(always)]
118    pub fn is_0(&self) -> bool {
119        *self == WUF_A::_0
120    }
121    #[doc = "Checks if the value of the field is `_1`"]
122    #[inline(always)]
123    pub fn is_1(&self) -> bool {
124        *self == WUF_A::_1
125    }
126}
127#[doc = "Field `WUF` writer - Wakeup Event Occurrence Flag"]
128pub type WUF_W<'a, const O: u8> = crate::BitWriter<'a, u8, ICWUR_SPEC, WUF_A, O>;
129impl<'a, const O: u8> WUF_W<'a, O> {
130    #[doc = "Slave address not matching during wakeup"]
131    #[inline(always)]
132    pub fn _0(self) -> &'a mut W {
133        self.variant(WUF_A::_0)
134    }
135    #[doc = "Slave address matching during wakeup"]
136    #[inline(always)]
137    pub fn _1(self) -> &'a mut W {
138        self.variant(WUF_A::_1)
139    }
140}
141#[doc = "Field `WUIE` reader - Wakeup Interrupt Request Enable"]
142pub type WUIE_R = crate::BitReader<WUIE_A>;
143#[doc = "Wakeup Interrupt Request Enable\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum WUIE_A {
146    #[doc = "0: Disable wakeup interrupt request (IIC0_WUI)"]
147    _0 = 0,
148    #[doc = "1: Enable wakeup interrupt request (IIC0_WUI)"]
149    _1 = 1,
150}
151impl From<WUIE_A> for bool {
152    #[inline(always)]
153    fn from(variant: WUIE_A) -> Self {
154        variant as u8 != 0
155    }
156}
157impl WUIE_R {
158    #[doc = "Get enumerated values variant"]
159    #[inline(always)]
160    pub fn variant(&self) -> WUIE_A {
161        match self.bits {
162            false => WUIE_A::_0,
163            true => WUIE_A::_1,
164        }
165    }
166    #[doc = "Checks if the value of the field is `_0`"]
167    #[inline(always)]
168    pub fn is_0(&self) -> bool {
169        *self == WUIE_A::_0
170    }
171    #[doc = "Checks if the value of the field is `_1`"]
172    #[inline(always)]
173    pub fn is_1(&self) -> bool {
174        *self == WUIE_A::_1
175    }
176}
177#[doc = "Field `WUIE` writer - Wakeup Interrupt Request Enable"]
178pub type WUIE_W<'a, const O: u8> = crate::BitWriter<'a, u8, ICWUR_SPEC, WUIE_A, O>;
179impl<'a, const O: u8> WUIE_W<'a, O> {
180    #[doc = "Disable wakeup interrupt request (IIC0_WUI)"]
181    #[inline(always)]
182    pub fn _0(self) -> &'a mut W {
183        self.variant(WUIE_A::_0)
184    }
185    #[doc = "Enable wakeup interrupt request (IIC0_WUI)"]
186    #[inline(always)]
187    pub fn _1(self) -> &'a mut W {
188        self.variant(WUIE_A::_1)
189    }
190}
191#[doc = "Field `WUE` reader - Wakeup Function Enable"]
192pub type WUE_R = crate::BitReader<WUE_A>;
193#[doc = "Wakeup Function Enable\n\nValue on reset: 0"]
194#[derive(Clone, Copy, Debug, PartialEq, Eq)]
195pub enum WUE_A {
196    #[doc = "0: Disable wakeup function"]
197    _0 = 0,
198    #[doc = "1: Enable wakeup function"]
199    _1 = 1,
200}
201impl From<WUE_A> for bool {
202    #[inline(always)]
203    fn from(variant: WUE_A) -> Self {
204        variant as u8 != 0
205    }
206}
207impl WUE_R {
208    #[doc = "Get enumerated values variant"]
209    #[inline(always)]
210    pub fn variant(&self) -> WUE_A {
211        match self.bits {
212            false => WUE_A::_0,
213            true => WUE_A::_1,
214        }
215    }
216    #[doc = "Checks if the value of the field is `_0`"]
217    #[inline(always)]
218    pub fn is_0(&self) -> bool {
219        *self == WUE_A::_0
220    }
221    #[doc = "Checks if the value of the field is `_1`"]
222    #[inline(always)]
223    pub fn is_1(&self) -> bool {
224        *self == WUE_A::_1
225    }
226}
227#[doc = "Field `WUE` writer - Wakeup Function Enable"]
228pub type WUE_W<'a, const O: u8> = crate::BitWriter<'a, u8, ICWUR_SPEC, WUE_A, O>;
229impl<'a, const O: u8> WUE_W<'a, O> {
230    #[doc = "Disable wakeup function"]
231    #[inline(always)]
232    pub fn _0(self) -> &'a mut W {
233        self.variant(WUE_A::_0)
234    }
235    #[doc = "Enable wakeup function"]
236    #[inline(always)]
237    pub fn _1(self) -> &'a mut W {
238        self.variant(WUE_A::_1)
239    }
240}
241impl R {
242    #[doc = "Bit 0 - Wakeup Analog Filter Additional Selection"]
243    #[inline(always)]
244    pub fn wuafa(&self) -> WUAFA_R {
245        WUAFA_R::new((self.bits & 1) != 0)
246    }
247    #[doc = "Bit 4 - ACK Bit for Wakeup Mode"]
248    #[inline(always)]
249    pub fn wuack(&self) -> WUACK_R {
250        WUACK_R::new(((self.bits >> 4) & 1) != 0)
251    }
252    #[doc = "Bit 5 - Wakeup Event Occurrence Flag"]
253    #[inline(always)]
254    pub fn wuf(&self) -> WUF_R {
255        WUF_R::new(((self.bits >> 5) & 1) != 0)
256    }
257    #[doc = "Bit 6 - Wakeup Interrupt Request Enable"]
258    #[inline(always)]
259    pub fn wuie(&self) -> WUIE_R {
260        WUIE_R::new(((self.bits >> 6) & 1) != 0)
261    }
262    #[doc = "Bit 7 - Wakeup Function Enable"]
263    #[inline(always)]
264    pub fn wue(&self) -> WUE_R {
265        WUE_R::new(((self.bits >> 7) & 1) != 0)
266    }
267}
268impl W {
269    #[doc = "Bit 0 - Wakeup Analog Filter Additional Selection"]
270    #[inline(always)]
271    #[must_use]
272    pub fn wuafa(&mut self) -> WUAFA_W<0> {
273        WUAFA_W::new(self)
274    }
275    #[doc = "Bit 4 - ACK Bit for Wakeup Mode"]
276    #[inline(always)]
277    #[must_use]
278    pub fn wuack(&mut self) -> WUACK_W<4> {
279        WUACK_W::new(self)
280    }
281    #[doc = "Bit 5 - Wakeup Event Occurrence Flag"]
282    #[inline(always)]
283    #[must_use]
284    pub fn wuf(&mut self) -> WUF_W<5> {
285        WUF_W::new(self)
286    }
287    #[doc = "Bit 6 - Wakeup Interrupt Request Enable"]
288    #[inline(always)]
289    #[must_use]
290    pub fn wuie(&mut self) -> WUIE_W<6> {
291        WUIE_W::new(self)
292    }
293    #[doc = "Bit 7 - Wakeup Function Enable"]
294    #[inline(always)]
295    #[must_use]
296    pub fn wue(&mut self) -> WUE_W<7> {
297        WUE_W::new(self)
298    }
299    #[doc = "Writes raw bits to the register."]
300    #[inline(always)]
301    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
302        self.0.bits(bits);
303        self
304    }
305}
306#[doc = "I2C Bus Wakeup Unit Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [icwur](index.html) module"]
307pub struct ICWUR_SPEC;
308impl crate::RegisterSpec for ICWUR_SPEC {
309    type Ux = u8;
310}
311#[doc = "`read()` method returns [icwur::R](R) reader structure"]
312impl crate::Readable for ICWUR_SPEC {
313    type Reader = R;
314}
315#[doc = "`write(|w| ..)` method takes [icwur::W](W) writer structure"]
316impl crate::Writable for ICWUR_SPEC {
317    type Writer = W;
318    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
319    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
320}
321#[doc = "`reset()` method sets ICWUR to value 0x10"]
322impl crate::Resettable for ICWUR_SPEC {
323    const RESET_VALUE: Self::Ux = 0x10;
324}