mk66f18/i2c3/
s.rs

1#[doc = "Reader of register S"]
2pub type R = crate::R<u8, super::S>;
3#[doc = "Writer for register S"]
4pub type W = crate::W<u8, super::S>;
5#[doc = "Register S `reset()`'s with value 0x80"]
6impl crate::ResetValue for super::S {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0x80
11    }
12}
13#[doc = "Receive Acknowledge\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum RXAK_A {
16    #[doc = "0: Acknowledge signal was received after the completion of one byte of data transmission on the bus"]
17    _0,
18    #[doc = "1: No acknowledge signal detected"]
19    _1,
20}
21impl From<RXAK_A> for bool {
22    #[inline(always)]
23    fn from(variant: RXAK_A) -> Self {
24        match variant {
25            RXAK_A::_0 => false,
26            RXAK_A::_1 => true,
27        }
28    }
29}
30#[doc = "Reader of field `RXAK`"]
31pub type RXAK_R = crate::R<bool, RXAK_A>;
32impl RXAK_R {
33    #[doc = r"Get enumerated values variant"]
34    #[inline(always)]
35    pub fn variant(&self) -> RXAK_A {
36        match self.bits {
37            false => RXAK_A::_0,
38            true => RXAK_A::_1,
39        }
40    }
41    #[doc = "Checks if the value of the field is `_0`"]
42    #[inline(always)]
43    pub fn is_0(&self) -> bool {
44        *self == RXAK_A::_0
45    }
46    #[doc = "Checks if the value of the field is `_1`"]
47    #[inline(always)]
48    pub fn is_1(&self) -> bool {
49        *self == RXAK_A::_1
50    }
51}
52#[doc = "Interrupt Flag\n\nValue on reset: 0"]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub enum IICIF_A {
55    #[doc = "0: No interrupt pending"]
56    _0,
57    #[doc = "1: Interrupt pending"]
58    _1,
59}
60impl From<IICIF_A> for bool {
61    #[inline(always)]
62    fn from(variant: IICIF_A) -> Self {
63        match variant {
64            IICIF_A::_0 => false,
65            IICIF_A::_1 => true,
66        }
67    }
68}
69#[doc = "Reader of field `IICIF`"]
70pub type IICIF_R = crate::R<bool, IICIF_A>;
71impl IICIF_R {
72    #[doc = r"Get enumerated values variant"]
73    #[inline(always)]
74    pub fn variant(&self) -> IICIF_A {
75        match self.bits {
76            false => IICIF_A::_0,
77            true => IICIF_A::_1,
78        }
79    }
80    #[doc = "Checks if the value of the field is `_0`"]
81    #[inline(always)]
82    pub fn is_0(&self) -> bool {
83        *self == IICIF_A::_0
84    }
85    #[doc = "Checks if the value of the field is `_1`"]
86    #[inline(always)]
87    pub fn is_1(&self) -> bool {
88        *self == IICIF_A::_1
89    }
90}
91#[doc = "Write proxy for field `IICIF`"]
92pub struct IICIF_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> IICIF_W<'a> {
96    #[doc = r"Writes `variant` to the field"]
97    #[inline(always)]
98    pub fn variant(self, variant: IICIF_A) -> &'a mut W {
99        {
100            self.bit(variant.into())
101        }
102    }
103    #[doc = "No interrupt pending"]
104    #[inline(always)]
105    pub fn _0(self) -> &'a mut W {
106        self.variant(IICIF_A::_0)
107    }
108    #[doc = "Interrupt pending"]
109    #[inline(always)]
110    pub fn _1(self) -> &'a mut W {
111        self.variant(IICIF_A::_1)
112    }
113    #[doc = r"Sets the field bit"]
114    #[inline(always)]
115    pub fn set_bit(self) -> &'a mut W {
116        self.bit(true)
117    }
118    #[doc = r"Clears the field bit"]
119    #[inline(always)]
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(always)]
125    pub fn bit(self, value: bool) -> &'a mut W {
126        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1);
127        self.w
128    }
129}
130#[doc = "Slave Read/Write\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub enum SRW_A {
133    #[doc = "0: Slave receive, master writing to slave"]
134    _0,
135    #[doc = "1: Slave transmit, master reading from slave"]
136    _1,
137}
138impl From<SRW_A> for bool {
139    #[inline(always)]
140    fn from(variant: SRW_A) -> Self {
141        match variant {
142            SRW_A::_0 => false,
143            SRW_A::_1 => true,
144        }
145    }
146}
147#[doc = "Reader of field `SRW`"]
148pub type SRW_R = crate::R<bool, SRW_A>;
149impl SRW_R {
150    #[doc = r"Get enumerated values variant"]
151    #[inline(always)]
152    pub fn variant(&self) -> SRW_A {
153        match self.bits {
154            false => SRW_A::_0,
155            true => SRW_A::_1,
156        }
157    }
158    #[doc = "Checks if the value of the field is `_0`"]
159    #[inline(always)]
160    pub fn is_0(&self) -> bool {
161        *self == SRW_A::_0
162    }
163    #[doc = "Checks if the value of the field is `_1`"]
164    #[inline(always)]
165    pub fn is_1(&self) -> bool {
166        *self == SRW_A::_1
167    }
168}
169#[doc = "Range Address Match\n\nValue on reset: 0"]
170#[derive(Clone, Copy, Debug, PartialEq)]
171pub enum RAM_A {
172    #[doc = "0: Not addressed"]
173    _0,
174    #[doc = "1: Addressed as a slave"]
175    _1,
176}
177impl From<RAM_A> for bool {
178    #[inline(always)]
179    fn from(variant: RAM_A) -> Self {
180        match variant {
181            RAM_A::_0 => false,
182            RAM_A::_1 => true,
183        }
184    }
185}
186#[doc = "Reader of field `RAM`"]
187pub type RAM_R = crate::R<bool, RAM_A>;
188impl RAM_R {
189    #[doc = r"Get enumerated values variant"]
190    #[inline(always)]
191    pub fn variant(&self) -> RAM_A {
192        match self.bits {
193            false => RAM_A::_0,
194            true => RAM_A::_1,
195        }
196    }
197    #[doc = "Checks if the value of the field is `_0`"]
198    #[inline(always)]
199    pub fn is_0(&self) -> bool {
200        *self == RAM_A::_0
201    }
202    #[doc = "Checks if the value of the field is `_1`"]
203    #[inline(always)]
204    pub fn is_1(&self) -> bool {
205        *self == RAM_A::_1
206    }
207}
208#[doc = "Write proxy for field `RAM`"]
209pub struct RAM_W<'a> {
210    w: &'a mut W,
211}
212impl<'a> RAM_W<'a> {
213    #[doc = r"Writes `variant` to the field"]
214    #[inline(always)]
215    pub fn variant(self, variant: RAM_A) -> &'a mut W {
216        {
217            self.bit(variant.into())
218        }
219    }
220    #[doc = "Not addressed"]
221    #[inline(always)]
222    pub fn _0(self) -> &'a mut W {
223        self.variant(RAM_A::_0)
224    }
225    #[doc = "Addressed as a slave"]
226    #[inline(always)]
227    pub fn _1(self) -> &'a mut W {
228        self.variant(RAM_A::_1)
229    }
230    #[doc = r"Sets the field bit"]
231    #[inline(always)]
232    pub fn set_bit(self) -> &'a mut W {
233        self.bit(true)
234    }
235    #[doc = r"Clears the field bit"]
236    #[inline(always)]
237    pub fn clear_bit(self) -> &'a mut W {
238        self.bit(false)
239    }
240    #[doc = r"Writes raw bits to the field"]
241    #[inline(always)]
242    pub fn bit(self, value: bool) -> &'a mut W {
243        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u8) & 0x01) << 3);
244        self.w
245    }
246}
247#[doc = "Arbitration Lost\n\nValue on reset: 0"]
248#[derive(Clone, Copy, Debug, PartialEq)]
249pub enum ARBL_A {
250    #[doc = "0: Standard bus operation."]
251    _0,
252    #[doc = "1: Loss of arbitration."]
253    _1,
254}
255impl From<ARBL_A> for bool {
256    #[inline(always)]
257    fn from(variant: ARBL_A) -> Self {
258        match variant {
259            ARBL_A::_0 => false,
260            ARBL_A::_1 => true,
261        }
262    }
263}
264#[doc = "Reader of field `ARBL`"]
265pub type ARBL_R = crate::R<bool, ARBL_A>;
266impl ARBL_R {
267    #[doc = r"Get enumerated values variant"]
268    #[inline(always)]
269    pub fn variant(&self) -> ARBL_A {
270        match self.bits {
271            false => ARBL_A::_0,
272            true => ARBL_A::_1,
273        }
274    }
275    #[doc = "Checks if the value of the field is `_0`"]
276    #[inline(always)]
277    pub fn is_0(&self) -> bool {
278        *self == ARBL_A::_0
279    }
280    #[doc = "Checks if the value of the field is `_1`"]
281    #[inline(always)]
282    pub fn is_1(&self) -> bool {
283        *self == ARBL_A::_1
284    }
285}
286#[doc = "Write proxy for field `ARBL`"]
287pub struct ARBL_W<'a> {
288    w: &'a mut W,
289}
290impl<'a> ARBL_W<'a> {
291    #[doc = r"Writes `variant` to the field"]
292    #[inline(always)]
293    pub fn variant(self, variant: ARBL_A) -> &'a mut W {
294        {
295            self.bit(variant.into())
296        }
297    }
298    #[doc = "Standard bus operation."]
299    #[inline(always)]
300    pub fn _0(self) -> &'a mut W {
301        self.variant(ARBL_A::_0)
302    }
303    #[doc = "Loss of arbitration."]
304    #[inline(always)]
305    pub fn _1(self) -> &'a mut W {
306        self.variant(ARBL_A::_1)
307    }
308    #[doc = r"Sets the field bit"]
309    #[inline(always)]
310    pub fn set_bit(self) -> &'a mut W {
311        self.bit(true)
312    }
313    #[doc = r"Clears the field bit"]
314    #[inline(always)]
315    pub fn clear_bit(self) -> &'a mut W {
316        self.bit(false)
317    }
318    #[doc = r"Writes raw bits to the field"]
319    #[inline(always)]
320    pub fn bit(self, value: bool) -> &'a mut W {
321        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
322        self.w
323    }
324}
325#[doc = "Bus Busy\n\nValue on reset: 0"]
326#[derive(Clone, Copy, Debug, PartialEq)]
327pub enum BUSY_A {
328    #[doc = "0: Bus is idle"]
329    _0,
330    #[doc = "1: Bus is busy"]
331    _1,
332}
333impl From<BUSY_A> for bool {
334    #[inline(always)]
335    fn from(variant: BUSY_A) -> Self {
336        match variant {
337            BUSY_A::_0 => false,
338            BUSY_A::_1 => true,
339        }
340    }
341}
342#[doc = "Reader of field `BUSY`"]
343pub type BUSY_R = crate::R<bool, BUSY_A>;
344impl BUSY_R {
345    #[doc = r"Get enumerated values variant"]
346    #[inline(always)]
347    pub fn variant(&self) -> BUSY_A {
348        match self.bits {
349            false => BUSY_A::_0,
350            true => BUSY_A::_1,
351        }
352    }
353    #[doc = "Checks if the value of the field is `_0`"]
354    #[inline(always)]
355    pub fn is_0(&self) -> bool {
356        *self == BUSY_A::_0
357    }
358    #[doc = "Checks if the value of the field is `_1`"]
359    #[inline(always)]
360    pub fn is_1(&self) -> bool {
361        *self == BUSY_A::_1
362    }
363}
364#[doc = "Addressed As A Slave\n\nValue on reset: 0"]
365#[derive(Clone, Copy, Debug, PartialEq)]
366pub enum IAAS_A {
367    #[doc = "0: Not addressed"]
368    _0,
369    #[doc = "1: Addressed as a slave"]
370    _1,
371}
372impl From<IAAS_A> for bool {
373    #[inline(always)]
374    fn from(variant: IAAS_A) -> Self {
375        match variant {
376            IAAS_A::_0 => false,
377            IAAS_A::_1 => true,
378        }
379    }
380}
381#[doc = "Reader of field `IAAS`"]
382pub type IAAS_R = crate::R<bool, IAAS_A>;
383impl IAAS_R {
384    #[doc = r"Get enumerated values variant"]
385    #[inline(always)]
386    pub fn variant(&self) -> IAAS_A {
387        match self.bits {
388            false => IAAS_A::_0,
389            true => IAAS_A::_1,
390        }
391    }
392    #[doc = "Checks if the value of the field is `_0`"]
393    #[inline(always)]
394    pub fn is_0(&self) -> bool {
395        *self == IAAS_A::_0
396    }
397    #[doc = "Checks if the value of the field is `_1`"]
398    #[inline(always)]
399    pub fn is_1(&self) -> bool {
400        *self == IAAS_A::_1
401    }
402}
403#[doc = "Write proxy for field `IAAS`"]
404pub struct IAAS_W<'a> {
405    w: &'a mut W,
406}
407impl<'a> IAAS_W<'a> {
408    #[doc = r"Writes `variant` to the field"]
409    #[inline(always)]
410    pub fn variant(self, variant: IAAS_A) -> &'a mut W {
411        {
412            self.bit(variant.into())
413        }
414    }
415    #[doc = "Not addressed"]
416    #[inline(always)]
417    pub fn _0(self) -> &'a mut W {
418        self.variant(IAAS_A::_0)
419    }
420    #[doc = "Addressed as a slave"]
421    #[inline(always)]
422    pub fn _1(self) -> &'a mut W {
423        self.variant(IAAS_A::_1)
424    }
425    #[doc = r"Sets the field bit"]
426    #[inline(always)]
427    pub fn set_bit(self) -> &'a mut W {
428        self.bit(true)
429    }
430    #[doc = r"Clears the field bit"]
431    #[inline(always)]
432    pub fn clear_bit(self) -> &'a mut W {
433        self.bit(false)
434    }
435    #[doc = r"Writes raw bits to the field"]
436    #[inline(always)]
437    pub fn bit(self, value: bool) -> &'a mut W {
438        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
439        self.w
440    }
441}
442#[doc = "Transfer Complete Flag\n\nValue on reset: 1"]
443#[derive(Clone, Copy, Debug, PartialEq)]
444pub enum TCF_A {
445    #[doc = "0: Transfer in progress"]
446    _0,
447    #[doc = "1: Transfer complete"]
448    _1,
449}
450impl From<TCF_A> for bool {
451    #[inline(always)]
452    fn from(variant: TCF_A) -> Self {
453        match variant {
454            TCF_A::_0 => false,
455            TCF_A::_1 => true,
456        }
457    }
458}
459#[doc = "Reader of field `TCF`"]
460pub type TCF_R = crate::R<bool, TCF_A>;
461impl TCF_R {
462    #[doc = r"Get enumerated values variant"]
463    #[inline(always)]
464    pub fn variant(&self) -> TCF_A {
465        match self.bits {
466            false => TCF_A::_0,
467            true => TCF_A::_1,
468        }
469    }
470    #[doc = "Checks if the value of the field is `_0`"]
471    #[inline(always)]
472    pub fn is_0(&self) -> bool {
473        *self == TCF_A::_0
474    }
475    #[doc = "Checks if the value of the field is `_1`"]
476    #[inline(always)]
477    pub fn is_1(&self) -> bool {
478        *self == TCF_A::_1
479    }
480}
481impl R {
482    #[doc = "Bit 0 - Receive Acknowledge"]
483    #[inline(always)]
484    pub fn rxak(&self) -> RXAK_R {
485        RXAK_R::new((self.bits & 0x01) != 0)
486    }
487    #[doc = "Bit 1 - Interrupt Flag"]
488    #[inline(always)]
489    pub fn iicif(&self) -> IICIF_R {
490        IICIF_R::new(((self.bits >> 1) & 0x01) != 0)
491    }
492    #[doc = "Bit 2 - Slave Read/Write"]
493    #[inline(always)]
494    pub fn srw(&self) -> SRW_R {
495        SRW_R::new(((self.bits >> 2) & 0x01) != 0)
496    }
497    #[doc = "Bit 3 - Range Address Match"]
498    #[inline(always)]
499    pub fn ram(&self) -> RAM_R {
500        RAM_R::new(((self.bits >> 3) & 0x01) != 0)
501    }
502    #[doc = "Bit 4 - Arbitration Lost"]
503    #[inline(always)]
504    pub fn arbl(&self) -> ARBL_R {
505        ARBL_R::new(((self.bits >> 4) & 0x01) != 0)
506    }
507    #[doc = "Bit 5 - Bus Busy"]
508    #[inline(always)]
509    pub fn busy(&self) -> BUSY_R {
510        BUSY_R::new(((self.bits >> 5) & 0x01) != 0)
511    }
512    #[doc = "Bit 6 - Addressed As A Slave"]
513    #[inline(always)]
514    pub fn iaas(&self) -> IAAS_R {
515        IAAS_R::new(((self.bits >> 6) & 0x01) != 0)
516    }
517    #[doc = "Bit 7 - Transfer Complete Flag"]
518    #[inline(always)]
519    pub fn tcf(&self) -> TCF_R {
520        TCF_R::new(((self.bits >> 7) & 0x01) != 0)
521    }
522}
523impl W {
524    #[doc = "Bit 1 - Interrupt Flag"]
525    #[inline(always)]
526    pub fn iicif(&mut self) -> IICIF_W {
527        IICIF_W { w: self }
528    }
529    #[doc = "Bit 3 - Range Address Match"]
530    #[inline(always)]
531    pub fn ram(&mut self) -> RAM_W {
532        RAM_W { w: self }
533    }
534    #[doc = "Bit 4 - Arbitration Lost"]
535    #[inline(always)]
536    pub fn arbl(&mut self) -> ARBL_W {
537        ARBL_W { w: self }
538    }
539    #[doc = "Bit 6 - Addressed As A Slave"]
540    #[inline(always)]
541    pub fn iaas(&mut self) -> IAAS_W {
542        IAAS_W { w: self }
543    }
544}