efm32hg309f64/leuart0/
input.rs

1#[doc = "Reader of register INPUT"]
2pub type R = crate::R<u32, super::INPUT>;
3#[doc = "Writer for register INPUT"]
4pub type W = crate::W<u32, super::INPUT>;
5#[doc = "Register INPUT `reset()`'s with value 0"]
6impl crate::ResetValue for super::INPUT {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "RX PRS Channel Select\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum RXPRSSEL_A {
16    #[doc = "0: PRS Channel 0 selected"]
17    PRSCH0,
18    #[doc = "1: PRS Channel 1 selected"]
19    PRSCH1,
20    #[doc = "2: PRS Channel 2 selected"]
21    PRSCH2,
22    #[doc = "3: PRS Channel 3 selected"]
23    PRSCH3,
24    #[doc = "4: PRS Channel 4 selected"]
25    PRSCH4,
26    #[doc = "5: PRS Channel 5 selected"]
27    PRSCH5,
28}
29impl From<RXPRSSEL_A> for u8 {
30    #[inline(always)]
31    fn from(variant: RXPRSSEL_A) -> Self {
32        match variant {
33            RXPRSSEL_A::PRSCH0 => 0,
34            RXPRSSEL_A::PRSCH1 => 1,
35            RXPRSSEL_A::PRSCH2 => 2,
36            RXPRSSEL_A::PRSCH3 => 3,
37            RXPRSSEL_A::PRSCH4 => 4,
38            RXPRSSEL_A::PRSCH5 => 5,
39        }
40    }
41}
42#[doc = "Reader of field `RXPRSSEL`"]
43pub type RXPRSSEL_R = crate::R<u8, RXPRSSEL_A>;
44impl RXPRSSEL_R {
45    #[doc = r"Get enumerated values variant"]
46    #[inline(always)]
47    pub fn variant(&self) -> crate::Variant<u8, RXPRSSEL_A> {
48        use crate::Variant::*;
49        match self.bits {
50            0 => Val(RXPRSSEL_A::PRSCH0),
51            1 => Val(RXPRSSEL_A::PRSCH1),
52            2 => Val(RXPRSSEL_A::PRSCH2),
53            3 => Val(RXPRSSEL_A::PRSCH3),
54            4 => Val(RXPRSSEL_A::PRSCH4),
55            5 => Val(RXPRSSEL_A::PRSCH5),
56            i => Res(i),
57        }
58    }
59    #[doc = "Checks if the value of the field is `PRSCH0`"]
60    #[inline(always)]
61    pub fn is_prsch0(&self) -> bool {
62        *self == RXPRSSEL_A::PRSCH0
63    }
64    #[doc = "Checks if the value of the field is `PRSCH1`"]
65    #[inline(always)]
66    pub fn is_prsch1(&self) -> bool {
67        *self == RXPRSSEL_A::PRSCH1
68    }
69    #[doc = "Checks if the value of the field is `PRSCH2`"]
70    #[inline(always)]
71    pub fn is_prsch2(&self) -> bool {
72        *self == RXPRSSEL_A::PRSCH2
73    }
74    #[doc = "Checks if the value of the field is `PRSCH3`"]
75    #[inline(always)]
76    pub fn is_prsch3(&self) -> bool {
77        *self == RXPRSSEL_A::PRSCH3
78    }
79    #[doc = "Checks if the value of the field is `PRSCH4`"]
80    #[inline(always)]
81    pub fn is_prsch4(&self) -> bool {
82        *self == RXPRSSEL_A::PRSCH4
83    }
84    #[doc = "Checks if the value of the field is `PRSCH5`"]
85    #[inline(always)]
86    pub fn is_prsch5(&self) -> bool {
87        *self == RXPRSSEL_A::PRSCH5
88    }
89}
90#[doc = "Write proxy for field `RXPRSSEL`"]
91pub struct RXPRSSEL_W<'a> {
92    w: &'a mut W,
93}
94impl<'a> RXPRSSEL_W<'a> {
95    #[doc = r"Writes `variant` to the field"]
96    #[inline(always)]
97    pub fn variant(self, variant: RXPRSSEL_A) -> &'a mut W {
98        unsafe { self.bits(variant.into()) }
99    }
100    #[doc = "PRS Channel 0 selected"]
101    #[inline(always)]
102    pub fn prsch0(self) -> &'a mut W {
103        self.variant(RXPRSSEL_A::PRSCH0)
104    }
105    #[doc = "PRS Channel 1 selected"]
106    #[inline(always)]
107    pub fn prsch1(self) -> &'a mut W {
108        self.variant(RXPRSSEL_A::PRSCH1)
109    }
110    #[doc = "PRS Channel 2 selected"]
111    #[inline(always)]
112    pub fn prsch2(self) -> &'a mut W {
113        self.variant(RXPRSSEL_A::PRSCH2)
114    }
115    #[doc = "PRS Channel 3 selected"]
116    #[inline(always)]
117    pub fn prsch3(self) -> &'a mut W {
118        self.variant(RXPRSSEL_A::PRSCH3)
119    }
120    #[doc = "PRS Channel 4 selected"]
121    #[inline(always)]
122    pub fn prsch4(self) -> &'a mut W {
123        self.variant(RXPRSSEL_A::PRSCH4)
124    }
125    #[doc = "PRS Channel 5 selected"]
126    #[inline(always)]
127    pub fn prsch5(self) -> &'a mut W {
128        self.variant(RXPRSSEL_A::PRSCH5)
129    }
130    #[doc = r"Writes raw bits to the field"]
131    #[inline(always)]
132    pub unsafe fn bits(self, value: u8) -> &'a mut W {
133        self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
134        self.w
135    }
136}
137#[doc = "Reader of field `RXPRS`"]
138pub type RXPRS_R = crate::R<bool, bool>;
139#[doc = "Write proxy for field `RXPRS`"]
140pub struct RXPRS_W<'a> {
141    w: &'a mut W,
142}
143impl<'a> RXPRS_W<'a> {
144    #[doc = r"Sets the field bit"]
145    #[inline(always)]
146    pub fn set_bit(self) -> &'a mut W {
147        self.bit(true)
148    }
149    #[doc = r"Clears the field bit"]
150    #[inline(always)]
151    pub fn clear_bit(self) -> &'a mut W {
152        self.bit(false)
153    }
154    #[doc = r"Writes raw bits to the field"]
155    #[inline(always)]
156    pub fn bit(self, value: bool) -> &'a mut W {
157        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
158        self.w
159    }
160}
161impl R {
162    #[doc = "Bits 0:2 - RX PRS Channel Select"]
163    #[inline(always)]
164    pub fn rxprssel(&self) -> RXPRSSEL_R {
165        RXPRSSEL_R::new((self.bits & 0x07) as u8)
166    }
167    #[doc = "Bit 4 - PRS RX Enable"]
168    #[inline(always)]
169    pub fn rxprs(&self) -> RXPRS_R {
170        RXPRS_R::new(((self.bits >> 4) & 0x01) != 0)
171    }
172}
173impl W {
174    #[doc = "Bits 0:2 - RX PRS Channel Select"]
175    #[inline(always)]
176    pub fn rxprssel(&mut self) -> RXPRSSEL_W {
177        RXPRSSEL_W { w: self }
178    }
179    #[doc = "Bit 4 - PRS RX Enable"]
180    #[inline(always)]
181    pub fn rxprs(&mut self) -> RXPRS_W {
182        RXPRS_W { w: self }
183    }
184}