atsamd51g/sdhc0/
bgcr_emmc_mode.rs
1#[doc = "Register `BGCR_EMMC_MODE` reader"]
2pub type R = crate::R<BgcrEmmcModeSpec>;
3#[doc = "Register `BGCR_EMMC_MODE` writer"]
4pub type W = crate::W<BgcrEmmcModeSpec>;
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}
111impl R {
112 #[doc = "Bit 0 - Stop at Block Gap Request"]
113 #[inline(always)]
114 pub fn stpbgr(&self) -> StpbgrR {
115 StpbgrR::new((self.bits & 1) != 0)
116 }
117 #[doc = "Bit 1 - Continue Request"]
118 #[inline(always)]
119 pub fn contr(&self) -> ContrR {
120 ContrR::new(((self.bits >> 1) & 1) != 0)
121 }
122}
123impl W {
124 #[doc = "Bit 0 - Stop at Block Gap Request"]
125 #[inline(always)]
126 #[must_use]
127 pub fn stpbgr(&mut self) -> StpbgrW<BgcrEmmcModeSpec> {
128 StpbgrW::new(self, 0)
129 }
130 #[doc = "Bit 1 - Continue Request"]
131 #[inline(always)]
132 #[must_use]
133 pub fn contr(&mut self) -> ContrW<BgcrEmmcModeSpec> {
134 ContrW::new(self, 1)
135 }
136}
137#[doc = "Block Gap Control\n\nYou can [`read`](crate::Reg::read) this register and get [`bgcr_emmc_mode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`bgcr_emmc_mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
138pub struct BgcrEmmcModeSpec;
139impl crate::RegisterSpec for BgcrEmmcModeSpec {
140 type Ux = u8;
141}
142#[doc = "`read()` method returns [`bgcr_emmc_mode::R`](R) reader structure"]
143impl crate::Readable for BgcrEmmcModeSpec {}
144#[doc = "`write(|w| ..)` method takes [`bgcr_emmc_mode::W`](W) writer structure"]
145impl crate::Writable for BgcrEmmcModeSpec {
146 type Safety = crate::Unsafe;
147 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
148 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
149}
150#[doc = "`reset()` method sets BGCR_EMMC_MODE to value 0"]
151impl crate::Resettable for BgcrEmmcModeSpec {
152 const RESET_VALUE: u8 = 0;
153}