1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
#[doc = "Reader of register SC"]
pub type R = crate::R<u8, super::SC>;
#[doc = "Writer for register SC"]
pub type W = crate::W<u8, super::SC>;
#[doc = "Register SC `reset()`'s with value 0"]
impl crate::ResetValue for super::SC {
  type Type = u8;
  #[inline(always)]
  fn reset_value() -> Self::Type {
    0
  }
}
#[doc = "Buffer Mode selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MODE_LV_A {
  #[doc = "0: Bandgap on only, for stabilization and startup"]
  MODE_LV_0,
  #[doc = "1: High power buffer mode enabled"]
  MODE_LV_1,
  #[doc = "2: no description available"]
  MODE_LV_2,
}
impl From<MODE_LV_A> for u8 {
  #[inline(always)]
  fn from(variant: MODE_LV_A) -> Self {
    match variant {
      MODE_LV_A::MODE_LV_0 => 0,
      MODE_LV_A::MODE_LV_1 => 1,
      MODE_LV_A::MODE_LV_2 => 2,
    }
  }
}
#[doc = "Reader of field `MODE_LV`"]
pub type MODE_LV_R = crate::R<u8, MODE_LV_A>;
impl MODE_LV_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> crate::Variant<u8, MODE_LV_A> {
    use crate::Variant::*;
    match self.bits {
      0 => Val(MODE_LV_A::MODE_LV_0),
      1 => Val(MODE_LV_A::MODE_LV_1),
      2 => Val(MODE_LV_A::MODE_LV_2),
      i => Res(i),
    }
  }
  #[doc = "Checks if the value of the field is `MODE_LV_0`"]
  #[inline(always)]
  pub fn is_mode_lv_0(&self) -> bool {
    *self == MODE_LV_A::MODE_LV_0
  }
  #[doc = "Checks if the value of the field is `MODE_LV_1`"]
  #[inline(always)]
  pub fn is_mode_lv_1(&self) -> bool {
    *self == MODE_LV_A::MODE_LV_1
  }
  #[doc = "Checks if the value of the field is `MODE_LV_2`"]
  #[inline(always)]
  pub fn is_mode_lv_2(&self) -> bool {
    *self == MODE_LV_A::MODE_LV_2
  }
}
#[doc = "Write proxy for field `MODE_LV`"]
pub struct MODE_LV_W<'a> {
  w: &'a mut W,
}
impl<'a> MODE_LV_W<'a> {
  #[doc = r"Writes `variant` to the field"]
  #[inline(always)]
  pub fn variant(self, variant: MODE_LV_A) -> &'a mut W {
    unsafe { self.bits(variant.into()) }
  }
  #[doc = "Bandgap on only, for stabilization and startup"]
  #[inline(always)]
  pub fn mode_lv_0(self) -> &'a mut W {
    self.variant(MODE_LV_A::MODE_LV_0)
  }
  #[doc = "High power buffer mode enabled"]
  #[inline(always)]
  pub fn mode_lv_1(self) -> &'a mut W {
    self.variant(MODE_LV_A::MODE_LV_1)
  }
  #[doc = "no description available"]
  #[inline(always)]
  pub fn mode_lv_2(self) -> &'a mut W {
    self.variant(MODE_LV_A::MODE_LV_2)
  }
  #[doc = r"Writes raw bits to the field"]
  #[inline(always)]
  pub unsafe fn bits(self, value: u8) -> &'a mut W {
    self.w.bits = (self.w.bits & !0x03) | ((value as u8) & 0x03);
    self.w
  }
}
#[doc = "Internal Voltage Reference stable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VREFST_A {
  #[doc = "0: The module is disabled or not stable."]
  VREFST_0,
  #[doc = "1: The module is stable."]
  VREFST_1,
}
impl From<VREFST_A> for bool {
  #[inline(always)]
  fn from(variant: VREFST_A) -> Self {
    match variant {
      VREFST_A::VREFST_0 => false,
      VREFST_A::VREFST_1 => true,
    }
  }
}
#[doc = "Reader of field `VREFST`"]
pub type VREFST_R = crate::R<bool, VREFST_A>;
impl VREFST_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> VREFST_A {
    match self.bits {
      false => VREFST_A::VREFST_0,
      true => VREFST_A::VREFST_1,
    }
  }
  #[doc = "Checks if the value of the field is `VREFST_0`"]
  #[inline(always)]
  pub fn is_vrefst_0(&self) -> bool {
    *self == VREFST_A::VREFST_0
  }
  #[doc = "Checks if the value of the field is `VREFST_1`"]
  #[inline(always)]
  pub fn is_vrefst_1(&self) -> bool {
    *self == VREFST_A::VREFST_1
  }
}
#[doc = "Second order curvature compensation enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ICOMPEN_A {
  #[doc = "0: Disabled"]
  ICOMPEN_0,
  #[doc = "1: Enabled"]
  ICOMPEN_1,
}
impl From<ICOMPEN_A> for bool {
  #[inline(always)]
  fn from(variant: ICOMPEN_A) -> Self {
    match variant {
      ICOMPEN_A::ICOMPEN_0 => false,
      ICOMPEN_A::ICOMPEN_1 => true,
    }
  }
}
#[doc = "Reader of field `ICOMPEN`"]
pub type ICOMPEN_R = crate::R<bool, ICOMPEN_A>;
impl ICOMPEN_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> ICOMPEN_A {
    match self.bits {
      false => ICOMPEN_A::ICOMPEN_0,
      true => ICOMPEN_A::ICOMPEN_1,
    }
  }
  #[doc = "Checks if the value of the field is `ICOMPEN_0`"]
  #[inline(always)]
  pub fn is_icompen_0(&self) -> bool {
    *self == ICOMPEN_A::ICOMPEN_0
  }
  #[doc = "Checks if the value of the field is `ICOMPEN_1`"]
  #[inline(always)]
  pub fn is_icompen_1(&self) -> bool {
    *self == ICOMPEN_A::ICOMPEN_1
  }
}
#[doc = "Write proxy for field `ICOMPEN`"]
pub struct ICOMPEN_W<'a> {
  w: &'a mut W,
}
impl<'a> ICOMPEN_W<'a> {
  #[doc = r"Writes `variant` to the field"]
  #[inline(always)]
  pub fn variant(self, variant: ICOMPEN_A) -> &'a mut W {
    {
      self.bit(variant.into())
    }
  }
  #[doc = "Disabled"]
  #[inline(always)]
  pub fn icompen_0(self) -> &'a mut W {
    self.variant(ICOMPEN_A::ICOMPEN_0)
  }
  #[doc = "Enabled"]
  #[inline(always)]
  pub fn icompen_1(self) -> &'a mut W {
    self.variant(ICOMPEN_A::ICOMPEN_1)
  }
  #[doc = r"Sets the field bit"]
  #[inline(always)]
  pub fn set_bit(self) -> &'a mut W {
    self.bit(true)
  }
  #[doc = r"Clears the field bit"]
  #[inline(always)]
  pub fn clear_bit(self) -> &'a mut W {
    self.bit(false)
  }
  #[doc = r"Writes raw bits to the field"]
  #[inline(always)]
  pub fn bit(self, value: bool) -> &'a mut W {
    self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u8) & 0x01) << 5);
    self.w
  }
}
#[doc = "Regulator enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum REGEN_A {
  #[doc = "0: Internal 1.75 V regulator is disabled."]
  REGEN_0,
  #[doc = "1: Internal 1.75 V regulator is enabled."]
  REGEN_1,
}
impl From<REGEN_A> for bool {
  #[inline(always)]
  fn from(variant: REGEN_A) -> Self {
    match variant {
      REGEN_A::REGEN_0 => false,
      REGEN_A::REGEN_1 => true,
    }
  }
}
#[doc = "Reader of field `REGEN`"]
pub type REGEN_R = crate::R<bool, REGEN_A>;
impl REGEN_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> REGEN_A {
    match self.bits {
      false => REGEN_A::REGEN_0,
      true => REGEN_A::REGEN_1,
    }
  }
  #[doc = "Checks if the value of the field is `REGEN_0`"]
  #[inline(always)]
  pub fn is_regen_0(&self) -> bool {
    *self == REGEN_A::REGEN_0
  }
  #[doc = "Checks if the value of the field is `REGEN_1`"]
  #[inline(always)]
  pub fn is_regen_1(&self) -> bool {
    *self == REGEN_A::REGEN_1
  }
}
#[doc = "Write proxy for field `REGEN`"]
pub struct REGEN_W<'a> {
  w: &'a mut W,
}
impl<'a> REGEN_W<'a> {
  #[doc = r"Writes `variant` to the field"]
  #[inline(always)]
  pub fn variant(self, variant: REGEN_A) -> &'a mut W {
    {
      self.bit(variant.into())
    }
  }
  #[doc = "Internal 1.75 V regulator is disabled."]
  #[inline(always)]
  pub fn regen_0(self) -> &'a mut W {
    self.variant(REGEN_A::REGEN_0)
  }
  #[doc = "Internal 1.75 V regulator is enabled."]
  #[inline(always)]
  pub fn regen_1(self) -> &'a mut W {
    self.variant(REGEN_A::REGEN_1)
  }
  #[doc = r"Sets the field bit"]
  #[inline(always)]
  pub fn set_bit(self) -> &'a mut W {
    self.bit(true)
  }
  #[doc = r"Clears the field bit"]
  #[inline(always)]
  pub fn clear_bit(self) -> &'a mut W {
    self.bit(false)
  }
  #[doc = r"Writes raw bits to the field"]
  #[inline(always)]
  pub fn bit(self, value: bool) -> &'a mut W {
    self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
    self.w
  }
}
#[doc = "Internal Voltage Reference enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VREFEN_A {
  #[doc = "0: The module is disabled."]
  VREFEN_0,
  #[doc = "1: The module is enabled."]
  VREFEN_1,
}
impl From<VREFEN_A> for bool {
  #[inline(always)]
  fn from(variant: VREFEN_A) -> Self {
    match variant {
      VREFEN_A::VREFEN_0 => false,
      VREFEN_A::VREFEN_1 => true,
    }
  }
}
#[doc = "Reader of field `VREFEN`"]
pub type VREFEN_R = crate::R<bool, VREFEN_A>;
impl VREFEN_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> VREFEN_A {
    match self.bits {
      false => VREFEN_A::VREFEN_0,
      true => VREFEN_A::VREFEN_1,
    }
  }
  #[doc = "Checks if the value of the field is `VREFEN_0`"]
  #[inline(always)]
  pub fn is_vrefen_0(&self) -> bool {
    *self == VREFEN_A::VREFEN_0
  }
  #[doc = "Checks if the value of the field is `VREFEN_1`"]
  #[inline(always)]
  pub fn is_vrefen_1(&self) -> bool {
    *self == VREFEN_A::VREFEN_1
  }
}
#[doc = "Write proxy for field `VREFEN`"]
pub struct VREFEN_W<'a> {
  w: &'a mut W,
}
impl<'a> VREFEN_W<'a> {
  #[doc = r"Writes `variant` to the field"]
  #[inline(always)]
  pub fn variant(self, variant: VREFEN_A) -> &'a mut W {
    {
      self.bit(variant.into())
    }
  }
  #[doc = "The module is disabled."]
  #[inline(always)]
  pub fn vrefen_0(self) -> &'a mut W {
    self.variant(VREFEN_A::VREFEN_0)
  }
  #[doc = "The module is enabled."]
  #[inline(always)]
  pub fn vrefen_1(self) -> &'a mut W {
    self.variant(VREFEN_A::VREFEN_1)
  }
  #[doc = r"Sets the field bit"]
  #[inline(always)]
  pub fn set_bit(self) -> &'a mut W {
    self.bit(true)
  }
  #[doc = r"Clears the field bit"]
  #[inline(always)]
  pub fn clear_bit(self) -> &'a mut W {
    self.bit(false)
  }
  #[doc = r"Writes raw bits to the field"]
  #[inline(always)]
  pub fn bit(self, value: bool) -> &'a mut W {
    self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
    self.w
  }
}
impl R {
  #[doc = "Bits 0:1 - Buffer Mode selection"]
  #[inline(always)]
  pub fn mode_lv(&self) -> MODE_LV_R {
    MODE_LV_R::new((self.bits & 0x03) as u8)
  }
  #[doc = "Bit 2 - Internal Voltage Reference stable"]
  #[inline(always)]
  pub fn vrefst(&self) -> VREFST_R {
    VREFST_R::new(((self.bits >> 2) & 0x01) != 0)
  }
  #[doc = "Bit 5 - Second order curvature compensation enable"]
  #[inline(always)]
  pub fn icompen(&self) -> ICOMPEN_R {
    ICOMPEN_R::new(((self.bits >> 5) & 0x01) != 0)
  }
  #[doc = "Bit 6 - Regulator enable"]
  #[inline(always)]
  pub fn regen(&self) -> REGEN_R {
    REGEN_R::new(((self.bits >> 6) & 0x01) != 0)
  }
  #[doc = "Bit 7 - Internal Voltage Reference enable"]
  #[inline(always)]
  pub fn vrefen(&self) -> VREFEN_R {
    VREFEN_R::new(((self.bits >> 7) & 0x01) != 0)
  }
}
impl W {
  #[doc = "Bits 0:1 - Buffer Mode selection"]
  #[inline(always)]
  pub fn mode_lv(&mut self) -> MODE_LV_W {
    MODE_LV_W { w: self }
  }
  #[doc = "Bit 5 - Second order curvature compensation enable"]
  #[inline(always)]
  pub fn icompen(&mut self) -> ICOMPEN_W {
    ICOMPEN_W { w: self }
  }
  #[doc = "Bit 6 - Regulator enable"]
  #[inline(always)]
  pub fn regen(&mut self) -> REGEN_W {
    REGEN_W { w: self }
  }
  #[doc = "Bit 7 - Internal Voltage Reference enable"]
  #[inline(always)]
  pub fn vrefen(&mut self) -> VREFEN_W {
    VREFEN_W { w: self }
  }
}