max78000_pac/i2c0/
status.rs

1#[doc = "Register `STATUS` reader"]
2pub type R = crate::R<StatusSpec>;
3#[doc = "Register `STATUS` writer"]
4pub type W = crate::W<StatusSpec>;
5#[doc = "Bus Status.\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Busy {
8    #[doc = "0: I2C Bus Idle."]
9    Idle = 0,
10    #[doc = "1: I2C Bus Busy."]
11    Busy = 1,
12}
13impl From<Busy> for bool {
14    #[inline(always)]
15    fn from(variant: Busy) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `BUSY` reader - Bus Status."]
20pub type BusyR = crate::BitReader<Busy>;
21impl BusyR {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> Busy {
25        match self.bits {
26            false => Busy::Idle,
27            true => Busy::Busy,
28        }
29    }
30    #[doc = "I2C Bus Idle."]
31    #[inline(always)]
32    pub fn is_idle(&self) -> bool {
33        *self == Busy::Idle
34    }
35    #[doc = "I2C Bus Busy."]
36    #[inline(always)]
37    pub fn is_busy(&self) -> bool {
38        *self == Busy::Busy
39    }
40}
41#[doc = "RX empty.\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum RxEm {
44    #[doc = "0: Not Empty."]
45    NotEmpty = 0,
46    #[doc = "1: Empty."]
47    Empty = 1,
48}
49impl From<RxEm> for bool {
50    #[inline(always)]
51    fn from(variant: RxEm) -> Self {
52        variant as u8 != 0
53    }
54}
55#[doc = "Field `RX_EM` reader - RX empty."]
56pub type RxEmR = crate::BitReader<RxEm>;
57impl RxEmR {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub const fn variant(&self) -> RxEm {
61        match self.bits {
62            false => RxEm::NotEmpty,
63            true => RxEm::Empty,
64        }
65    }
66    #[doc = "Not Empty."]
67    #[inline(always)]
68    pub fn is_not_empty(&self) -> bool {
69        *self == RxEm::NotEmpty
70    }
71    #[doc = "Empty."]
72    #[inline(always)]
73    pub fn is_empty(&self) -> bool {
74        *self == RxEm::Empty
75    }
76}
77#[doc = "RX Full.\n\nValue on reset: 0"]
78#[derive(Clone, Copy, Debug, PartialEq, Eq)]
79pub enum RxFull {
80    #[doc = "0: Not Full."]
81    NotFull = 0,
82    #[doc = "1: Full."]
83    Full = 1,
84}
85impl From<RxFull> for bool {
86    #[inline(always)]
87    fn from(variant: RxFull) -> Self {
88        variant as u8 != 0
89    }
90}
91#[doc = "Field `RX_FULL` reader - RX Full."]
92pub type RxFullR = crate::BitReader<RxFull>;
93impl RxFullR {
94    #[doc = "Get enumerated values variant"]
95    #[inline(always)]
96    pub const fn variant(&self) -> RxFull {
97        match self.bits {
98            false => RxFull::NotFull,
99            true => RxFull::Full,
100        }
101    }
102    #[doc = "Not Full."]
103    #[inline(always)]
104    pub fn is_not_full(&self) -> bool {
105        *self == RxFull::NotFull
106    }
107    #[doc = "Full."]
108    #[inline(always)]
109    pub fn is_full(&self) -> bool {
110        *self == RxFull::Full
111    }
112}
113#[doc = "TX Empty.\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum TxEm {
116    #[doc = "0: Not Empty."]
117    NotEmpty = 0,
118    #[doc = "1: Empty."]
119    Empty = 1,
120}
121impl From<TxEm> for bool {
122    #[inline(always)]
123    fn from(variant: TxEm) -> Self {
124        variant as u8 != 0
125    }
126}
127#[doc = "Field `TX_EM` reader - TX Empty."]
128pub type TxEmR = crate::BitReader<TxEm>;
129impl TxEmR {
130    #[doc = "Get enumerated values variant"]
131    #[inline(always)]
132    pub const fn variant(&self) -> TxEm {
133        match self.bits {
134            false => TxEm::NotEmpty,
135            true => TxEm::Empty,
136        }
137    }
138    #[doc = "Not Empty."]
139    #[inline(always)]
140    pub fn is_not_empty(&self) -> bool {
141        *self == TxEm::NotEmpty
142    }
143    #[doc = "Empty."]
144    #[inline(always)]
145    pub fn is_empty(&self) -> bool {
146        *self == TxEm::Empty
147    }
148}
149#[doc = "Field `TX_EM` writer - TX Empty."]
150pub type TxEmW<'a, REG> = crate::BitWriter<'a, REG, TxEm>;
151impl<'a, REG> TxEmW<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154{
155    #[doc = "Not Empty."]
156    #[inline(always)]
157    pub fn not_empty(self) -> &'a mut crate::W<REG> {
158        self.variant(TxEm::NotEmpty)
159    }
160    #[doc = "Empty."]
161    #[inline(always)]
162    pub fn empty(self) -> &'a mut crate::W<REG> {
163        self.variant(TxEm::Empty)
164    }
165}
166#[doc = "TX Full.\n\nValue on reset: 0"]
167#[derive(Clone, Copy, Debug, PartialEq, Eq)]
168pub enum TxFull {
169    #[doc = "0: Not Empty."]
170    NotEmpty = 0,
171    #[doc = "1: Empty."]
172    Empty = 1,
173}
174impl From<TxFull> for bool {
175    #[inline(always)]
176    fn from(variant: TxFull) -> Self {
177        variant as u8 != 0
178    }
179}
180#[doc = "Field `TX_FULL` reader - TX Full."]
181pub type TxFullR = crate::BitReader<TxFull>;
182impl TxFullR {
183    #[doc = "Get enumerated values variant"]
184    #[inline(always)]
185    pub const fn variant(&self) -> TxFull {
186        match self.bits {
187            false => TxFull::NotEmpty,
188            true => TxFull::Empty,
189        }
190    }
191    #[doc = "Not Empty."]
192    #[inline(always)]
193    pub fn is_not_empty(&self) -> bool {
194        *self == TxFull::NotEmpty
195    }
196    #[doc = "Empty."]
197    #[inline(always)]
198    pub fn is_empty(&self) -> bool {
199        *self == TxFull::Empty
200    }
201}
202#[doc = "Field `TX_FULL` writer - TX Full."]
203pub type TxFullW<'a, REG> = crate::BitWriter<'a, REG, TxFull>;
204impl<'a, REG> TxFullW<'a, REG>
205where
206    REG: crate::Writable + crate::RegisterSpec,
207{
208    #[doc = "Not Empty."]
209    #[inline(always)]
210    pub fn not_empty(self) -> &'a mut crate::W<REG> {
211        self.variant(TxFull::NotEmpty)
212    }
213    #[doc = "Empty."]
214    #[inline(always)]
215    pub fn empty(self) -> &'a mut crate::W<REG> {
216        self.variant(TxFull::Empty)
217    }
218}
219#[doc = "Clock Mode.\n\nValue on reset: 0"]
220#[derive(Clone, Copy, Debug, PartialEq, Eq)]
221pub enum MstBusy {
222    #[doc = "0: Device not actively driving SCL clock cycles."]
223    NotActivelyDrivingSclClock = 0,
224    #[doc = "1: Device operating as master and actively driving SCL clock cycles."]
225    ActivelyDrivingSclClock = 1,
226}
227impl From<MstBusy> for bool {
228    #[inline(always)]
229    fn from(variant: MstBusy) -> Self {
230        variant as u8 != 0
231    }
232}
233#[doc = "Field `MST_BUSY` reader - Clock Mode."]
234pub type MstBusyR = crate::BitReader<MstBusy>;
235impl MstBusyR {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub const fn variant(&self) -> MstBusy {
239        match self.bits {
240            false => MstBusy::NotActivelyDrivingSclClock,
241            true => MstBusy::ActivelyDrivingSclClock,
242        }
243    }
244    #[doc = "Device not actively driving SCL clock cycles."]
245    #[inline(always)]
246    pub fn is_not_actively_driving_scl_clock(&self) -> bool {
247        *self == MstBusy::NotActivelyDrivingSclClock
248    }
249    #[doc = "Device operating as master and actively driving SCL clock cycles."]
250    #[inline(always)]
251    pub fn is_actively_driving_scl_clock(&self) -> bool {
252        *self == MstBusy::ActivelyDrivingSclClock
253    }
254}
255impl R {
256    #[doc = "Bit 0 - Bus Status."]
257    #[inline(always)]
258    pub fn busy(&self) -> BusyR {
259        BusyR::new((self.bits & 1) != 0)
260    }
261    #[doc = "Bit 1 - RX empty."]
262    #[inline(always)]
263    pub fn rx_em(&self) -> RxEmR {
264        RxEmR::new(((self.bits >> 1) & 1) != 0)
265    }
266    #[doc = "Bit 2 - RX Full."]
267    #[inline(always)]
268    pub fn rx_full(&self) -> RxFullR {
269        RxFullR::new(((self.bits >> 2) & 1) != 0)
270    }
271    #[doc = "Bit 3 - TX Empty."]
272    #[inline(always)]
273    pub fn tx_em(&self) -> TxEmR {
274        TxEmR::new(((self.bits >> 3) & 1) != 0)
275    }
276    #[doc = "Bit 4 - TX Full."]
277    #[inline(always)]
278    pub fn tx_full(&self) -> TxFullR {
279        TxFullR::new(((self.bits >> 4) & 1) != 0)
280    }
281    #[doc = "Bit 5 - Clock Mode."]
282    #[inline(always)]
283    pub fn mst_busy(&self) -> MstBusyR {
284        MstBusyR::new(((self.bits >> 5) & 1) != 0)
285    }
286}
287impl W {
288    #[doc = "Bit 3 - TX Empty."]
289    #[inline(always)]
290    pub fn tx_em(&mut self) -> TxEmW<StatusSpec> {
291        TxEmW::new(self, 3)
292    }
293    #[doc = "Bit 4 - TX Full."]
294    #[inline(always)]
295    pub fn tx_full(&mut self) -> TxFullW<StatusSpec> {
296        TxFullW::new(self, 4)
297    }
298}
299#[doc = "Status Register.\n\nYou can [`read`](crate::Reg::read) this register and get [`status::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`status::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
300pub struct StatusSpec;
301impl crate::RegisterSpec for StatusSpec {
302    type Ux = u32;
303}
304#[doc = "`read()` method returns [`status::R`](R) reader structure"]
305impl crate::Readable for StatusSpec {}
306#[doc = "`write(|w| ..)` method takes [`status::W`](W) writer structure"]
307impl crate::Writable for StatusSpec {
308    type Safety = crate::Unsafe;
309    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
310    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
311}
312#[doc = "`reset()` method sets STATUS to value 0"]
313impl crate::Resettable for StatusSpec {
314    const RESET_VALUE: u32 = 0;
315}