atsamd11c/sysctrl/
xosc32k.rs

1#[doc = "Register `XOSC32K` reader"]
2pub type R = crate::R<Xosc32kSpec>;
3#[doc = "Register `XOSC32K` writer"]
4pub type W = crate::W<Xosc32kSpec>;
5#[doc = "Field `ENABLE` reader - Oscillator Enable"]
6pub type EnableR = crate::BitReader;
7#[doc = "Field `ENABLE` writer - Oscillator Enable"]
8pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `XTALEN` reader - Crystal Oscillator Enable"]
10pub type XtalenR = crate::BitReader;
11#[doc = "Field `XTALEN` writer - Crystal Oscillator Enable"]
12pub type XtalenW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `EN32K` reader - 32kHz Output Enable"]
14pub type En32kR = crate::BitReader;
15#[doc = "Field `EN32K` writer - 32kHz Output Enable"]
16pub type En32kW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `EN1K` reader - 1kHz Output Enable"]
18pub type En1kR = crate::BitReader;
19#[doc = "Field `EN1K` writer - 1kHz Output Enable"]
20pub type En1kW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `AAMPEN` reader - Automatic Amplitude Control Enable"]
22pub type AampenR = crate::BitReader;
23#[doc = "Field `AAMPEN` writer - Automatic Amplitude Control Enable"]
24pub type AampenW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `RUNSTDBY` reader - Run in Standby"]
26pub type RunstdbyR = crate::BitReader;
27#[doc = "Field `RUNSTDBY` writer - Run in Standby"]
28pub type RunstdbyW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `ONDEMAND` reader - On Demand Control"]
30pub type OndemandR = crate::BitReader;
31#[doc = "Field `ONDEMAND` writer - On Demand Control"]
32pub type OndemandW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `STARTUP` reader - Oscillator Start-Up Time"]
34pub type StartupR = crate::FieldReader;
35#[doc = "Field `STARTUP` writer - Oscillator Start-Up Time"]
36pub type StartupW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
37#[doc = "Field `WRTLOCK` reader - Write Lock"]
38pub type WrtlockR = crate::BitReader;
39#[doc = "Field `WRTLOCK` writer - Write Lock"]
40pub type WrtlockW<'a, REG> = crate::BitWriter<'a, REG>;
41impl R {
42    #[doc = "Bit 1 - Oscillator Enable"]
43    #[inline(always)]
44    pub fn enable(&self) -> EnableR {
45        EnableR::new(((self.bits >> 1) & 1) != 0)
46    }
47    #[doc = "Bit 2 - Crystal Oscillator Enable"]
48    #[inline(always)]
49    pub fn xtalen(&self) -> XtalenR {
50        XtalenR::new(((self.bits >> 2) & 1) != 0)
51    }
52    #[doc = "Bit 3 - 32kHz Output Enable"]
53    #[inline(always)]
54    pub fn en32k(&self) -> En32kR {
55        En32kR::new(((self.bits >> 3) & 1) != 0)
56    }
57    #[doc = "Bit 4 - 1kHz Output Enable"]
58    #[inline(always)]
59    pub fn en1k(&self) -> En1kR {
60        En1kR::new(((self.bits >> 4) & 1) != 0)
61    }
62    #[doc = "Bit 5 - Automatic Amplitude Control Enable"]
63    #[inline(always)]
64    pub fn aampen(&self) -> AampenR {
65        AampenR::new(((self.bits >> 5) & 1) != 0)
66    }
67    #[doc = "Bit 6 - Run in Standby"]
68    #[inline(always)]
69    pub fn runstdby(&self) -> RunstdbyR {
70        RunstdbyR::new(((self.bits >> 6) & 1) != 0)
71    }
72    #[doc = "Bit 7 - On Demand Control"]
73    #[inline(always)]
74    pub fn ondemand(&self) -> OndemandR {
75        OndemandR::new(((self.bits >> 7) & 1) != 0)
76    }
77    #[doc = "Bits 8:10 - Oscillator Start-Up Time"]
78    #[inline(always)]
79    pub fn startup(&self) -> StartupR {
80        StartupR::new(((self.bits >> 8) & 7) as u8)
81    }
82    #[doc = "Bit 12 - Write Lock"]
83    #[inline(always)]
84    pub fn wrtlock(&self) -> WrtlockR {
85        WrtlockR::new(((self.bits >> 12) & 1) != 0)
86    }
87}
88impl W {
89    #[doc = "Bit 1 - Oscillator Enable"]
90    #[inline(always)]
91    #[must_use]
92    pub fn enable(&mut self) -> EnableW<Xosc32kSpec> {
93        EnableW::new(self, 1)
94    }
95    #[doc = "Bit 2 - Crystal Oscillator Enable"]
96    #[inline(always)]
97    #[must_use]
98    pub fn xtalen(&mut self) -> XtalenW<Xosc32kSpec> {
99        XtalenW::new(self, 2)
100    }
101    #[doc = "Bit 3 - 32kHz Output Enable"]
102    #[inline(always)]
103    #[must_use]
104    pub fn en32k(&mut self) -> En32kW<Xosc32kSpec> {
105        En32kW::new(self, 3)
106    }
107    #[doc = "Bit 4 - 1kHz Output Enable"]
108    #[inline(always)]
109    #[must_use]
110    pub fn en1k(&mut self) -> En1kW<Xosc32kSpec> {
111        En1kW::new(self, 4)
112    }
113    #[doc = "Bit 5 - Automatic Amplitude Control Enable"]
114    #[inline(always)]
115    #[must_use]
116    pub fn aampen(&mut self) -> AampenW<Xosc32kSpec> {
117        AampenW::new(self, 5)
118    }
119    #[doc = "Bit 6 - Run in Standby"]
120    #[inline(always)]
121    #[must_use]
122    pub fn runstdby(&mut self) -> RunstdbyW<Xosc32kSpec> {
123        RunstdbyW::new(self, 6)
124    }
125    #[doc = "Bit 7 - On Demand Control"]
126    #[inline(always)]
127    #[must_use]
128    pub fn ondemand(&mut self) -> OndemandW<Xosc32kSpec> {
129        OndemandW::new(self, 7)
130    }
131    #[doc = "Bits 8:10 - Oscillator Start-Up Time"]
132    #[inline(always)]
133    #[must_use]
134    pub fn startup(&mut self) -> StartupW<Xosc32kSpec> {
135        StartupW::new(self, 8)
136    }
137    #[doc = "Bit 12 - Write Lock"]
138    #[inline(always)]
139    #[must_use]
140    pub fn wrtlock(&mut self) -> WrtlockW<Xosc32kSpec> {
141        WrtlockW::new(self, 12)
142    }
143}
144#[doc = "32kHz External Crystal Oscillator (XOSC32K) Control\n\nYou can [`read`](crate::Reg::read) this register and get [`xosc32k::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`xosc32k::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
145pub struct Xosc32kSpec;
146impl crate::RegisterSpec for Xosc32kSpec {
147    type Ux = u16;
148}
149#[doc = "`read()` method returns [`xosc32k::R`](R) reader structure"]
150impl crate::Readable for Xosc32kSpec {}
151#[doc = "`write(|w| ..)` method takes [`xosc32k::W`](W) writer structure"]
152impl crate::Writable for Xosc32kSpec {
153    type Safety = crate::Unsafe;
154    const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
155    const ONE_TO_MODIFY_FIELDS_BITMAP: u16 = 0;
156}
157#[doc = "`reset()` method sets XOSC32K to value 0x80"]
158impl crate::Resettable for Xosc32kSpec {
159    const RESET_VALUE: u16 = 0x80;
160}