atsamd51n/sdhc0/
wcr.rs

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