atsamd51n/sdhc0/
bgcr.rs

1#[doc = "Register `BGCR` reader"]
2pub type R = crate::R<BgcrSpec>;
3#[doc = "Register `BGCR` writer"]
4pub type W = crate::W<BgcrSpec>;
5#[doc = "Stop at Block Gap Request\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Stpbgrselect {
8    #[doc = "0: Transfer"]
9    Transfer = 0,
10    #[doc = "1: Stop"]
11    Stop = 1,
12}
13impl From<Stpbgrselect> for bool {
14    #[inline(always)]
15    fn from(variant: Stpbgrselect) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `STPBGR` reader - Stop at Block Gap Request"]
20pub type StpbgrR = crate::BitReader<Stpbgrselect>;
21impl StpbgrR {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> Stpbgrselect {
25        match self.bits {
26            false => Stpbgrselect::Transfer,
27            true => Stpbgrselect::Stop,
28        }
29    }
30    #[doc = "Transfer"]
31    #[inline(always)]
32    pub fn is_transfer(&self) -> bool {
33        *self == Stpbgrselect::Transfer
34    }
35    #[doc = "Stop"]
36    #[inline(always)]
37    pub fn is_stop(&self) -> bool {
38        *self == Stpbgrselect::Stop
39    }
40}
41#[doc = "Field `STPBGR` writer - Stop at Block Gap Request"]
42pub type StpbgrW<'a, REG> = crate::BitWriter<'a, REG, Stpbgrselect>;
43impl<'a, REG> StpbgrW<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Transfer"]
48    #[inline(always)]
49    pub fn transfer(self) -> &'a mut crate::W<REG> {
50        self.variant(Stpbgrselect::Transfer)
51    }
52    #[doc = "Stop"]
53    #[inline(always)]
54    pub fn stop(self) -> &'a mut crate::W<REG> {
55        self.variant(Stpbgrselect::Stop)
56    }
57}
58#[doc = "Continue Request\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum Contrselect {
61    #[doc = "0: Not affected"]
62    GoOn = 0,
63    #[doc = "1: Restart"]
64    Restart = 1,
65}
66impl From<Contrselect> for bool {
67    #[inline(always)]
68    fn from(variant: Contrselect) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `CONTR` reader - Continue Request"]
73pub type ContrR = crate::BitReader<Contrselect>;
74impl ContrR {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> Contrselect {
78        match self.bits {
79            false => Contrselect::GoOn,
80            true => Contrselect::Restart,
81        }
82    }
83    #[doc = "Not affected"]
84    #[inline(always)]
85    pub fn is_go_on(&self) -> bool {
86        *self == Contrselect::GoOn
87    }
88    #[doc = "Restart"]
89    #[inline(always)]
90    pub fn is_restart(&self) -> bool {
91        *self == Contrselect::Restart
92    }
93}
94#[doc = "Field `CONTR` writer - Continue Request"]
95pub type ContrW<'a, REG> = crate::BitWriter<'a, REG, Contrselect>;
96impl<'a, REG> ContrW<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Not affected"]
101    #[inline(always)]
102    pub fn go_on(self) -> &'a mut crate::W<REG> {
103        self.variant(Contrselect::GoOn)
104    }
105    #[doc = "Restart"]
106    #[inline(always)]
107    pub fn restart(self) -> &'a mut crate::W<REG> {
108        self.variant(Contrselect::Restart)
109    }
110}
111#[doc = "Read Wait Control\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum Rwctrlselect {
114    #[doc = "0: Disable Read Wait Control"]
115    Disable = 0,
116    #[doc = "1: Enable Read Wait Control"]
117    Enable = 1,
118}
119impl From<Rwctrlselect> for bool {
120    #[inline(always)]
121    fn from(variant: Rwctrlselect) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `RWCTRL` reader - Read Wait Control"]
126pub type RwctrlR = crate::BitReader<Rwctrlselect>;
127impl RwctrlR {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> Rwctrlselect {
131        match self.bits {
132            false => Rwctrlselect::Disable,
133            true => Rwctrlselect::Enable,
134        }
135    }
136    #[doc = "Disable Read Wait Control"]
137    #[inline(always)]
138    pub fn is_disable(&self) -> bool {
139        *self == Rwctrlselect::Disable
140    }
141    #[doc = "Enable Read Wait Control"]
142    #[inline(always)]
143    pub fn is_enable(&self) -> bool {
144        *self == Rwctrlselect::Enable
145    }
146}
147#[doc = "Field `RWCTRL` writer - Read Wait Control"]
148pub type RwctrlW<'a, REG> = crate::BitWriter<'a, REG, Rwctrlselect>;
149impl<'a, REG> RwctrlW<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Disable Read Wait Control"]
154    #[inline(always)]
155    pub fn disable(self) -> &'a mut crate::W<REG> {
156        self.variant(Rwctrlselect::Disable)
157    }
158    #[doc = "Enable Read Wait Control"]
159    #[inline(always)]
160    pub fn enable(self) -> &'a mut crate::W<REG> {
161        self.variant(Rwctrlselect::Enable)
162    }
163}
164#[doc = "Interrupt at Block Gap\n\nValue on reset: 0"]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum Intbgselect {
167    #[doc = "0: Disabled"]
168    Disabled = 0,
169    #[doc = "1: Enabled"]
170    Enabled = 1,
171}
172impl From<Intbgselect> for bool {
173    #[inline(always)]
174    fn from(variant: Intbgselect) -> Self {
175        variant as u8 != 0
176    }
177}
178#[doc = "Field `INTBG` reader - Interrupt at Block Gap"]
179pub type IntbgR = crate::BitReader<Intbgselect>;
180impl IntbgR {
181    #[doc = "Get enumerated values variant"]
182    #[inline(always)]
183    pub const fn variant(&self) -> Intbgselect {
184        match self.bits {
185            false => Intbgselect::Disabled,
186            true => Intbgselect::Enabled,
187        }
188    }
189    #[doc = "Disabled"]
190    #[inline(always)]
191    pub fn is_disabled(&self) -> bool {
192        *self == Intbgselect::Disabled
193    }
194    #[doc = "Enabled"]
195    #[inline(always)]
196    pub fn is_enabled(&self) -> bool {
197        *self == Intbgselect::Enabled
198    }
199}
200#[doc = "Field `INTBG` writer - Interrupt at Block Gap"]
201pub type IntbgW<'a, REG> = crate::BitWriter<'a, REG, Intbgselect>;
202impl<'a, REG> IntbgW<'a, REG>
203where
204    REG: crate::Writable + crate::RegisterSpec,
205{
206    #[doc = "Disabled"]
207    #[inline(always)]
208    pub fn disabled(self) -> &'a mut crate::W<REG> {
209        self.variant(Intbgselect::Disabled)
210    }
211    #[doc = "Enabled"]
212    #[inline(always)]
213    pub fn enabled(self) -> &'a mut crate::W<REG> {
214        self.variant(Intbgselect::Enabled)
215    }
216}
217impl R {
218    #[doc = "Bit 0 - Stop at Block Gap Request"]
219    #[inline(always)]
220    pub fn stpbgr(&self) -> StpbgrR {
221        StpbgrR::new((self.bits & 1) != 0)
222    }
223    #[doc = "Bit 1 - Continue Request"]
224    #[inline(always)]
225    pub fn contr(&self) -> ContrR {
226        ContrR::new(((self.bits >> 1) & 1) != 0)
227    }
228    #[doc = "Bit 2 - Read Wait Control"]
229    #[inline(always)]
230    pub fn rwctrl(&self) -> RwctrlR {
231        RwctrlR::new(((self.bits >> 2) & 1) != 0)
232    }
233    #[doc = "Bit 3 - Interrupt at Block Gap"]
234    #[inline(always)]
235    pub fn intbg(&self) -> IntbgR {
236        IntbgR::new(((self.bits >> 3) & 1) != 0)
237    }
238}
239impl W {
240    #[doc = "Bit 0 - Stop at Block Gap Request"]
241    #[inline(always)]
242    #[must_use]
243    pub fn stpbgr(&mut self) -> StpbgrW<BgcrSpec> {
244        StpbgrW::new(self, 0)
245    }
246    #[doc = "Bit 1 - Continue Request"]
247    #[inline(always)]
248    #[must_use]
249    pub fn contr(&mut self) -> ContrW<BgcrSpec> {
250        ContrW::new(self, 1)
251    }
252    #[doc = "Bit 2 - Read Wait Control"]
253    #[inline(always)]
254    #[must_use]
255    pub fn rwctrl(&mut self) -> RwctrlW<BgcrSpec> {
256        RwctrlW::new(self, 2)
257    }
258    #[doc = "Bit 3 - Interrupt at Block Gap"]
259    #[inline(always)]
260    #[must_use]
261    pub fn intbg(&mut self) -> IntbgW<BgcrSpec> {
262        IntbgW::new(self, 3)
263    }
264}
265#[doc = "Block Gap Control\n\nYou can [`read`](crate::Reg::read) this register and get [`bgcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bgcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
266pub struct BgcrSpec;
267impl crate::RegisterSpec for BgcrSpec {
268    type Ux = u8;
269}
270#[doc = "`read()` method returns [`bgcr::R`](R) reader structure"]
271impl crate::Readable for BgcrSpec {}
272#[doc = "`write(|w| ..)` method takes [`bgcr::W`](W) writer structure"]
273impl crate::Writable for BgcrSpec {
274    type Safety = crate::Unsafe;
275    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
276    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
277}
278#[doc = "`reset()` method sets BGCR to value 0"]
279impl crate::Resettable for BgcrSpec {
280    const RESET_VALUE: u8 = 0;
281}