Skip to main content

mcxa_pac/i3c0/
mwdatah.rs

1#[doc = "Register `MWDATAH` writer"]
2pub type W = crate::W<MwdatahSpec>;
3#[doc = "Field `DATA0` writer - Data Byte 0"]
4pub type Data0W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
5#[doc = "Field `DATA1` writer - Data Byte 1"]
6pub type Data1W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
7#[doc = "End of Message\n\nValue on reset: 0"]
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum End {
11    #[doc = "0: Not the end"]
12    NotEnd = 0,
13    #[doc = "1: End"]
14    End = 1,
15}
16impl From<End> for bool {
17    #[inline(always)]
18    fn from(variant: End) -> Self {
19        variant as u8 != 0
20    }
21}
22#[doc = "Field `END` writer - End of Message"]
23pub type EndW<'a, REG> = crate::BitWriter<'a, REG, End>;
24impl<'a, REG> EndW<'a, REG>
25where
26    REG: crate::Writable + crate::RegisterSpec,
27{
28    #[doc = "Not the end"]
29    #[inline(always)]
30    pub fn not_end(self) -> &'a mut crate::W<REG> {
31        self.variant(End::NotEnd)
32    }
33    #[doc = "End"]
34    #[inline(always)]
35    pub fn end(self) -> &'a mut crate::W<REG> {
36        self.variant(End::End)
37    }
38}
39#[cfg(feature = "debug")]
40impl core::fmt::Debug for crate::generic::Reg<MwdatahSpec> {
41    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
42        write!(f, "(not readable)")
43    }
44}
45impl W {
46    #[doc = "Bits 0:7 - Data Byte 0"]
47    #[inline(always)]
48    pub fn data0(&mut self) -> Data0W<'_, MwdatahSpec> {
49        Data0W::new(self, 0)
50    }
51    #[doc = "Bits 8:15 - Data Byte 1"]
52    #[inline(always)]
53    pub fn data1(&mut self) -> Data1W<'_, MwdatahSpec> {
54        Data1W::new(self, 8)
55    }
56    #[doc = "Bit 16 - End of Message"]
57    #[inline(always)]
58    pub fn end(&mut self) -> EndW<'_, MwdatahSpec> {
59        EndW::new(self, 16)
60    }
61}
62#[doc = "Controller Write Data Halfword\n\nYou can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mwdatah::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
63pub struct MwdatahSpec;
64impl crate::RegisterSpec for MwdatahSpec {
65    type Ux = u32;
66}
67#[doc = "`write(|w| ..)` method takes [`mwdatah::W`](W) writer structure"]
68impl crate::Writable for MwdatahSpec {
69    type Safety = crate::Unsafe;
70}
71#[doc = "`reset()` method sets MWDATAH to value 0"]
72impl crate::Resettable for MwdatahSpec {}