efm32g230_pac/acmp1/
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 `ACMPPEN` reader - ACMP Output Pin Enable"]
38pub type ACMPPEN_R = crate::BitReader<bool>;
39#[doc = "Field `ACMPPEN` writer - ACMP Output Pin Enable"]
40pub type ACMPPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "I/O Location\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum LOCATION_A {
45    #[doc = "0: Location 0"]
46    LOC0 = 0,
47    #[doc = "1: Location 1"]
48    LOC1 = 1,
49}
50impl From<LOCATION_A> for u8 {
51    #[inline(always)]
52    fn from(variant: LOCATION_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `LOCATION` reader - I/O Location"]
57pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
58impl LOCATION_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> Option<LOCATION_A> {
62        match self.bits {
63            0 => Some(LOCATION_A::LOC0),
64            1 => Some(LOCATION_A::LOC1),
65            _ => None,
66        }
67    }
68    #[doc = "Checks if the value of the field is `LOC0`"]
69    #[inline(always)]
70    pub fn is_loc0(&self) -> bool {
71        *self == LOCATION_A::LOC0
72    }
73    #[doc = "Checks if the value of the field is `LOC1`"]
74    #[inline(always)]
75    pub fn is_loc1(&self) -> bool {
76        *self == LOCATION_A::LOC1
77    }
78}
79#[doc = "Field `LOCATION` writer - I/O Location"]
80pub type LOCATION_W<'a> = crate::FieldWriter<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 2, 8>;
81impl<'a> LOCATION_W<'a> {
82    #[doc = "Location 0"]
83    #[inline(always)]
84    pub fn loc0(self) -> &'a mut W {
85        self.variant(LOCATION_A::LOC0)
86    }
87    #[doc = "Location 1"]
88    #[inline(always)]
89    pub fn loc1(self) -> &'a mut W {
90        self.variant(LOCATION_A::LOC1)
91    }
92}
93impl R {
94    #[doc = "Bit 0 - ACMP Output Pin Enable"]
95    #[inline(always)]
96    pub fn acmppen(&self) -> ACMPPEN_R {
97        ACMPPEN_R::new((self.bits & 1) != 0)
98    }
99    #[doc = "Bits 8:9 - I/O Location"]
100    #[inline(always)]
101    pub fn location(&self) -> LOCATION_R {
102        LOCATION_R::new(((self.bits >> 8) & 3) as u8)
103    }
104}
105impl W {
106    #[doc = "Bit 0 - ACMP Output Pin Enable"]
107    #[inline(always)]
108    pub fn acmppen(&mut self) -> ACMPPEN_W {
109        ACMPPEN_W::new(self)
110    }
111    #[doc = "Bits 8:9 - I/O Location"]
112    #[inline(always)]
113    pub fn location(&mut self) -> LOCATION_W {
114        LOCATION_W::new(self)
115    }
116    #[doc = "Writes raw bits to the register."]
117    #[inline(always)]
118    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
119        self.0.bits(bits);
120        self
121    }
122}
123#[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"]
124pub struct ROUTE_SPEC;
125impl crate::RegisterSpec for ROUTE_SPEC {
126    type Ux = u32;
127}
128#[doc = "`read()` method returns [route::R](R) reader structure"]
129impl crate::Readable for ROUTE_SPEC {
130    type Reader = R;
131}
132#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
133impl crate::Writable for ROUTE_SPEC {
134    type Writer = W;
135}
136#[doc = "`reset()` method sets ROUTE to value 0"]
137impl crate::Resettable for ROUTE_SPEC {
138    #[inline(always)]
139    fn reset_value() -> Self::Ux {
140        0
141    }
142}