atsamd51j/ccl/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub type R = crate::R<CtrlSpec>;
3#[doc = "Register `CTRL` writer"]
4pub type W = crate::W<CtrlSpec>;
5#[doc = "Software Reset\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Swrstselect {
8    #[doc = "0: The peripheral is not reset"]
9    Disable = 0,
10    #[doc = "1: The peripheral is reset"]
11    Enable = 1,
12}
13impl From<Swrstselect> for bool {
14    #[inline(always)]
15    fn from(variant: Swrstselect) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `SWRST` reader - Software Reset"]
20pub type SwrstR = crate::BitReader<Swrstselect>;
21impl SwrstR {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> Swrstselect {
25        match self.bits {
26            false => Swrstselect::Disable,
27            true => Swrstselect::Enable,
28        }
29    }
30    #[doc = "The peripheral is not reset"]
31    #[inline(always)]
32    pub fn is_disable(&self) -> bool {
33        *self == Swrstselect::Disable
34    }
35    #[doc = "The peripheral is reset"]
36    #[inline(always)]
37    pub fn is_enable(&self) -> bool {
38        *self == Swrstselect::Enable
39    }
40}
41#[doc = "Field `SWRST` writer - Software Reset"]
42pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG, Swrstselect>;
43impl<'a, REG> SwrstW<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "The peripheral is not reset"]
48    #[inline(always)]
49    pub fn disable(self) -> &'a mut crate::W<REG> {
50        self.variant(Swrstselect::Disable)
51    }
52    #[doc = "The peripheral is reset"]
53    #[inline(always)]
54    pub fn enable(self) -> &'a mut crate::W<REG> {
55        self.variant(Swrstselect::Enable)
56    }
57}
58#[doc = "Enable\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum Enableselect {
61    #[doc = "0: The peripheral is disabled"]
62    Disable = 0,
63    #[doc = "1: The peripheral is enabled"]
64    Enable = 1,
65}
66impl From<Enableselect> for bool {
67    #[inline(always)]
68    fn from(variant: Enableselect) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `ENABLE` reader - Enable"]
73pub type EnableR = crate::BitReader<Enableselect>;
74impl EnableR {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> Enableselect {
78        match self.bits {
79            false => Enableselect::Disable,
80            true => Enableselect::Enable,
81        }
82    }
83    #[doc = "The peripheral is disabled"]
84    #[inline(always)]
85    pub fn is_disable(&self) -> bool {
86        *self == Enableselect::Disable
87    }
88    #[doc = "The peripheral is enabled"]
89    #[inline(always)]
90    pub fn is_enable(&self) -> bool {
91        *self == Enableselect::Enable
92    }
93}
94#[doc = "Field `ENABLE` writer - Enable"]
95pub type EnableW<'a, REG> = crate::BitWriter<'a, REG, Enableselect>;
96impl<'a, REG> EnableW<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "The peripheral is disabled"]
101    #[inline(always)]
102    pub fn disable(self) -> &'a mut crate::W<REG> {
103        self.variant(Enableselect::Disable)
104    }
105    #[doc = "The peripheral is enabled"]
106    #[inline(always)]
107    pub fn enable(self) -> &'a mut crate::W<REG> {
108        self.variant(Enableselect::Enable)
109    }
110}
111#[doc = "Run in Standby\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum Runstdbyselect {
114    #[doc = "0: Generic clock is not required in standby sleep mode"]
115    Disable = 0,
116    #[doc = "1: Generic clock is required in standby sleep mode"]
117    Enable = 1,
118}
119impl From<Runstdbyselect> for bool {
120    #[inline(always)]
121    fn from(variant: Runstdbyselect) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `RUNSTDBY` reader - Run in Standby"]
126pub type RunstdbyR = crate::BitReader<Runstdbyselect>;
127impl RunstdbyR {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> Runstdbyselect {
131        match self.bits {
132            false => Runstdbyselect::Disable,
133            true => Runstdbyselect::Enable,
134        }
135    }
136    #[doc = "Generic clock is not required in standby sleep mode"]
137    #[inline(always)]
138    pub fn is_disable(&self) -> bool {
139        *self == Runstdbyselect::Disable
140    }
141    #[doc = "Generic clock is required in standby sleep mode"]
142    #[inline(always)]
143    pub fn is_enable(&self) -> bool {
144        *self == Runstdbyselect::Enable
145    }
146}
147#[doc = "Field `RUNSTDBY` writer - Run in Standby"]
148pub type RunstdbyW<'a, REG> = crate::BitWriter<'a, REG, Runstdbyselect>;
149impl<'a, REG> RunstdbyW<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Generic clock is not required in standby sleep mode"]
154    #[inline(always)]
155    pub fn disable(self) -> &'a mut crate::W<REG> {
156        self.variant(Runstdbyselect::Disable)
157    }
158    #[doc = "Generic clock is required in standby sleep mode"]
159    #[inline(always)]
160    pub fn enable(self) -> &'a mut crate::W<REG> {
161        self.variant(Runstdbyselect::Enable)
162    }
163}
164impl R {
165    #[doc = "Bit 0 - Software Reset"]
166    #[inline(always)]
167    pub fn swrst(&self) -> SwrstR {
168        SwrstR::new((self.bits & 1) != 0)
169    }
170    #[doc = "Bit 1 - Enable"]
171    #[inline(always)]
172    pub fn enable(&self) -> EnableR {
173        EnableR::new(((self.bits >> 1) & 1) != 0)
174    }
175    #[doc = "Bit 6 - Run in Standby"]
176    #[inline(always)]
177    pub fn runstdby(&self) -> RunstdbyR {
178        RunstdbyR::new(((self.bits >> 6) & 1) != 0)
179    }
180}
181impl W {
182    #[doc = "Bit 0 - Software Reset"]
183    #[inline(always)]
184    #[must_use]
185    pub fn swrst(&mut self) -> SwrstW<CtrlSpec> {
186        SwrstW::new(self, 0)
187    }
188    #[doc = "Bit 1 - Enable"]
189    #[inline(always)]
190    #[must_use]
191    pub fn enable(&mut self) -> EnableW<CtrlSpec> {
192        EnableW::new(self, 1)
193    }
194    #[doc = "Bit 6 - Run in Standby"]
195    #[inline(always)]
196    #[must_use]
197    pub fn runstdby(&mut self) -> RunstdbyW<CtrlSpec> {
198        RunstdbyW::new(self, 6)
199    }
200}
201#[doc = "Control\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
202pub struct CtrlSpec;
203impl crate::RegisterSpec for CtrlSpec {
204    type Ux = u8;
205}
206#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"]
207impl crate::Readable for CtrlSpec {}
208#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"]
209impl crate::Writable for CtrlSpec {
210    type Safety = crate::Unsafe;
211    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
212    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
213}
214#[doc = "`reset()` method sets CTRL to value 0"]
215impl crate::Resettable for CtrlSpec {
216    const RESET_VALUE: u8 = 0;
217}