efm32hg210_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 = "7: 21 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
54    _21MHZ = 7,
55}
56impl From<BAND_A> for u8 {
57    #[inline(always)]
58    fn from(variant: BAND_A) -> Self {
59        variant as _
60    }
61}
62#[doc = "Field `BAND` reader - AUXHFRCO Band Select"]
63pub type BAND_R = crate::FieldReader<u8, BAND_A>;
64impl BAND_R {
65    #[doc = "Get enumerated values variant"]
66    #[inline(always)]
67    pub fn variant(&self) -> Option<BAND_A> {
68        match self.bits {
69            0 => Some(BAND_A::_14MHZ),
70            1 => Some(BAND_A::_11MHZ),
71            2 => Some(BAND_A::_7MHZ),
72            3 => Some(BAND_A::_1MHZ),
73            7 => Some(BAND_A::_21MHZ),
74            _ => None,
75        }
76    }
77    #[doc = "Checks if the value of the field is `_14MHZ`"]
78    #[inline(always)]
79    pub fn is_14mhz(&self) -> bool {
80        *self == BAND_A::_14MHZ
81    }
82    #[doc = "Checks if the value of the field is `_11MHZ`"]
83    #[inline(always)]
84    pub fn is_11mhz(&self) -> bool {
85        *self == BAND_A::_11MHZ
86    }
87    #[doc = "Checks if the value of the field is `_7MHZ`"]
88    #[inline(always)]
89    pub fn is_7mhz(&self) -> bool {
90        *self == BAND_A::_7MHZ
91    }
92    #[doc = "Checks if the value of the field is `_1MHZ`"]
93    #[inline(always)]
94    pub fn is_1mhz(&self) -> bool {
95        *self == BAND_A::_1MHZ
96    }
97    #[doc = "Checks if the value of the field is `_21MHZ`"]
98    #[inline(always)]
99    pub fn is_21mhz(&self) -> bool {
100        *self == BAND_A::_21MHZ
101    }
102}
103#[doc = "Field `BAND` writer - AUXHFRCO Band Select"]
104pub type BAND_W<'a> = crate::FieldWriter<'a, u32, AUXHFRCOCTRL_SPEC, u8, BAND_A, 3, 8>;
105impl<'a> BAND_W<'a> {
106    #[doc = "14 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
107    #[inline(always)]
108    pub fn _14mhz(self) -> &'a mut W {
109        self.variant(BAND_A::_14MHZ)
110    }
111    #[doc = "11 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
112    #[inline(always)]
113    pub fn _11mhz(self) -> &'a mut W {
114        self.variant(BAND_A::_11MHZ)
115    }
116    #[doc = "7 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
117    #[inline(always)]
118    pub fn _7mhz(self) -> &'a mut W {
119        self.variant(BAND_A::_7MHZ)
120    }
121    #[doc = "1 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
122    #[inline(always)]
123    pub fn _1mhz(self) -> &'a mut W {
124        self.variant(BAND_A::_1MHZ)
125    }
126    #[doc = "21 MHz band. NOTE: Also set the TUNING value (bits 7:0) when changing band."]
127    #[inline(always)]
128    pub fn _21mhz(self) -> &'a mut W {
129        self.variant(BAND_A::_21MHZ)
130    }
131}
132impl R {
133    #[doc = "Bits 0:7 - AUXHFRCO Tuning Value"]
134    #[inline(always)]
135    pub fn tuning(&self) -> TUNING_R {
136        TUNING_R::new((self.bits & 0xff) as u8)
137    }
138    #[doc = "Bits 8:10 - AUXHFRCO Band Select"]
139    #[inline(always)]
140    pub fn band(&self) -> BAND_R {
141        BAND_R::new(((self.bits >> 8) & 7) as u8)
142    }
143}
144impl W {
145    #[doc = "Bits 0:7 - AUXHFRCO Tuning Value"]
146    #[inline(always)]
147    pub fn tuning(&mut self) -> TUNING_W {
148        TUNING_W::new(self)
149    }
150    #[doc = "Bits 8:10 - AUXHFRCO Band Select"]
151    #[inline(always)]
152    pub fn band(&mut self) -> BAND_W {
153        BAND_W::new(self)
154    }
155    #[doc = "Writes raw bits to the register."]
156    #[inline(always)]
157    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
158        self.0.bits(bits);
159        self
160    }
161}
162#[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"]
163pub struct AUXHFRCOCTRL_SPEC;
164impl crate::RegisterSpec for AUXHFRCOCTRL_SPEC {
165    type Ux = u32;
166}
167#[doc = "`read()` method returns [auxhfrcoctrl::R](R) reader structure"]
168impl crate::Readable for AUXHFRCOCTRL_SPEC {
169    type Reader = R;
170}
171#[doc = "`write(|w| ..)` method takes [auxhfrcoctrl::W](W) writer structure"]
172impl crate::Writable for AUXHFRCOCTRL_SPEC {
173    type Writer = W;
174}
175#[doc = "`reset()` method sets AUXHFRCOCTRL to value 0x80"]
176impl crate::Resettable for AUXHFRCOCTRL_SPEC {
177    #[inline(always)]
178    fn reset_value() -> Self::Ux {
179        0x80
180    }
181}