efm32gg_pac/efm32gg995/prs/
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 `CH0PEN` reader - CH0 Pin Enable"]
38pub type CH0PEN_R = crate::BitReader<bool>;
39#[doc = "Field `CH0PEN` writer - CH0 Pin Enable"]
40pub type CH0PEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, O>;
41#[doc = "Field `CH1PEN` reader - CH1 Pin Enable"]
42pub type CH1PEN_R = crate::BitReader<bool>;
43#[doc = "Field `CH1PEN` writer - CH1 Pin Enable"]
44pub type CH1PEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, O>;
45#[doc = "Field `CH2PEN` reader - CH2 Pin Enable"]
46pub type CH2PEN_R = crate::BitReader<bool>;
47#[doc = "Field `CH2PEN` writer - CH2 Pin Enable"]
48pub type CH2PEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, O>;
49#[doc = "Field `CH3PEN` reader - CH3 Pin Enable"]
50pub type CH3PEN_R = crate::BitReader<bool>;
51#[doc = "Field `CH3PEN` writer - CH3 Pin Enable"]
52pub type CH3PEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, O>;
53#[doc = "Field `LOCATION` reader - I/O Location"]
54pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
55#[doc = "I/O Location\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum LOCATION_A {
59    #[doc = "0: Location 0"]
60    LOC0 = 0,
61    #[doc = "1: Location 1"]
62    LOC1 = 1,
63}
64impl From<LOCATION_A> for u8 {
65    #[inline(always)]
66    fn from(variant: LOCATION_A) -> Self {
67        variant as _
68    }
69}
70impl LOCATION_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> Option<LOCATION_A> {
74        match self.bits {
75            0 => Some(LOCATION_A::LOC0),
76            1 => Some(LOCATION_A::LOC1),
77            _ => None,
78        }
79    }
80    #[doc = "Checks if the value of the field is `LOC0`"]
81    #[inline(always)]
82    pub fn is_loc0(&self) -> bool {
83        *self == LOCATION_A::LOC0
84    }
85    #[doc = "Checks if the value of the field is `LOC1`"]
86    #[inline(always)]
87    pub fn is_loc1(&self) -> bool {
88        *self == LOCATION_A::LOC1
89    }
90}
91#[doc = "Field `LOCATION` writer - I/O Location"]
92pub type LOCATION_W<'a, const O: u8> =
93    crate::FieldWriter<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 3, O>;
94impl<'a, const O: u8> LOCATION_W<'a, O> {
95    #[doc = "Location 0"]
96    #[inline(always)]
97    pub fn loc0(self) -> &'a mut W {
98        self.variant(LOCATION_A::LOC0)
99    }
100    #[doc = "Location 1"]
101    #[inline(always)]
102    pub fn loc1(self) -> &'a mut W {
103        self.variant(LOCATION_A::LOC1)
104    }
105}
106impl R {
107    #[doc = "Bit 0 - CH0 Pin Enable"]
108    #[inline(always)]
109    pub fn ch0pen(&self) -> CH0PEN_R {
110        CH0PEN_R::new((self.bits & 1) != 0)
111    }
112    #[doc = "Bit 1 - CH1 Pin Enable"]
113    #[inline(always)]
114    pub fn ch1pen(&self) -> CH1PEN_R {
115        CH1PEN_R::new(((self.bits >> 1) & 1) != 0)
116    }
117    #[doc = "Bit 2 - CH2 Pin Enable"]
118    #[inline(always)]
119    pub fn ch2pen(&self) -> CH2PEN_R {
120        CH2PEN_R::new(((self.bits >> 2) & 1) != 0)
121    }
122    #[doc = "Bit 3 - CH3 Pin Enable"]
123    #[inline(always)]
124    pub fn ch3pen(&self) -> CH3PEN_R {
125        CH3PEN_R::new(((self.bits >> 3) & 1) != 0)
126    }
127    #[doc = "Bits 8:10 - I/O Location"]
128    #[inline(always)]
129    pub fn location(&self) -> LOCATION_R {
130        LOCATION_R::new(((self.bits >> 8) & 7) as u8)
131    }
132}
133impl W {
134    #[doc = "Bit 0 - CH0 Pin Enable"]
135    #[inline(always)]
136    #[must_use]
137    pub fn ch0pen(&mut self) -> CH0PEN_W<0> {
138        CH0PEN_W::new(self)
139    }
140    #[doc = "Bit 1 - CH1 Pin Enable"]
141    #[inline(always)]
142    #[must_use]
143    pub fn ch1pen(&mut self) -> CH1PEN_W<1> {
144        CH1PEN_W::new(self)
145    }
146    #[doc = "Bit 2 - CH2 Pin Enable"]
147    #[inline(always)]
148    #[must_use]
149    pub fn ch2pen(&mut self) -> CH2PEN_W<2> {
150        CH2PEN_W::new(self)
151    }
152    #[doc = "Bit 3 - CH3 Pin Enable"]
153    #[inline(always)]
154    #[must_use]
155    pub fn ch3pen(&mut self) -> CH3PEN_W<3> {
156        CH3PEN_W::new(self)
157    }
158    #[doc = "Bits 8:10 - I/O Location"]
159    #[inline(always)]
160    #[must_use]
161    pub fn location(&mut self) -> LOCATION_W<8> {
162        LOCATION_W::new(self)
163    }
164    #[doc = "Writes raw bits to the register."]
165    #[inline(always)]
166    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
167        self.0.bits(bits);
168        self
169    }
170}
171#[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"]
172pub struct ROUTE_SPEC;
173impl crate::RegisterSpec for ROUTE_SPEC {
174    type Ux = u32;
175}
176#[doc = "`read()` method returns [route::R](R) reader structure"]
177impl crate::Readable for ROUTE_SPEC {
178    type Reader = R;
179}
180#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
181impl crate::Writable for ROUTE_SPEC {
182    type Writer = W;
183    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
184    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185}
186#[doc = "`reset()` method sets ROUTE to value 0"]
187impl crate::Resettable for ROUTE_SPEC {
188    const RESET_VALUE: Self::Ux = 0;
189}