atsamd51p/supc/
vref.rs
1#[doc = "Register `VREF` reader"]
2pub type R = crate::R<VrefSpec>;
3#[doc = "Register `VREF` writer"]
4pub type W = crate::W<VrefSpec>;
5#[doc = "Field `TSEN` reader - Temperature Sensor Output Enable"]
6pub type TsenR = crate::BitReader;
7#[doc = "Field `TSEN` writer - Temperature Sensor Output Enable"]
8pub type TsenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `VREFOE` reader - Voltage Reference Output Enable"]
10pub type VrefoeR = crate::BitReader;
11#[doc = "Field `VREFOE` writer - Voltage Reference Output Enable"]
12pub type VrefoeW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `TSSEL` reader - Temperature Sensor Selection"]
14pub type TsselR = crate::BitReader;
15#[doc = "Field `TSSEL` writer - Temperature Sensor Selection"]
16pub type TsselW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `RUNSTDBY` reader - Run during Standby"]
18pub type RunstdbyR = crate::BitReader;
19#[doc = "Field `RUNSTDBY` writer - Run during Standby"]
20pub type RunstdbyW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `ONDEMAND` reader - On Demand Contrl"]
22pub type OndemandR = crate::BitReader;
23#[doc = "Field `ONDEMAND` writer - On Demand Contrl"]
24pub type OndemandW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Voltage Reference Selection\n\nValue on reset: 0"]
26#[derive(Clone, Copy, Debug, PartialEq, Eq)]
27#[repr(u8)]
28pub enum Selselect {
29 #[doc = "0: 1.0V voltage reference typical value"]
30 _1v0 = 0,
31 #[doc = "1: 1.1V voltage reference typical value"]
32 _1v1 = 1,
33 #[doc = "2: 1.2V voltage reference typical value"]
34 _1v2 = 2,
35 #[doc = "3: 1.25V voltage reference typical value"]
36 _1v25 = 3,
37 #[doc = "4: 2.0V voltage reference typical value"]
38 _2v0 = 4,
39 #[doc = "5: 2.2V voltage reference typical value"]
40 _2v2 = 5,
41 #[doc = "6: 2.4V voltage reference typical value"]
42 _2v4 = 6,
43 #[doc = "7: 2.5V voltage reference typical value"]
44 _2v5 = 7,
45}
46impl From<Selselect> for u8 {
47 #[inline(always)]
48 fn from(variant: Selselect) -> Self {
49 variant as _
50 }
51}
52impl crate::FieldSpec for Selselect {
53 type Ux = u8;
54}
55impl crate::IsEnum for Selselect {}
56#[doc = "Field `SEL` reader - Voltage Reference Selection"]
57pub type SelR = crate::FieldReader<Selselect>;
58impl SelR {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub const fn variant(&self) -> Option<Selselect> {
62 match self.bits {
63 0 => Some(Selselect::_1v0),
64 1 => Some(Selselect::_1v1),
65 2 => Some(Selselect::_1v2),
66 3 => Some(Selselect::_1v25),
67 4 => Some(Selselect::_2v0),
68 5 => Some(Selselect::_2v2),
69 6 => Some(Selselect::_2v4),
70 7 => Some(Selselect::_2v5),
71 _ => None,
72 }
73 }
74 #[doc = "1.0V voltage reference typical value"]
75 #[inline(always)]
76 pub fn is_1v0(&self) -> bool {
77 *self == Selselect::_1v0
78 }
79 #[doc = "1.1V voltage reference typical value"]
80 #[inline(always)]
81 pub fn is_1v1(&self) -> bool {
82 *self == Selselect::_1v1
83 }
84 #[doc = "1.2V voltage reference typical value"]
85 #[inline(always)]
86 pub fn is_1v2(&self) -> bool {
87 *self == Selselect::_1v2
88 }
89 #[doc = "1.25V voltage reference typical value"]
90 #[inline(always)]
91 pub fn is_1v25(&self) -> bool {
92 *self == Selselect::_1v25
93 }
94 #[doc = "2.0V voltage reference typical value"]
95 #[inline(always)]
96 pub fn is_2v0(&self) -> bool {
97 *self == Selselect::_2v0
98 }
99 #[doc = "2.2V voltage reference typical value"]
100 #[inline(always)]
101 pub fn is_2v2(&self) -> bool {
102 *self == Selselect::_2v2
103 }
104 #[doc = "2.4V voltage reference typical value"]
105 #[inline(always)]
106 pub fn is_2v4(&self) -> bool {
107 *self == Selselect::_2v4
108 }
109 #[doc = "2.5V voltage reference typical value"]
110 #[inline(always)]
111 pub fn is_2v5(&self) -> bool {
112 *self == Selselect::_2v5
113 }
114}
115#[doc = "Field `SEL` writer - Voltage Reference Selection"]
116pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 4, Selselect>;
117impl<'a, REG> SelW<'a, REG>
118where
119 REG: crate::Writable + crate::RegisterSpec,
120 REG::Ux: From<u8>,
121{
122 #[doc = "1.0V voltage reference typical value"]
123 #[inline(always)]
124 pub fn _1v0(self) -> &'a mut crate::W<REG> {
125 self.variant(Selselect::_1v0)
126 }
127 #[doc = "1.1V voltage reference typical value"]
128 #[inline(always)]
129 pub fn _1v1(self) -> &'a mut crate::W<REG> {
130 self.variant(Selselect::_1v1)
131 }
132 #[doc = "1.2V voltage reference typical value"]
133 #[inline(always)]
134 pub fn _1v2(self) -> &'a mut crate::W<REG> {
135 self.variant(Selselect::_1v2)
136 }
137 #[doc = "1.25V voltage reference typical value"]
138 #[inline(always)]
139 pub fn _1v25(self) -> &'a mut crate::W<REG> {
140 self.variant(Selselect::_1v25)
141 }
142 #[doc = "2.0V voltage reference typical value"]
143 #[inline(always)]
144 pub fn _2v0(self) -> &'a mut crate::W<REG> {
145 self.variant(Selselect::_2v0)
146 }
147 #[doc = "2.2V voltage reference typical value"]
148 #[inline(always)]
149 pub fn _2v2(self) -> &'a mut crate::W<REG> {
150 self.variant(Selselect::_2v2)
151 }
152 #[doc = "2.4V voltage reference typical value"]
153 #[inline(always)]
154 pub fn _2v4(self) -> &'a mut crate::W<REG> {
155 self.variant(Selselect::_2v4)
156 }
157 #[doc = "2.5V voltage reference typical value"]
158 #[inline(always)]
159 pub fn _2v5(self) -> &'a mut crate::W<REG> {
160 self.variant(Selselect::_2v5)
161 }
162}
163impl R {
164 #[doc = "Bit 1 - Temperature Sensor Output Enable"]
165 #[inline(always)]
166 pub fn tsen(&self) -> TsenR {
167 TsenR::new(((self.bits >> 1) & 1) != 0)
168 }
169 #[doc = "Bit 2 - Voltage Reference Output Enable"]
170 #[inline(always)]
171 pub fn vrefoe(&self) -> VrefoeR {
172 VrefoeR::new(((self.bits >> 2) & 1) != 0)
173 }
174 #[doc = "Bit 3 - Temperature Sensor Selection"]
175 #[inline(always)]
176 pub fn tssel(&self) -> TsselR {
177 TsselR::new(((self.bits >> 3) & 1) != 0)
178 }
179 #[doc = "Bit 6 - Run during Standby"]
180 #[inline(always)]
181 pub fn runstdby(&self) -> RunstdbyR {
182 RunstdbyR::new(((self.bits >> 6) & 1) != 0)
183 }
184 #[doc = "Bit 7 - On Demand Contrl"]
185 #[inline(always)]
186 pub fn ondemand(&self) -> OndemandR {
187 OndemandR::new(((self.bits >> 7) & 1) != 0)
188 }
189 #[doc = "Bits 16:19 - Voltage Reference Selection"]
190 #[inline(always)]
191 pub fn sel(&self) -> SelR {
192 SelR::new(((self.bits >> 16) & 0x0f) as u8)
193 }
194}
195impl W {
196 #[doc = "Bit 1 - Temperature Sensor Output Enable"]
197 #[inline(always)]
198 #[must_use]
199 pub fn tsen(&mut self) -> TsenW<VrefSpec> {
200 TsenW::new(self, 1)
201 }
202 #[doc = "Bit 2 - Voltage Reference Output Enable"]
203 #[inline(always)]
204 #[must_use]
205 pub fn vrefoe(&mut self) -> VrefoeW<VrefSpec> {
206 VrefoeW::new(self, 2)
207 }
208 #[doc = "Bit 3 - Temperature Sensor Selection"]
209 #[inline(always)]
210 #[must_use]
211 pub fn tssel(&mut self) -> TsselW<VrefSpec> {
212 TsselW::new(self, 3)
213 }
214 #[doc = "Bit 6 - Run during Standby"]
215 #[inline(always)]
216 #[must_use]
217 pub fn runstdby(&mut self) -> RunstdbyW<VrefSpec> {
218 RunstdbyW::new(self, 6)
219 }
220 #[doc = "Bit 7 - On Demand Contrl"]
221 #[inline(always)]
222 #[must_use]
223 pub fn ondemand(&mut self) -> OndemandW<VrefSpec> {
224 OndemandW::new(self, 7)
225 }
226 #[doc = "Bits 16:19 - Voltage Reference Selection"]
227 #[inline(always)]
228 #[must_use]
229 pub fn sel(&mut self) -> SelW<VrefSpec> {
230 SelW::new(self, 16)
231 }
232}
233#[doc = "VREF Control\n\nYou can [`read`](crate::Reg::read) this register and get [`vref::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`vref::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
234pub struct VrefSpec;
235impl crate::RegisterSpec for VrefSpec {
236 type Ux = u32;
237}
238#[doc = "`read()` method returns [`vref::R`](R) reader structure"]
239impl crate::Readable for VrefSpec {}
240#[doc = "`write(|w| ..)` method takes [`vref::W`](W) writer structure"]
241impl crate::Writable for VrefSpec {
242 type Safety = crate::Unsafe;
243 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
244 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
245}
246#[doc = "`reset()` method sets VREF to value 0"]
247impl crate::Resettable for VrefSpec {
248 const RESET_VALUE: u32 = 0;
249}