atsamd21g/dmac/
chctrla.rs

1#[doc = "Register `CHCTRLA` reader"]
2pub type R = crate::R<ChctrlaSpec>;
3#[doc = "Register `CHCTRLA` writer"]
4pub type W = crate::W<ChctrlaSpec>;
5#[doc = "Field `SWRST` reader - Channel Software Reset"]
6pub type SwrstR = crate::BitReader;
7#[doc = "Field `SWRST` writer - Channel Software Reset"]
8pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `ENABLE` reader - Channel Enable"]
10pub type EnableR = crate::BitReader;
11#[doc = "Field `ENABLE` writer - Channel Enable"]
12pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
13impl R {
14    #[doc = "Bit 0 - Channel Software Reset"]
15    #[inline(always)]
16    pub fn swrst(&self) -> SwrstR {
17        SwrstR::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bit 1 - Channel Enable"]
20    #[inline(always)]
21    pub fn enable(&self) -> EnableR {
22        EnableR::new(((self.bits >> 1) & 1) != 0)
23    }
24}
25impl W {
26    #[doc = "Bit 0 - Channel Software Reset"]
27    #[inline(always)]
28    #[must_use]
29    pub fn swrst(&mut self) -> SwrstW<ChctrlaSpec> {
30        SwrstW::new(self, 0)
31    }
32    #[doc = "Bit 1 - Channel Enable"]
33    #[inline(always)]
34    #[must_use]
35    pub fn enable(&mut self) -> EnableW<ChctrlaSpec> {
36        EnableW::new(self, 1)
37    }
38}
39#[doc = "Channel Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`chctrla::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`chctrla::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct ChctrlaSpec;
41impl crate::RegisterSpec for ChctrlaSpec {
42    type Ux = u8;
43}
44#[doc = "`read()` method returns [`chctrla::R`](R) reader structure"]
45impl crate::Readable for ChctrlaSpec {}
46#[doc = "`write(|w| ..)` method takes [`chctrla::W`](W) writer structure"]
47impl crate::Writable for ChctrlaSpec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
51}
52#[doc = "`reset()` method sets CHCTRLA to value 0"]
53impl crate::Resettable for ChctrlaSpec {
54    const RESET_VALUE: u8 = 0;
55}