atsamd21g/ac/
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` writer - Software Reset"]
6pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG>;
7#[doc = "Field `ENABLE` reader - Enable"]
8pub type EnableR = crate::BitReader;
9#[doc = "Field `ENABLE` writer - Enable"]
10pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `RUNSTDBY` reader - Run in Standby"]
12pub type RunstdbyR = crate::BitReader;
13#[doc = "Field `RUNSTDBY` writer - Run in Standby"]
14pub type RunstdbyW<'a, REG> = crate::BitWriter<'a, REG>;
15#[doc = "Field `LPMUX` reader - Low-Power Mux"]
16pub type LpmuxR = crate::BitReader;
17#[doc = "Field `LPMUX` writer - Low-Power Mux"]
18pub type LpmuxW<'a, REG> = crate::BitWriter<'a, REG>;
19impl R {
20    #[doc = "Bit 1 - Enable"]
21    #[inline(always)]
22    pub fn enable(&self) -> EnableR {
23        EnableR::new(((self.bits >> 1) & 1) != 0)
24    }
25    #[doc = "Bit 2 - Run in Standby"]
26    #[inline(always)]
27    pub fn runstdby(&self) -> RunstdbyR {
28        RunstdbyR::new(((self.bits >> 2) & 1) != 0)
29    }
30    #[doc = "Bit 7 - Low-Power Mux"]
31    #[inline(always)]
32    pub fn lpmux(&self) -> LpmuxR {
33        LpmuxR::new(((self.bits >> 7) & 1) != 0)
34    }
35}
36impl W {
37    #[doc = "Bit 0 - Software Reset"]
38    #[inline(always)]
39    #[must_use]
40    pub fn swrst(&mut self) -> SwrstW<CtrlaSpec> {
41        SwrstW::new(self, 0)
42    }
43    #[doc = "Bit 1 - Enable"]
44    #[inline(always)]
45    #[must_use]
46    pub fn enable(&mut self) -> EnableW<CtrlaSpec> {
47        EnableW::new(self, 1)
48    }
49    #[doc = "Bit 2 - Run in Standby"]
50    #[inline(always)]
51    #[must_use]
52    pub fn runstdby(&mut self) -> RunstdbyW<CtrlaSpec> {
53        RunstdbyW::new(self, 2)
54    }
55    #[doc = "Bit 7 - Low-Power Mux"]
56    #[inline(always)]
57    #[must_use]
58    pub fn lpmux(&mut self) -> LpmuxW<CtrlaSpec> {
59        LpmuxW::new(self, 7)
60    }
61}
62#[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)."]
63pub struct CtrlaSpec;
64impl crate::RegisterSpec for CtrlaSpec {
65    type Ux = u8;
66}
67#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
68impl crate::Readable for CtrlaSpec {}
69#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
70impl crate::Writable for CtrlaSpec {
71    type Safety = crate::Unsafe;
72    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
73    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
74}
75#[doc = "`reset()` method sets CTRLA to value 0"]
76impl crate::Resettable for CtrlaSpec {
77    const RESET_VALUE: u8 = 0;
78}