cc2538/i2cs/
icr.rs

1#[doc = "Reader of register ICR"]
2pub type R = crate::R<u32, super::ICR>;
3#[doc = "Writer for register ICR"]
4pub type W = crate::W<u32, super::ICR>;
5#[doc = "Register ICR `reset()`'s with value 0"]
6impl crate::ResetValue for super::ICR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `Reserved29`"]
14pub type RESERVED29_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `Reserved29`"]
16pub struct RESERVED29_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> RESERVED29_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x1fff_ffff << 3)) | (((value as u32) & 0x1fff_ffff) << 3);
24        self.w
25    }
26}
27#[doc = "Reader of field `STOPIC`"]
28pub type STOPIC_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `STOPIC`"]
30pub struct STOPIC_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> STOPIC_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
48        self.w
49    }
50}
51#[doc = "Reader of field `STARTIC`"]
52pub type STARTIC_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `STARTIC`"]
54pub struct STARTIC_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> STARTIC_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
72        self.w
73    }
74}
75#[doc = "Reader of field `DATAIC`"]
76pub type DATAIC_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `DATAIC`"]
78pub struct DATAIC_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> DATAIC_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
96        self.w
97    }
98}
99impl R {
100    #[doc = "Bits 3:31 - 31:3\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
101    #[inline(always)]
102    pub fn reserved29(&self) -> RESERVED29_R {
103        RESERVED29_R::new(((self.bits >> 3) & 0x1fff_ffff) as u32)
104    }
105    #[doc = "Bit 2 - 2:2\\] Stop condition interrupt clear Writing 1 to this bit clears the STOPRIS bit in the I2CSRIS register and the STOPMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
106    #[inline(always)]
107    pub fn stopic(&self) -> STOPIC_R {
108        STOPIC_R::new(((self.bits >> 2) & 0x01) != 0)
109    }
110    #[doc = "Bit 1 - 1:1\\] Start condition interrupt vlear Writing 1 to this bit clears the STARTRIS bit in the I2CSRIS register and the STARTMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
111    #[inline(always)]
112    pub fn startic(&self) -> STARTIC_R {
113        STARTIC_R::new(((self.bits >> 1) & 0x01) != 0)
114    }
115    #[doc = "Bit 0 - 0:0\\] Data interrupt clear Writing 1 to this bit clears the DATARIS bit in the I2CSRIS register and the DATAMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
116    #[inline(always)]
117    pub fn dataic(&self) -> DATAIC_R {
118        DATAIC_R::new((self.bits & 0x01) != 0)
119    }
120}
121impl W {
122    #[doc = "Bits 3:31 - 31:3\\] Software should not rely on the value of a reserved bit. To provide compatibility with future products, the value of a reserved bit should be preserved across a read-modify-write operation."]
123    #[inline(always)]
124    pub fn reserved29(&mut self) -> RESERVED29_W {
125        RESERVED29_W { w: self }
126    }
127    #[doc = "Bit 2 - 2:2\\] Stop condition interrupt clear Writing 1 to this bit clears the STOPRIS bit in the I2CSRIS register and the STOPMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
128    #[inline(always)]
129    pub fn stopic(&mut self) -> STOPIC_W {
130        STOPIC_W { w: self }
131    }
132    #[doc = "Bit 1 - 1:1\\] Start condition interrupt vlear Writing 1 to this bit clears the STARTRIS bit in the I2CSRIS register and the STARTMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
133    #[inline(always)]
134    pub fn startic(&mut self) -> STARTIC_W {
135        STARTIC_W { w: self }
136    }
137    #[doc = "Bit 0 - 0:0\\] Data interrupt clear Writing 1 to this bit clears the DATARIS bit in the I2CSRIS register and the DATAMIS bit in the I2CSMIS register. A read of this register returns no meaningful data."]
138    #[inline(always)]
139    pub fn dataic(&mut self) -> DATAIC_W {
140        DATAIC_W { w: self }
141    }
142}