efm32wg230_pac/i2c1/
route.rs

1#[doc = "Register `ROUTE` reader"]
2pub struct R(crate::R<ROUTE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ROUTE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ROUTE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ROUTE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ROUTE` writer"]
17pub struct W(crate::W<ROUTE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ROUTE_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<ROUTE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ROUTE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SDAPEN` reader - SDA Pin Enable"]
38pub type SDAPEN_R = crate::BitReader<bool>;
39#[doc = "Field `SDAPEN` writer - SDA Pin Enable"]
40pub type SDAPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "Field `SCLPEN` reader - SCL Pin Enable"]
42pub type SCLPEN_R = crate::BitReader<bool>;
43#[doc = "Field `SCLPEN` writer - SCL Pin Enable"]
44pub type SCLPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 1>;
45#[doc = "I/O Location\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47#[repr(u8)]
48pub enum LOCATION_A {
49    #[doc = "0: Location 0"]
50    LOC0 = 0,
51    #[doc = "1: Location 1"]
52    LOC1 = 1,
53    #[doc = "2: Location 2"]
54    LOC2 = 2,
55    #[doc = "3: Location 3"]
56    LOC3 = 3,
57    #[doc = "4: Location 4"]
58    LOC4 = 4,
59    #[doc = "5: Location 5"]
60    LOC5 = 5,
61    #[doc = "6: Location 6"]
62    LOC6 = 6,
63}
64impl From<LOCATION_A> for u8 {
65    #[inline(always)]
66    fn from(variant: LOCATION_A) -> Self {
67        variant as _
68    }
69}
70#[doc = "Field `LOCATION` reader - I/O Location"]
71pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
72impl LOCATION_R {
73    #[doc = "Get enumerated values variant"]
74    #[inline(always)]
75    pub fn variant(&self) -> Option<LOCATION_A> {
76        match self.bits {
77            0 => Some(LOCATION_A::LOC0),
78            1 => Some(LOCATION_A::LOC1),
79            2 => Some(LOCATION_A::LOC2),
80            3 => Some(LOCATION_A::LOC3),
81            4 => Some(LOCATION_A::LOC4),
82            5 => Some(LOCATION_A::LOC5),
83            6 => Some(LOCATION_A::LOC6),
84            _ => None,
85        }
86    }
87    #[doc = "Checks if the value of the field is `LOC0`"]
88    #[inline(always)]
89    pub fn is_loc0(&self) -> bool {
90        *self == LOCATION_A::LOC0
91    }
92    #[doc = "Checks if the value of the field is `LOC1`"]
93    #[inline(always)]
94    pub fn is_loc1(&self) -> bool {
95        *self == LOCATION_A::LOC1
96    }
97    #[doc = "Checks if the value of the field is `LOC2`"]
98    #[inline(always)]
99    pub fn is_loc2(&self) -> bool {
100        *self == LOCATION_A::LOC2
101    }
102    #[doc = "Checks if the value of the field is `LOC3`"]
103    #[inline(always)]
104    pub fn is_loc3(&self) -> bool {
105        *self == LOCATION_A::LOC3
106    }
107    #[doc = "Checks if the value of the field is `LOC4`"]
108    #[inline(always)]
109    pub fn is_loc4(&self) -> bool {
110        *self == LOCATION_A::LOC4
111    }
112    #[doc = "Checks if the value of the field is `LOC5`"]
113    #[inline(always)]
114    pub fn is_loc5(&self) -> bool {
115        *self == LOCATION_A::LOC5
116    }
117    #[doc = "Checks if the value of the field is `LOC6`"]
118    #[inline(always)]
119    pub fn is_loc6(&self) -> bool {
120        *self == LOCATION_A::LOC6
121    }
122}
123#[doc = "Field `LOCATION` writer - I/O Location"]
124pub type LOCATION_W<'a> = crate::FieldWriter<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 3, 8>;
125impl<'a> LOCATION_W<'a> {
126    #[doc = "Location 0"]
127    #[inline(always)]
128    pub fn loc0(self) -> &'a mut W {
129        self.variant(LOCATION_A::LOC0)
130    }
131    #[doc = "Location 1"]
132    #[inline(always)]
133    pub fn loc1(self) -> &'a mut W {
134        self.variant(LOCATION_A::LOC1)
135    }
136    #[doc = "Location 2"]
137    #[inline(always)]
138    pub fn loc2(self) -> &'a mut W {
139        self.variant(LOCATION_A::LOC2)
140    }
141    #[doc = "Location 3"]
142    #[inline(always)]
143    pub fn loc3(self) -> &'a mut W {
144        self.variant(LOCATION_A::LOC3)
145    }
146    #[doc = "Location 4"]
147    #[inline(always)]
148    pub fn loc4(self) -> &'a mut W {
149        self.variant(LOCATION_A::LOC4)
150    }
151    #[doc = "Location 5"]
152    #[inline(always)]
153    pub fn loc5(self) -> &'a mut W {
154        self.variant(LOCATION_A::LOC5)
155    }
156    #[doc = "Location 6"]
157    #[inline(always)]
158    pub fn loc6(self) -> &'a mut W {
159        self.variant(LOCATION_A::LOC6)
160    }
161}
162impl R {
163    #[doc = "Bit 0 - SDA Pin Enable"]
164    #[inline(always)]
165    pub fn sdapen(&self) -> SDAPEN_R {
166        SDAPEN_R::new((self.bits & 1) != 0)
167    }
168    #[doc = "Bit 1 - SCL Pin Enable"]
169    #[inline(always)]
170    pub fn sclpen(&self) -> SCLPEN_R {
171        SCLPEN_R::new(((self.bits >> 1) & 1) != 0)
172    }
173    #[doc = "Bits 8:10 - I/O Location"]
174    #[inline(always)]
175    pub fn location(&self) -> LOCATION_R {
176        LOCATION_R::new(((self.bits >> 8) & 7) as u8)
177    }
178}
179impl W {
180    #[doc = "Bit 0 - SDA Pin Enable"]
181    #[inline(always)]
182    pub fn sdapen(&mut self) -> SDAPEN_W {
183        SDAPEN_W::new(self)
184    }
185    #[doc = "Bit 1 - SCL Pin Enable"]
186    #[inline(always)]
187    pub fn sclpen(&mut self) -> SCLPEN_W {
188        SCLPEN_W::new(self)
189    }
190    #[doc = "Bits 8:10 - I/O Location"]
191    #[inline(always)]
192    pub fn location(&mut self) -> LOCATION_W {
193        LOCATION_W::new(self)
194    }
195    #[doc = "Writes raw bits to the register."]
196    #[inline(always)]
197    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
198        self.0.bits(bits);
199        self
200    }
201}
202#[doc = "I/O Routing 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 [route](index.html) module"]
203pub struct ROUTE_SPEC;
204impl crate::RegisterSpec for ROUTE_SPEC {
205    type Ux = u32;
206}
207#[doc = "`read()` method returns [route::R](R) reader structure"]
208impl crate::Readable for ROUTE_SPEC {
209    type Reader = R;
210}
211#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
212impl crate::Writable for ROUTE_SPEC {
213    type Writer = W;
214}
215#[doc = "`reset()` method sets ROUTE to value 0"]
216impl crate::Resettable for ROUTE_SPEC {
217    #[inline(always)]
218    fn reset_value() -> Self::Ux {
219        0
220    }
221}