efm32wg230_pac/cmu/
auxhfrcoctrl.rs

1#[doc = "Register `AUXHFRCOCTRL` reader"]
2pub struct R(crate::R<AUXHFRCOCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<AUXHFRCOCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<AUXHFRCOCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<AUXHFRCOCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `AUXHFRCOCTRL` writer"]
17pub struct W(crate::W<AUXHFRCOCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<AUXHFRCOCTRL_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<AUXHFRCOCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<AUXHFRCOCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TUNING` reader - AUXHFRCO Tuning Value"]
38pub type TUNING_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `TUNING` writer - AUXHFRCO Tuning Value"]
40pub type TUNING_W<'a> = crate::FieldWriter<'a, u32, AUXHFRCOCTRL_SPEC, u8, u8, 8, 0>;
41#[doc = "AUXHFRCO Band Select\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum BAND_A {
45    #[doc = "0: 14 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
46    _14MHZ = 0,
47    #[doc = "1: 11 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
48    _11MHZ = 1,
49    #[doc = "2: 7 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
50    _7MHZ = 2,
51    #[doc = "3: 1 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
52    _1MHZ = 3,
53    #[doc = "6: 28 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
54    _28MHZ = 6,
55    #[doc = "7: 21 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
56    _21MHZ = 7,
57}
58impl From<BAND_A> for u8 {
59    #[inline(always)]
60    fn from(variant: BAND_A) -> Self {
61        variant as _
62    }
63}
64#[doc = "Field `BAND` reader - AUXHFRCO Band Select"]
65pub type BAND_R = crate::FieldReader<u8, BAND_A>;
66impl BAND_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> Option<BAND_A> {
70        match self.bits {
71            0 => Some(BAND_A::_14MHZ),
72            1 => Some(BAND_A::_11MHZ),
73            2 => Some(BAND_A::_7MHZ),
74            3 => Some(BAND_A::_1MHZ),
75            6 => Some(BAND_A::_28MHZ),
76            7 => Some(BAND_A::_21MHZ),
77            _ => None,
78        }
79    }
80    #[doc = "Checks if the value of the field is `_14MHZ`"]
81    #[inline(always)]
82    pub fn is_14mhz(&self) -> bool {
83        *self == BAND_A::_14MHZ
84    }
85    #[doc = "Checks if the value of the field is `_11MHZ`"]
86    #[inline(always)]
87    pub fn is_11mhz(&self) -> bool {
88        *self == BAND_A::_11MHZ
89    }
90    #[doc = "Checks if the value of the field is `_7MHZ`"]
91    #[inline(always)]
92    pub fn is_7mhz(&self) -> bool {
93        *self == BAND_A::_7MHZ
94    }
95    #[doc = "Checks if the value of the field is `_1MHZ`"]
96    #[inline(always)]
97    pub fn is_1mhz(&self) -> bool {
98        *self == BAND_A::_1MHZ
99    }
100    #[doc = "Checks if the value of the field is `_28MHZ`"]
101    #[inline(always)]
102    pub fn is_28mhz(&self) -> bool {
103        *self == BAND_A::_28MHZ
104    }
105    #[doc = "Checks if the value of the field is `_21MHZ`"]
106    #[inline(always)]
107    pub fn is_21mhz(&self) -> bool {
108        *self == BAND_A::_21MHZ
109    }
110}
111#[doc = "Field `BAND` writer - AUXHFRCO Band Select"]
112pub type BAND_W<'a> = crate::FieldWriter<'a, u32, AUXHFRCOCTRL_SPEC, u8, BAND_A, 3, 8>;
113impl<'a> BAND_W<'a> {
114    #[doc = "14 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
115    #[inline(always)]
116    pub fn _14mhz(self) -> &'a mut W {
117        self.variant(BAND_A::_14MHZ)
118    }
119    #[doc = "11 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
120    #[inline(always)]
121    pub fn _11mhz(self) -> &'a mut W {
122        self.variant(BAND_A::_11MHZ)
123    }
124    #[doc = "7 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
125    #[inline(always)]
126    pub fn _7mhz(self) -> &'a mut W {
127        self.variant(BAND_A::_7MHZ)
128    }
129    #[doc = "1 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
130    #[inline(always)]
131    pub fn _1mhz(self) -> &'a mut W {
132        self.variant(BAND_A::_1MHZ)
133    }
134    #[doc = "28 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
135    #[inline(always)]
136    pub fn _28mhz(self) -> &'a mut W {
137        self.variant(BAND_A::_28MHZ)
138    }
139    #[doc = "21 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
140    #[inline(always)]
141    pub fn _21mhz(self) -> &'a mut W {
142        self.variant(BAND_A::_21MHZ)
143    }
144}
145impl R {
146    #[doc = "Bits 0:7 - AUXHFRCO Tuning Value"]
147    #[inline(always)]
148    pub fn tuning(&self) -> TUNING_R {
149        TUNING_R::new((self.bits & 0xff) as u8)
150    }
151    #[doc = "Bits 8:10 - AUXHFRCO Band Select"]
152    #[inline(always)]
153    pub fn band(&self) -> BAND_R {
154        BAND_R::new(((self.bits >> 8) & 7) as u8)
155    }
156}
157impl W {
158    #[doc = "Bits 0:7 - AUXHFRCO Tuning Value"]
159    #[inline(always)]
160    pub fn tuning(&mut self) -> TUNING_W {
161        TUNING_W::new(self)
162    }
163    #[doc = "Bits 8:10 - AUXHFRCO Band Select"]
164    #[inline(always)]
165    pub fn band(&mut self) -> BAND_W {
166        BAND_W::new(self)
167    }
168    #[doc = "Writes raw bits to the register."]
169    #[inline(always)]
170    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
171        self.0.bits(bits);
172        self
173    }
174}
175#[doc = "AUXHFRCO Control 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 [auxhfrcoctrl](index.html) module"]
176pub struct AUXHFRCOCTRL_SPEC;
177impl crate::RegisterSpec for AUXHFRCOCTRL_SPEC {
178    type Ux = u32;
179}
180#[doc = "`read()` method returns [auxhfrcoctrl::R](R) reader structure"]
181impl crate::Readable for AUXHFRCOCTRL_SPEC {
182    type Reader = R;
183}
184#[doc = "`write(|w| ..)` method takes [auxhfrcoctrl::W](W) writer structure"]
185impl crate::Writable for AUXHFRCOCTRL_SPEC {
186    type Writer = W;
187}
188#[doc = "`reset()` method sets AUXHFRCOCTRL to value 0x80"]
189impl crate::Resettable for AUXHFRCOCTRL_SPEC {
190    #[inline(always)]
191    fn reset_value() -> Self::Ux {
192        0x80
193    }
194}