atsamd11c/sysctrl/
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 Enable"]
6pub type TsenR = crate::BitReader;
7#[doc = "Field `TSEN` writer - Temperature Sensor Enable"]
8pub type TsenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `BGOUTEN` reader - Bandgap Output Enable"]
10pub type BgoutenR = crate::BitReader;
11#[doc = "Field `BGOUTEN` writer - Bandgap Output Enable"]
12pub type BgoutenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `CALIB` reader - Bandgap Voltage Generator Calibration"]
14pub type CalibR = crate::FieldReader<u16>;
15#[doc = "Field `CALIB` writer - Bandgap Voltage Generator Calibration"]
16pub type CalibW<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
17impl R {
18    #[doc = "Bit 1 - Temperature Sensor Enable"]
19    #[inline(always)]
20    pub fn tsen(&self) -> TsenR {
21        TsenR::new(((self.bits >> 1) & 1) != 0)
22    }
23    #[doc = "Bit 2 - Bandgap Output Enable"]
24    #[inline(always)]
25    pub fn bgouten(&self) -> BgoutenR {
26        BgoutenR::new(((self.bits >> 2) & 1) != 0)
27    }
28    #[doc = "Bits 16:26 - Bandgap Voltage Generator Calibration"]
29    #[inline(always)]
30    pub fn calib(&self) -> CalibR {
31        CalibR::new(((self.bits >> 16) & 0x07ff) as u16)
32    }
33}
34impl W {
35    #[doc = "Bit 1 - Temperature Sensor Enable"]
36    #[inline(always)]
37    #[must_use]
38    pub fn tsen(&mut self) -> TsenW<VrefSpec> {
39        TsenW::new(self, 1)
40    }
41    #[doc = "Bit 2 - Bandgap Output Enable"]
42    #[inline(always)]
43    #[must_use]
44    pub fn bgouten(&mut self) -> BgoutenW<VrefSpec> {
45        BgoutenW::new(self, 2)
46    }
47    #[doc = "Bits 16:26 - Bandgap Voltage Generator Calibration"]
48    #[inline(always)]
49    #[must_use]
50    pub fn calib(&mut self) -> CalibW<VrefSpec> {
51        CalibW::new(self, 16)
52    }
53}
54#[doc = "Voltage References System (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)."]
55pub struct VrefSpec;
56impl crate::RegisterSpec for VrefSpec {
57    type Ux = u32;
58}
59#[doc = "`read()` method returns [`vref::R`](R) reader structure"]
60impl crate::Readable for VrefSpec {}
61#[doc = "`write(|w| ..)` method takes [`vref::W`](W) writer structure"]
62impl crate::Writable for VrefSpec {
63    type Safety = crate::Unsafe;
64    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
65    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
66}
67#[doc = "`reset()` method sets VREF to value 0"]
68impl crate::Resettable for VrefSpec {
69    const RESET_VALUE: u32 = 0;
70}