atsaml22j/adc/
ctrla.rs

1#[doc = "Register `CTRLA` reader"]
2pub type R = crate::R<CtrlaSpec>;
3#[doc = "Register `CTRLA` writer"]
4pub type W = crate::W<CtrlaSpec>;
5#[doc = "Field `SWRST` reader - Software Reset"]
6pub type SwrstR = crate::BitReader;
7#[doc = "Field `SWRST` writer - Software Reset"]
8pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `ENABLE` reader - Enable"]
10pub type EnableR = crate::BitReader;
11#[doc = "Field `ENABLE` writer - Enable"]
12pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `RUNSTDBY` reader - Run During Standby"]
14pub type RunstdbyR = crate::BitReader;
15#[doc = "Field `RUNSTDBY` writer - Run During Standby"]
16pub type RunstdbyW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `ONDEMAND` reader - On Demand Control"]
18pub type OndemandR = crate::BitReader;
19#[doc = "Field `ONDEMAND` writer - On Demand Control"]
20pub type OndemandW<'a, REG> = crate::BitWriter<'a, REG>;
21impl R {
22    #[doc = "Bit 0 - Software Reset"]
23    #[inline(always)]
24    pub fn swrst(&self) -> SwrstR {
25        SwrstR::new((self.bits & 1) != 0)
26    }
27    #[doc = "Bit 1 - Enable"]
28    #[inline(always)]
29    pub fn enable(&self) -> EnableR {
30        EnableR::new(((self.bits >> 1) & 1) != 0)
31    }
32    #[doc = "Bit 6 - Run During Standby"]
33    #[inline(always)]
34    pub fn runstdby(&self) -> RunstdbyR {
35        RunstdbyR::new(((self.bits >> 6) & 1) != 0)
36    }
37    #[doc = "Bit 7 - On Demand Control"]
38    #[inline(always)]
39    pub fn ondemand(&self) -> OndemandR {
40        OndemandR::new(((self.bits >> 7) & 1) != 0)
41    }
42}
43impl W {
44    #[doc = "Bit 0 - Software Reset"]
45    #[inline(always)]
46    pub fn swrst(&mut self) -> SwrstW<CtrlaSpec> {
47        SwrstW::new(self, 0)
48    }
49    #[doc = "Bit 1 - Enable"]
50    #[inline(always)]
51    pub fn enable(&mut self) -> EnableW<CtrlaSpec> {
52        EnableW::new(self, 1)
53    }
54    #[doc = "Bit 6 - Run During Standby"]
55    #[inline(always)]
56    pub fn runstdby(&mut self) -> RunstdbyW<CtrlaSpec> {
57        RunstdbyW::new(self, 6)
58    }
59    #[doc = "Bit 7 - On Demand Control"]
60    #[inline(always)]
61    pub fn ondemand(&mut self) -> OndemandW<CtrlaSpec> {
62        OndemandW::new(self, 7)
63    }
64}
65#[doc = "Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrla::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrla::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
66pub struct CtrlaSpec;
67impl crate::RegisterSpec for CtrlaSpec {
68    type Ux = u8;
69}
70#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
71impl crate::Readable for CtrlaSpec {}
72#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
73impl crate::Writable for CtrlaSpec {
74    type Safety = crate::Unsafe;
75    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
76    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
77}
78#[doc = "`reset()` method sets CTRLA to value 0"]
79impl crate::Resettable for CtrlaSpec {
80    const RESET_VALUE: u8 = 0;
81}