xmc4300/sdmmc/
sw_reset.rs

1#[doc = "Register `SW_RESET` reader"]
2pub type R = crate::R<SW_RESET_SPEC>;
3#[doc = "Register `SW_RESET` writer"]
4pub type W = crate::W<SW_RESET_SPEC>;
5#[doc = "Field `SW_RST_ALL` reader - Software Reset for All"]
6pub type SW_RST_ALL_R = crate::BitReader;
7#[doc = "Field `SW_RST_ALL` writer - Software Reset for All"]
8pub type SW_RST_ALL_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Software Reset for CMD Line\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum SW_RST_CMD_LINE_A {
12    #[doc = "0: Work"]
13    VALUE1 = 0,
14    #[doc = "1: Reset"]
15    VALUE2 = 1,
16}
17impl From<SW_RST_CMD_LINE_A> for bool {
18    #[inline(always)]
19    fn from(variant: SW_RST_CMD_LINE_A) -> Self {
20        variant as u8 != 0
21    }
22}
23#[doc = "Field `SW_RST_CMD_LINE` reader - Software Reset for CMD Line"]
24pub type SW_RST_CMD_LINE_R = crate::BitReader<SW_RST_CMD_LINE_A>;
25impl SW_RST_CMD_LINE_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> SW_RST_CMD_LINE_A {
29        match self.bits {
30            false => SW_RST_CMD_LINE_A::VALUE1,
31            true => SW_RST_CMD_LINE_A::VALUE2,
32        }
33    }
34    #[doc = "Work"]
35    #[inline(always)]
36    pub fn is_value1(&self) -> bool {
37        *self == SW_RST_CMD_LINE_A::VALUE1
38    }
39    #[doc = "Reset"]
40    #[inline(always)]
41    pub fn is_value2(&self) -> bool {
42        *self == SW_RST_CMD_LINE_A::VALUE2
43    }
44}
45#[doc = "Field `SW_RST_CMD_LINE` writer - Software Reset for CMD Line"]
46pub type SW_RST_CMD_LINE_W<'a, REG> = crate::BitWriter<'a, REG, SW_RST_CMD_LINE_A>;
47impl<'a, REG> SW_RST_CMD_LINE_W<'a, REG>
48where
49    REG: crate::Writable + crate::RegisterSpec,
50{
51    #[doc = "Work"]
52    #[inline(always)]
53    pub fn value1(self) -> &'a mut crate::W<REG> {
54        self.variant(SW_RST_CMD_LINE_A::VALUE1)
55    }
56    #[doc = "Reset"]
57    #[inline(always)]
58    pub fn value2(self) -> &'a mut crate::W<REG> {
59        self.variant(SW_RST_CMD_LINE_A::VALUE2)
60    }
61}
62#[doc = "Software Reset for DAT Line\n\nValue on reset: 0"]
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64pub enum SW_RST_DAT_LINE_A {
65    #[doc = "0: Work"]
66    VALUE1 = 0,
67    #[doc = "1: Reset"]
68    VALUE2 = 1,
69}
70impl From<SW_RST_DAT_LINE_A> for bool {
71    #[inline(always)]
72    fn from(variant: SW_RST_DAT_LINE_A) -> Self {
73        variant as u8 != 0
74    }
75}
76#[doc = "Field `SW_RST_DAT_LINE` reader - Software Reset for DAT Line"]
77pub type SW_RST_DAT_LINE_R = crate::BitReader<SW_RST_DAT_LINE_A>;
78impl SW_RST_DAT_LINE_R {
79    #[doc = "Get enumerated values variant"]
80    #[inline(always)]
81    pub const fn variant(&self) -> SW_RST_DAT_LINE_A {
82        match self.bits {
83            false => SW_RST_DAT_LINE_A::VALUE1,
84            true => SW_RST_DAT_LINE_A::VALUE2,
85        }
86    }
87    #[doc = "Work"]
88    #[inline(always)]
89    pub fn is_value1(&self) -> bool {
90        *self == SW_RST_DAT_LINE_A::VALUE1
91    }
92    #[doc = "Reset"]
93    #[inline(always)]
94    pub fn is_value2(&self) -> bool {
95        *self == SW_RST_DAT_LINE_A::VALUE2
96    }
97}
98#[doc = "Field `SW_RST_DAT_LINE` writer - Software Reset for DAT Line"]
99pub type SW_RST_DAT_LINE_W<'a, REG> = crate::BitWriter<'a, REG, SW_RST_DAT_LINE_A>;
100impl<'a, REG> SW_RST_DAT_LINE_W<'a, REG>
101where
102    REG: crate::Writable + crate::RegisterSpec,
103{
104    #[doc = "Work"]
105    #[inline(always)]
106    pub fn value1(self) -> &'a mut crate::W<REG> {
107        self.variant(SW_RST_DAT_LINE_A::VALUE1)
108    }
109    #[doc = "Reset"]
110    #[inline(always)]
111    pub fn value2(self) -> &'a mut crate::W<REG> {
112        self.variant(SW_RST_DAT_LINE_A::VALUE2)
113    }
114}
115impl R {
116    #[doc = "Bit 0 - Software Reset for All"]
117    #[inline(always)]
118    pub fn sw_rst_all(&self) -> SW_RST_ALL_R {
119        SW_RST_ALL_R::new((self.bits & 1) != 0)
120    }
121    #[doc = "Bit 1 - Software Reset for CMD Line"]
122    #[inline(always)]
123    pub fn sw_rst_cmd_line(&self) -> SW_RST_CMD_LINE_R {
124        SW_RST_CMD_LINE_R::new(((self.bits >> 1) & 1) != 0)
125    }
126    #[doc = "Bit 2 - Software Reset for DAT Line"]
127    #[inline(always)]
128    pub fn sw_rst_dat_line(&self) -> SW_RST_DAT_LINE_R {
129        SW_RST_DAT_LINE_R::new(((self.bits >> 2) & 1) != 0)
130    }
131}
132impl W {
133    #[doc = "Bit 0 - Software Reset for All"]
134    #[inline(always)]
135    pub fn sw_rst_all(&mut self) -> SW_RST_ALL_W<SW_RESET_SPEC> {
136        SW_RST_ALL_W::new(self, 0)
137    }
138    #[doc = "Bit 1 - Software Reset for CMD Line"]
139    #[inline(always)]
140    pub fn sw_rst_cmd_line(&mut self) -> SW_RST_CMD_LINE_W<SW_RESET_SPEC> {
141        SW_RST_CMD_LINE_W::new(self, 1)
142    }
143    #[doc = "Bit 2 - Software Reset for DAT Line"]
144    #[inline(always)]
145    pub fn sw_rst_dat_line(&mut self) -> SW_RST_DAT_LINE_W<SW_RESET_SPEC> {
146        SW_RST_DAT_LINE_W::new(self, 2)
147    }
148}
149#[doc = "Software Reset Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sw_reset::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sw_reset::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
150pub struct SW_RESET_SPEC;
151impl crate::RegisterSpec for SW_RESET_SPEC {
152    type Ux = u8;
153}
154#[doc = "`read()` method returns [`sw_reset::R`](R) reader structure"]
155impl crate::Readable for SW_RESET_SPEC {}
156#[doc = "`write(|w| ..)` method takes [`sw_reset::W`](W) writer structure"]
157impl crate::Writable for SW_RESET_SPEC {
158    type Safety = crate::Unsafe;
159    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
160    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
161}
162#[doc = "`reset()` method sets SW_RESET to value 0"]
163impl crate::Resettable for SW_RESET_SPEC {
164    const RESET_VALUE: u8 = 0;
165}