swm341_pac/i2c0/
tr.rs

1#[doc = "Register `TR` reader"]
2pub struct R(crate::R<TR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TR` writer"]
17pub struct W(crate::W<TR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<TR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXACK` reader - TXACK field"]
38pub type TXACK_R = crate::BitReader<bool>;
39#[doc = "Field `TXACK` writer - TXACK field"]
40pub type TXACK_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
41#[doc = "Field `RXACK` reader - RXACK field"]
42pub type RXACK_R = crate::BitReader<bool>;
43#[doc = "Field `RXACK` writer - RXACK field"]
44pub type RXACK_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
45#[doc = "Field `TXCLR` reader - TXCLR field"]
46pub type TXCLR_R = crate::BitReader<bool>;
47#[doc = "Field `TXCLR` writer - TXCLR field"]
48pub type TXCLR_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
49#[doc = "Field `SLVACT` reader - SLVACT field"]
50pub type SLVACT_R = crate::BitReader<bool>;
51#[doc = "Field `SLVACT` writer - SLVACT field"]
52pub type SLVACT_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
53#[doc = "Field `SLVRD` reader - SLVRD field"]
54pub type SLVRD_R = crate::BitReader<bool>;
55#[doc = "Field `SLVRD` writer - SLVRD field"]
56pub type SLVRD_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
57#[doc = "Field `SLVWR` reader - SLVWR field"]
58pub type SLVWR_R = crate::BitReader<bool>;
59#[doc = "Field `SLVWR` writer - SLVWR field"]
60pub type SLVWR_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
61#[doc = "Field `SLVSTR` reader - SLVSTR field"]
62pub type SLVSTR_R = crate::BitReader<bool>;
63#[doc = "Field `SLVSTR` writer - SLVSTR field"]
64pub type SLVSTR_W<'a, const O: u8> = crate::BitWriter<'a, u32, TR_SPEC, bool, O>;
65#[doc = "Field `SLVRDS` reader - SLVRDS field"]
66pub type SLVRDS_R = crate::FieldReader<u8, u8>;
67#[doc = "Field `SLVRDS` writer - SLVRDS field"]
68pub type SLVRDS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, TR_SPEC, u8, u8, 2, O>;
69impl R {
70    #[doc = "Bit 0 - TXACK field"]
71    #[inline(always)]
72    pub fn txack(&self) -> TXACK_R {
73        TXACK_R::new((self.bits & 1) != 0)
74    }
75    #[doc = "Bit 1 - RXACK field"]
76    #[inline(always)]
77    pub fn rxack(&self) -> RXACK_R {
78        RXACK_R::new(((self.bits >> 1) & 1) != 0)
79    }
80    #[doc = "Bit 2 - TXCLR field"]
81    #[inline(always)]
82    pub fn txclr(&self) -> TXCLR_R {
83        TXCLR_R::new(((self.bits >> 2) & 1) != 0)
84    }
85    #[doc = "Bit 8 - SLVACT field"]
86    #[inline(always)]
87    pub fn slvact(&self) -> SLVACT_R {
88        SLVACT_R::new(((self.bits >> 8) & 1) != 0)
89    }
90    #[doc = "Bit 9 - SLVRD field"]
91    #[inline(always)]
92    pub fn slvrd(&self) -> SLVRD_R {
93        SLVRD_R::new(((self.bits >> 9) & 1) != 0)
94    }
95    #[doc = "Bit 10 - SLVWR field"]
96    #[inline(always)]
97    pub fn slvwr(&self) -> SLVWR_R {
98        SLVWR_R::new(((self.bits >> 10) & 1) != 0)
99    }
100    #[doc = "Bit 11 - SLVSTR field"]
101    #[inline(always)]
102    pub fn slvstr(&self) -> SLVSTR_R {
103        SLVSTR_R::new(((self.bits >> 11) & 1) != 0)
104    }
105    #[doc = "Bits 12:13 - SLVRDS field"]
106    #[inline(always)]
107    pub fn slvrds(&self) -> SLVRDS_R {
108        SLVRDS_R::new(((self.bits >> 12) & 3) as u8)
109    }
110}
111impl W {
112    #[doc = "Bit 0 - TXACK field"]
113    #[inline(always)]
114    pub fn txack(&mut self) -> TXACK_W<0> {
115        TXACK_W::new(self)
116    }
117    #[doc = "Bit 1 - RXACK field"]
118    #[inline(always)]
119    pub fn rxack(&mut self) -> RXACK_W<1> {
120        RXACK_W::new(self)
121    }
122    #[doc = "Bit 2 - TXCLR field"]
123    #[inline(always)]
124    pub fn txclr(&mut self) -> TXCLR_W<2> {
125        TXCLR_W::new(self)
126    }
127    #[doc = "Bit 8 - SLVACT field"]
128    #[inline(always)]
129    pub fn slvact(&mut self) -> SLVACT_W<8> {
130        SLVACT_W::new(self)
131    }
132    #[doc = "Bit 9 - SLVRD field"]
133    #[inline(always)]
134    pub fn slvrd(&mut self) -> SLVRD_W<9> {
135        SLVRD_W::new(self)
136    }
137    #[doc = "Bit 10 - SLVWR field"]
138    #[inline(always)]
139    pub fn slvwr(&mut self) -> SLVWR_W<10> {
140        SLVWR_W::new(self)
141    }
142    #[doc = "Bit 11 - SLVSTR field"]
143    #[inline(always)]
144    pub fn slvstr(&mut self) -> SLVSTR_W<11> {
145        SLVSTR_W::new(self)
146    }
147    #[doc = "Bits 12:13 - SLVRDS field"]
148    #[inline(always)]
149    pub fn slvrds(&mut self) -> SLVRDS_W<12> {
150        SLVRDS_W::new(self)
151    }
152    #[doc = "Writes raw bits to the register."]
153    #[inline(always)]
154    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155        self.0.bits(bits);
156        self
157    }
158}
159#[doc = "TR register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [tr](index.html) module"]
160pub struct TR_SPEC;
161impl crate::RegisterSpec for TR_SPEC {
162    type Ux = u32;
163}
164#[doc = "`read()` method returns [tr::R](R) reader structure"]
165impl crate::Readable for TR_SPEC {
166    type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [tr::W](W) writer structure"]
169impl crate::Writable for TR_SPEC {
170    type Writer = W;
171}
172#[doc = "`reset()` method sets TR to value 0"]
173impl crate::Resettable for TR_SPEC {
174    #[inline(always)]
175    fn reset_value() -> Self::Ux {
176        0
177    }
178}