lpc82x_pac/i2c0/
monrxdat.rs

1#[doc = "Register `MONRXDAT` reader"]
2pub struct R(crate::R<MONRXDAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<MONRXDAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<MONRXDAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<MONRXDAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `MONRXDAT` reader - Monitor function Receiver Data. This reflects every data byte that passes on the I2C pins."]
17pub struct MONRXDAT_R(crate::FieldReader<u8, u8>);
18impl MONRXDAT_R {
19    pub(crate) fn new(bits: u8) -> Self {
20        MONRXDAT_R(crate::FieldReader::new(bits))
21    }
22}
23impl core::ops::Deref for MONRXDAT_R {
24    type Target = crate::FieldReader<u8, u8>;
25    #[inline(always)]
26    fn deref(&self) -> &Self::Target {
27        &self.0
28    }
29}
30#[doc = "Monitor Received Start.\n\nValue on reset: 0"]
31#[derive(Clone, Copy, Debug, PartialEq)]
32pub enum MONSTART_A {
33    #[doc = "0: No start detected. The Monitor function has not detected a Start event on the I2C bus."]
34    NO_START_DETECTED = 0,
35    #[doc = "1: Start detected. The Monitor function has detected a Start event on the I2C bus."]
36    START_DETECTED = 1,
37}
38impl From<MONSTART_A> for bool {
39    #[inline(always)]
40    fn from(variant: MONSTART_A) -> Self {
41        variant as u8 != 0
42    }
43}
44#[doc = "Field `MONSTART` reader - Monitor Received Start."]
45pub struct MONSTART_R(crate::FieldReader<bool, MONSTART_A>);
46impl MONSTART_R {
47    pub(crate) fn new(bits: bool) -> Self {
48        MONSTART_R(crate::FieldReader::new(bits))
49    }
50    #[doc = r"Get enumerated values variant"]
51    #[inline(always)]
52    pub fn variant(&self) -> MONSTART_A {
53        match self.bits {
54            false => MONSTART_A::NO_START_DETECTED,
55            true => MONSTART_A::START_DETECTED,
56        }
57    }
58    #[doc = "Checks if the value of the field is `NO_START_DETECTED`"]
59    #[inline(always)]
60    pub fn is_no_start_detected(&self) -> bool {
61        **self == MONSTART_A::NO_START_DETECTED
62    }
63    #[doc = "Checks if the value of the field is `START_DETECTED`"]
64    #[inline(always)]
65    pub fn is_start_detected(&self) -> bool {
66        **self == MONSTART_A::START_DETECTED
67    }
68}
69impl core::ops::Deref for MONSTART_R {
70    type Target = crate::FieldReader<bool, MONSTART_A>;
71    #[inline(always)]
72    fn deref(&self) -> &Self::Target {
73        &self.0
74    }
75}
76#[doc = "Monitor Received Repeated Start.\n\nValue on reset: 0"]
77#[derive(Clone, Copy, Debug, PartialEq)]
78pub enum MONRESTART_A {
79    #[doc = "0: No repeated start detected. The Monitor function has not detected a Repeated Start event on the I2C bus."]
80    NOT_DETECTED = 0,
81    #[doc = "1: Repeated start detected. The Monitor function has detected a Repeated Start event on the I2C bus."]
82    DETECTED = 1,
83}
84impl From<MONRESTART_A> for bool {
85    #[inline(always)]
86    fn from(variant: MONRESTART_A) -> Self {
87        variant as u8 != 0
88    }
89}
90#[doc = "Field `MONRESTART` reader - Monitor Received Repeated Start."]
91pub struct MONRESTART_R(crate::FieldReader<bool, MONRESTART_A>);
92impl MONRESTART_R {
93    pub(crate) fn new(bits: bool) -> Self {
94        MONRESTART_R(crate::FieldReader::new(bits))
95    }
96    #[doc = r"Get enumerated values variant"]
97    #[inline(always)]
98    pub fn variant(&self) -> MONRESTART_A {
99        match self.bits {
100            false => MONRESTART_A::NOT_DETECTED,
101            true => MONRESTART_A::DETECTED,
102        }
103    }
104    #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
105    #[inline(always)]
106    pub fn is_not_detected(&self) -> bool {
107        **self == MONRESTART_A::NOT_DETECTED
108    }
109    #[doc = "Checks if the value of the field is `DETECTED`"]
110    #[inline(always)]
111    pub fn is_detected(&self) -> bool {
112        **self == MONRESTART_A::DETECTED
113    }
114}
115impl core::ops::Deref for MONRESTART_R {
116    type Target = crate::FieldReader<bool, MONRESTART_A>;
117    #[inline(always)]
118    fn deref(&self) -> &Self::Target {
119        &self.0
120    }
121}
122#[doc = "Monitor Received NACK.\n\nValue on reset: 0"]
123#[derive(Clone, Copy, Debug, PartialEq)]
124pub enum MONNACK_A {
125    #[doc = "0: Acknowledged. The data currently being provided by the Monitor function was acknowledged by at least one master or slave receiver."]
126    ACKNOWLEDGED = 0,
127    #[doc = "1: Not acknowledged. The data currently being provided by the Monitor function was not acknowledged by any receiver."]
128    NOT_ACKNOWLEDGED = 1,
129}
130impl From<MONNACK_A> for bool {
131    #[inline(always)]
132    fn from(variant: MONNACK_A) -> Self {
133        variant as u8 != 0
134    }
135}
136#[doc = "Field `MONNACK` reader - Monitor Received NACK."]
137pub struct MONNACK_R(crate::FieldReader<bool, MONNACK_A>);
138impl MONNACK_R {
139    pub(crate) fn new(bits: bool) -> Self {
140        MONNACK_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> MONNACK_A {
145        match self.bits {
146            false => MONNACK_A::ACKNOWLEDGED,
147            true => MONNACK_A::NOT_ACKNOWLEDGED,
148        }
149    }
150    #[doc = "Checks if the value of the field is `ACKNOWLEDGED`"]
151    #[inline(always)]
152    pub fn is_acknowledged(&self) -> bool {
153        **self == MONNACK_A::ACKNOWLEDGED
154    }
155    #[doc = "Checks if the value of the field is `NOT_ACKNOWLEDGED`"]
156    #[inline(always)]
157    pub fn is_not_acknowledged(&self) -> bool {
158        **self == MONNACK_A::NOT_ACKNOWLEDGED
159    }
160}
161impl core::ops::Deref for MONNACK_R {
162    type Target = crate::FieldReader<bool, MONNACK_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168impl R {
169    #[doc = "Bits 0:7 - Monitor function Receiver Data. This reflects every data byte that passes on the I2C pins."]
170    #[inline(always)]
171    pub fn monrxdat(&self) -> MONRXDAT_R {
172        MONRXDAT_R::new((self.bits & 0xff) as u8)
173    }
174    #[doc = "Bit 8 - Monitor Received Start."]
175    #[inline(always)]
176    pub fn monstart(&self) -> MONSTART_R {
177        MONSTART_R::new(((self.bits >> 8) & 0x01) != 0)
178    }
179    #[doc = "Bit 9 - Monitor Received Repeated Start."]
180    #[inline(always)]
181    pub fn monrestart(&self) -> MONRESTART_R {
182        MONRESTART_R::new(((self.bits >> 9) & 0x01) != 0)
183    }
184    #[doc = "Bit 10 - Monitor Received NACK."]
185    #[inline(always)]
186    pub fn monnack(&self) -> MONNACK_R {
187        MONNACK_R::new(((self.bits >> 10) & 0x01) != 0)
188    }
189}
190#[doc = "Monitor receiver data register.\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [monrxdat](index.html) module"]
191pub struct MONRXDAT_SPEC;
192impl crate::RegisterSpec for MONRXDAT_SPEC {
193    type Ux = u32;
194}
195#[doc = "`read()` method returns [monrxdat::R](R) reader structure"]
196impl crate::Readable for MONRXDAT_SPEC {
197    type Reader = R;
198}
199#[doc = "`reset()` method sets MONRXDAT to value 0"]
200impl crate::Resettable for MONRXDAT_SPEC {
201    #[inline(always)]
202    fn reset_value() -> Self::Ux {
203        0
204    }
205}