efm32pg1b200_pac/cmu/
lfrcoctrl.rs1#[doc = "Register `LFRCOCTRL` reader"]
2pub struct R(crate::R<LFRCOCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFRCOCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFRCOCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFRCOCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFRCOCTRL` writer"]
17pub struct W(crate::W<LFRCOCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFRCOCTRL_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<LFRCOCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFRCOCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TUNING` reader - LFRCO Tuning Value"]
38pub type TUNING_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `TUNING` writer - LFRCO Tuning Value"]
40pub type TUNING_W<'a> = crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u16, u16, 9, 0>;
41#[doc = "Field `ENVREF` reader - Enable Duty Cycling of Vref"]
42pub type ENVREF_R = crate::BitReader<bool>;
43#[doc = "Field `ENVREF` writer - Enable Duty Cycling of Vref"]
44pub type ENVREF_W<'a> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, 16>;
45#[doc = "Field `ENCHOP` reader - Enable Comparator Chopping"]
46pub type ENCHOP_R = crate::BitReader<bool>;
47#[doc = "Field `ENCHOP` writer - Enable Comparator Chopping"]
48pub type ENCHOP_W<'a> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, 17>;
49#[doc = "Field `ENDEM` reader - Enable Dynamic Element Matching"]
50pub type ENDEM_R = crate::BitReader<bool>;
51#[doc = "Field `ENDEM` writer - Enable Dynamic Element Matching"]
52pub type ENDEM_W<'a> = crate::BitWriter<'a, u32, LFRCOCTRL_SPEC, bool, 18>;
53#[doc = "LFRCO Timeout\n\nValue on reset: 1"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum TIMEOUT_A {
57 #[doc = "0: Timeout period of 2 cycles"]
58 _2CYCLES = 0,
59 #[doc = "1: Timeout period of 16 cycles"]
60 _16CYCLES = 1,
61 #[doc = "2: Timeout period of 32 cycles"]
62 _32CYCLES = 2,
63}
64impl From<TIMEOUT_A> for u8 {
65 #[inline(always)]
66 fn from(variant: TIMEOUT_A) -> Self {
67 variant as _
68 }
69}
70#[doc = "Field `TIMEOUT` reader - LFRCO Timeout"]
71pub type TIMEOUT_R = crate::FieldReader<u8, TIMEOUT_A>;
72impl TIMEOUT_R {
73 #[doc = "Get enumerated values variant"]
74 #[inline(always)]
75 pub fn variant(&self) -> Option<TIMEOUT_A> {
76 match self.bits {
77 0 => Some(TIMEOUT_A::_2CYCLES),
78 1 => Some(TIMEOUT_A::_16CYCLES),
79 2 => Some(TIMEOUT_A::_32CYCLES),
80 _ => None,
81 }
82 }
83 #[doc = "Checks if the value of the field is `_2CYCLES`"]
84 #[inline(always)]
85 pub fn is_2cycles(&self) -> bool {
86 *self == TIMEOUT_A::_2CYCLES
87 }
88 #[doc = "Checks if the value of the field is `_16CYCLES`"]
89 #[inline(always)]
90 pub fn is_16cycles(&self) -> bool {
91 *self == TIMEOUT_A::_16CYCLES
92 }
93 #[doc = "Checks if the value of the field is `_32CYCLES`"]
94 #[inline(always)]
95 pub fn is_32cycles(&self) -> bool {
96 *self == TIMEOUT_A::_32CYCLES
97 }
98}
99#[doc = "Field `TIMEOUT` writer - LFRCO Timeout"]
100pub type TIMEOUT_W<'a> = crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u8, TIMEOUT_A, 2, 24>;
101impl<'a> TIMEOUT_W<'a> {
102 #[doc = "Timeout period of 2 cycles"]
103 #[inline(always)]
104 pub fn _2cycles(self) -> &'a mut W {
105 self.variant(TIMEOUT_A::_2CYCLES)
106 }
107 #[doc = "Timeout period of 16 cycles"]
108 #[inline(always)]
109 pub fn _16cycles(self) -> &'a mut W {
110 self.variant(TIMEOUT_A::_16CYCLES)
111 }
112 #[doc = "Timeout period of 32 cycles"]
113 #[inline(always)]
114 pub fn _32cycles(self) -> &'a mut W {
115 self.variant(TIMEOUT_A::_32CYCLES)
116 }
117}
118#[doc = "Field `GMCCURTUNE` reader - Tuning of Gmc Current"]
119pub type GMCCURTUNE_R = crate::FieldReader<u8, u8>;
120#[doc = "Field `GMCCURTUNE` writer - Tuning of Gmc Current"]
121pub type GMCCURTUNE_W<'a> = crate::FieldWriter<'a, u32, LFRCOCTRL_SPEC, u8, u8, 4, 28>;
122impl R {
123 #[doc = "Bits 0:8 - LFRCO Tuning Value"]
124 #[inline(always)]
125 pub fn tuning(&self) -> TUNING_R {
126 TUNING_R::new((self.bits & 0x01ff) as u16)
127 }
128 #[doc = "Bit 16 - Enable Duty Cycling of Vref"]
129 #[inline(always)]
130 pub fn envref(&self) -> ENVREF_R {
131 ENVREF_R::new(((self.bits >> 16) & 1) != 0)
132 }
133 #[doc = "Bit 17 - Enable Comparator Chopping"]
134 #[inline(always)]
135 pub fn enchop(&self) -> ENCHOP_R {
136 ENCHOP_R::new(((self.bits >> 17) & 1) != 0)
137 }
138 #[doc = "Bit 18 - Enable Dynamic Element Matching"]
139 #[inline(always)]
140 pub fn endem(&self) -> ENDEM_R {
141 ENDEM_R::new(((self.bits >> 18) & 1) != 0)
142 }
143 #[doc = "Bits 24:25 - LFRCO Timeout"]
144 #[inline(always)]
145 pub fn timeout(&self) -> TIMEOUT_R {
146 TIMEOUT_R::new(((self.bits >> 24) & 3) as u8)
147 }
148 #[doc = "Bits 28:31 - Tuning of Gmc Current"]
149 #[inline(always)]
150 pub fn gmccurtune(&self) -> GMCCURTUNE_R {
151 GMCCURTUNE_R::new(((self.bits >> 28) & 0x0f) as u8)
152 }
153}
154impl W {
155 #[doc = "Bits 0:8 - LFRCO Tuning Value"]
156 #[inline(always)]
157 pub fn tuning(&mut self) -> TUNING_W {
158 TUNING_W::new(self)
159 }
160 #[doc = "Bit 16 - Enable Duty Cycling of Vref"]
161 #[inline(always)]
162 pub fn envref(&mut self) -> ENVREF_W {
163 ENVREF_W::new(self)
164 }
165 #[doc = "Bit 17 - Enable Comparator Chopping"]
166 #[inline(always)]
167 pub fn enchop(&mut self) -> ENCHOP_W {
168 ENCHOP_W::new(self)
169 }
170 #[doc = "Bit 18 - Enable Dynamic Element Matching"]
171 #[inline(always)]
172 pub fn endem(&mut self) -> ENDEM_W {
173 ENDEM_W::new(self)
174 }
175 #[doc = "Bits 24:25 - LFRCO Timeout"]
176 #[inline(always)]
177 pub fn timeout(&mut self) -> TIMEOUT_W {
178 TIMEOUT_W::new(self)
179 }
180 #[doc = "Bits 28:31 - Tuning of Gmc Current"]
181 #[inline(always)]
182 pub fn gmccurtune(&mut self) -> GMCCURTUNE_W {
183 GMCCURTUNE_W::new(self)
184 }
185 #[doc = "Writes raw bits to the register."]
186 #[inline(always)]
187 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
188 self.0.bits(bits);
189 self
190 }
191}
192#[doc = "LFRCO 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 [lfrcoctrl](index.html) module"]
193pub struct LFRCOCTRL_SPEC;
194impl crate::RegisterSpec for LFRCOCTRL_SPEC {
195 type Ux = u32;
196}
197#[doc = "`read()` method returns [lfrcoctrl::R](R) reader structure"]
198impl crate::Readable for LFRCOCTRL_SPEC {
199 type Reader = R;
200}
201#[doc = "`write(|w| ..)` method takes [lfrcoctrl::W](W) writer structure"]
202impl crate::Writable for LFRCOCTRL_SPEC {
203 type Writer = W;
204}
205#[doc = "`reset()` method sets LFRCOCTRL to value 0x8106_0100"]
206impl crate::Resettable for LFRCOCTRL_SPEC {
207 #[inline(always)]
208 fn reset_value() -> Self::Ux {
209 0x8106_0100
210 }
211}