msp430f6736/shared_reference/
refctl0.rs1#[doc = "Register `REFCTL0` reader"]
2pub struct R(crate::R<REFCTL0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<REFCTL0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<REFCTL0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<REFCTL0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `REFCTL0` writer"]
17pub struct W(crate::W<REFCTL0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<REFCTL0_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<REFCTL0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<REFCTL0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `REFON` reader - REF Reference On"]
38pub type REFON_R = crate::BitReader<bool>;
39#[doc = "Field `REFON` writer - REF Reference On"]
40pub type REFON_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 0>;
41#[doc = "Field `REFOUT` reader - REF Reference output Buffer On"]
42pub type REFOUT_R = crate::BitReader<bool>;
43#[doc = "Field `REFOUT` writer - REF Reference output Buffer On"]
44pub type REFOUT_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 1>;
45#[doc = "Field `REFTCOFF` reader - REF Temp.Sensor off"]
46pub type REFTCOFF_R = crate::BitReader<bool>;
47#[doc = "Field `REFTCOFF` writer - REF Temp.Sensor off"]
48pub type REFTCOFF_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 3>;
49#[doc = "REF Reference Voltage Level Select Bit:0\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51#[repr(u8)]
52pub enum REFVSEL_A {
53 #[doc = "0: REF Reference Voltage Level Select 1.5V"]
54 REFVSEL_0 = 0,
55 #[doc = "1: REF Reference Voltage Level Select 2.0V"]
56 REFVSEL_1 = 1,
57 #[doc = "2: REF Reference Voltage Level Select 2.5V"]
58 REFVSEL_2 = 2,
59 #[doc = "3: REF Reference Voltage Level Select 2.5V"]
60 REFVSEL_3 = 3,
61}
62impl From<REFVSEL_A> for u8 {
63 #[inline(always)]
64 fn from(variant: REFVSEL_A) -> Self {
65 variant as _
66 }
67}
68#[doc = "Field `REFVSEL` reader - REF Reference Voltage Level Select Bit:0"]
69pub type REFVSEL_R = crate::FieldReader<u8, REFVSEL_A>;
70impl REFVSEL_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> REFVSEL_A {
74 match self.bits {
75 0 => REFVSEL_A::REFVSEL_0,
76 1 => REFVSEL_A::REFVSEL_1,
77 2 => REFVSEL_A::REFVSEL_2,
78 3 => REFVSEL_A::REFVSEL_3,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `REFVSEL_0`"]
83 #[inline(always)]
84 pub fn is_refvsel_0(&self) -> bool {
85 *self == REFVSEL_A::REFVSEL_0
86 }
87 #[doc = "Checks if the value of the field is `REFVSEL_1`"]
88 #[inline(always)]
89 pub fn is_refvsel_1(&self) -> bool {
90 *self == REFVSEL_A::REFVSEL_1
91 }
92 #[doc = "Checks if the value of the field is `REFVSEL_2`"]
93 #[inline(always)]
94 pub fn is_refvsel_2(&self) -> bool {
95 *self == REFVSEL_A::REFVSEL_2
96 }
97 #[doc = "Checks if the value of the field is `REFVSEL_3`"]
98 #[inline(always)]
99 pub fn is_refvsel_3(&self) -> bool {
100 *self == REFVSEL_A::REFVSEL_3
101 }
102}
103#[doc = "Field `REFVSEL` writer - REF Reference Voltage Level Select Bit:0"]
104pub type REFVSEL_W<'a> = crate::FieldWriterSafe<'a, u16, REFCTL0_SPEC, u8, REFVSEL_A, 2, 4>;
105impl<'a> REFVSEL_W<'a> {
106 #[doc = "REF Reference Voltage Level Select 1.5V"]
107 #[inline(always)]
108 pub fn refvsel_0(self) -> &'a mut W {
109 self.variant(REFVSEL_A::REFVSEL_0)
110 }
111 #[doc = "REF Reference Voltage Level Select 2.0V"]
112 #[inline(always)]
113 pub fn refvsel_1(self) -> &'a mut W {
114 self.variant(REFVSEL_A::REFVSEL_1)
115 }
116 #[doc = "REF Reference Voltage Level Select 2.5V"]
117 #[inline(always)]
118 pub fn refvsel_2(self) -> &'a mut W {
119 self.variant(REFVSEL_A::REFVSEL_2)
120 }
121 #[doc = "REF Reference Voltage Level Select 2.5V"]
122 #[inline(always)]
123 pub fn refvsel_3(self) -> &'a mut W {
124 self.variant(REFVSEL_A::REFVSEL_3)
125 }
126}
127#[doc = "Field `REFMSTR` reader - REF Master Control"]
128pub type REFMSTR_R = crate::BitReader<bool>;
129#[doc = "Field `REFMSTR` writer - REF Master Control"]
130pub type REFMSTR_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 7>;
131#[doc = "Field `REFGENACT` reader - REF Reference generator active"]
132pub type REFGENACT_R = crate::BitReader<bool>;
133#[doc = "Field `REFGENACT` writer - REF Reference generator active"]
134pub type REFGENACT_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 8>;
135#[doc = "Field `REFBGACT` reader - REF Reference bandgap active"]
136pub type REFBGACT_R = crate::BitReader<bool>;
137#[doc = "Field `REFBGACT` writer - REF Reference bandgap active"]
138pub type REFBGACT_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 9>;
139#[doc = "Field `REFGENBUSY` reader - REF Reference generator busy"]
140pub type REFGENBUSY_R = crate::BitReader<bool>;
141#[doc = "Field `REFGENBUSY` writer - REF Reference generator busy"]
142pub type REFGENBUSY_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 10>;
143#[doc = "Field `BGMODE` reader - REF Bandgap mode"]
144pub type BGMODE_R = crate::BitReader<bool>;
145#[doc = "Field `BGMODE` writer - REF Bandgap mode"]
146pub type BGMODE_W<'a> = crate::BitWriter<'a, u16, REFCTL0_SPEC, bool, 11>;
147impl R {
148 #[doc = "Bit 0 - REF Reference On"]
149 #[inline(always)]
150 pub fn refon(&self) -> REFON_R {
151 REFON_R::new((self.bits & 1) != 0)
152 }
153 #[doc = "Bit 1 - REF Reference output Buffer On"]
154 #[inline(always)]
155 pub fn refout(&self) -> REFOUT_R {
156 REFOUT_R::new(((self.bits >> 1) & 1) != 0)
157 }
158 #[doc = "Bit 3 - REF Temp.Sensor off"]
159 #[inline(always)]
160 pub fn reftcoff(&self) -> REFTCOFF_R {
161 REFTCOFF_R::new(((self.bits >> 3) & 1) != 0)
162 }
163 #[doc = "Bits 4:5 - REF Reference Voltage Level Select Bit:0"]
164 #[inline(always)]
165 pub fn refvsel(&self) -> REFVSEL_R {
166 REFVSEL_R::new(((self.bits >> 4) & 3) as u8)
167 }
168 #[doc = "Bit 7 - REF Master Control"]
169 #[inline(always)]
170 pub fn refmstr(&self) -> REFMSTR_R {
171 REFMSTR_R::new(((self.bits >> 7) & 1) != 0)
172 }
173 #[doc = "Bit 8 - REF Reference generator active"]
174 #[inline(always)]
175 pub fn refgenact(&self) -> REFGENACT_R {
176 REFGENACT_R::new(((self.bits >> 8) & 1) != 0)
177 }
178 #[doc = "Bit 9 - REF Reference bandgap active"]
179 #[inline(always)]
180 pub fn refbgact(&self) -> REFBGACT_R {
181 REFBGACT_R::new(((self.bits >> 9) & 1) != 0)
182 }
183 #[doc = "Bit 10 - REF Reference generator busy"]
184 #[inline(always)]
185 pub fn refgenbusy(&self) -> REFGENBUSY_R {
186 REFGENBUSY_R::new(((self.bits >> 10) & 1) != 0)
187 }
188 #[doc = "Bit 11 - REF Bandgap mode"]
189 #[inline(always)]
190 pub fn bgmode(&self) -> BGMODE_R {
191 BGMODE_R::new(((self.bits >> 11) & 1) != 0)
192 }
193}
194impl W {
195 #[doc = "Bit 0 - REF Reference On"]
196 #[inline(always)]
197 pub fn refon(&mut self) -> REFON_W {
198 REFON_W::new(self)
199 }
200 #[doc = "Bit 1 - REF Reference output Buffer On"]
201 #[inline(always)]
202 pub fn refout(&mut self) -> REFOUT_W {
203 REFOUT_W::new(self)
204 }
205 #[doc = "Bit 3 - REF Temp.Sensor off"]
206 #[inline(always)]
207 pub fn reftcoff(&mut self) -> REFTCOFF_W {
208 REFTCOFF_W::new(self)
209 }
210 #[doc = "Bits 4:5 - REF Reference Voltage Level Select Bit:0"]
211 #[inline(always)]
212 pub fn refvsel(&mut self) -> REFVSEL_W {
213 REFVSEL_W::new(self)
214 }
215 #[doc = "Bit 7 - REF Master Control"]
216 #[inline(always)]
217 pub fn refmstr(&mut self) -> REFMSTR_W {
218 REFMSTR_W::new(self)
219 }
220 #[doc = "Bit 8 - REF Reference generator active"]
221 #[inline(always)]
222 pub fn refgenact(&mut self) -> REFGENACT_W {
223 REFGENACT_W::new(self)
224 }
225 #[doc = "Bit 9 - REF Reference bandgap active"]
226 #[inline(always)]
227 pub fn refbgact(&mut self) -> REFBGACT_W {
228 REFBGACT_W::new(self)
229 }
230 #[doc = "Bit 10 - REF Reference generator busy"]
231 #[inline(always)]
232 pub fn refgenbusy(&mut self) -> REFGENBUSY_W {
233 REFGENBUSY_W::new(self)
234 }
235 #[doc = "Bit 11 - REF Bandgap mode"]
236 #[inline(always)]
237 pub fn bgmode(&mut self) -> BGMODE_W {
238 BGMODE_W::new(self)
239 }
240 #[doc = "Writes raw bits to the register."]
241 #[inline(always)]
242 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
243 self.0.bits(bits);
244 self
245 }
246}
247#[doc = "REF Shared Reference control register 0\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 [refctl0](index.html) module"]
248pub struct REFCTL0_SPEC;
249impl crate::RegisterSpec for REFCTL0_SPEC {
250 type Ux = u16;
251}
252#[doc = "`read()` method returns [refctl0::R](R) reader structure"]
253impl crate::Readable for REFCTL0_SPEC {
254 type Reader = R;
255}
256#[doc = "`write(|w| ..)` method takes [refctl0::W](W) writer structure"]
257impl crate::Writable for REFCTL0_SPEC {
258 type Writer = W;
259}
260#[doc = "`reset()` method sets REFCTL0 to value 0"]
261impl crate::Resettable for REFCTL0_SPEC {
262 #[inline(always)]
263 fn reset_value() -> Self::Ux {
264 0
265 }
266}