atsamd51p/sdhc0/
mccar.rs

1#[doc = "Register `MCCAR` reader"]
2pub type R = crate::R<MccarSpec>;
3#[doc = "Maximum Current for 3.3V\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum Maxcur33vselect {
7    #[doc = "0: Get information via another method"]
8    Other = 0,
9    #[doc = "1: 4mA"]
10    _4ma = 1,
11    #[doc = "2: 8mA"]
12    _8ma = 2,
13    #[doc = "3: 12mA"]
14    _12ma = 3,
15}
16impl From<Maxcur33vselect> for u8 {
17    #[inline(always)]
18    fn from(variant: Maxcur33vselect) -> Self {
19        variant as _
20    }
21}
22impl crate::FieldSpec for Maxcur33vselect {
23    type Ux = u8;
24}
25impl crate::IsEnum for Maxcur33vselect {}
26#[doc = "Field `MAXCUR33V` reader - Maximum Current for 3.3V"]
27pub type Maxcur33vR = crate::FieldReader<Maxcur33vselect>;
28impl Maxcur33vR {
29    #[doc = "Get enumerated values variant"]
30    #[inline(always)]
31    pub const fn variant(&self) -> Option<Maxcur33vselect> {
32        match self.bits {
33            0 => Some(Maxcur33vselect::Other),
34            1 => Some(Maxcur33vselect::_4ma),
35            2 => Some(Maxcur33vselect::_8ma),
36            3 => Some(Maxcur33vselect::_12ma),
37            _ => None,
38        }
39    }
40    #[doc = "Get information via another method"]
41    #[inline(always)]
42    pub fn is_other(&self) -> bool {
43        *self == Maxcur33vselect::Other
44    }
45    #[doc = "4mA"]
46    #[inline(always)]
47    pub fn is_4ma(&self) -> bool {
48        *self == Maxcur33vselect::_4ma
49    }
50    #[doc = "8mA"]
51    #[inline(always)]
52    pub fn is_8ma(&self) -> bool {
53        *self == Maxcur33vselect::_8ma
54    }
55    #[doc = "12mA"]
56    #[inline(always)]
57    pub fn is_12ma(&self) -> bool {
58        *self == Maxcur33vselect::_12ma
59    }
60}
61#[doc = "Maximum Current for 3.0V\n\nValue on reset: 0"]
62#[derive(Clone, Copy, Debug, PartialEq, Eq)]
63#[repr(u8)]
64pub enum Maxcur30vselect {
65    #[doc = "0: Get information via another method"]
66    Other = 0,
67    #[doc = "1: 4mA"]
68    _4ma = 1,
69    #[doc = "2: 8mA"]
70    _8ma = 2,
71    #[doc = "3: 12mA"]
72    _12ma = 3,
73}
74impl From<Maxcur30vselect> for u8 {
75    #[inline(always)]
76    fn from(variant: Maxcur30vselect) -> Self {
77        variant as _
78    }
79}
80impl crate::FieldSpec for Maxcur30vselect {
81    type Ux = u8;
82}
83impl crate::IsEnum for Maxcur30vselect {}
84#[doc = "Field `MAXCUR30V` reader - Maximum Current for 3.0V"]
85pub type Maxcur30vR = crate::FieldReader<Maxcur30vselect>;
86impl Maxcur30vR {
87    #[doc = "Get enumerated values variant"]
88    #[inline(always)]
89    pub const fn variant(&self) -> Option<Maxcur30vselect> {
90        match self.bits {
91            0 => Some(Maxcur30vselect::Other),
92            1 => Some(Maxcur30vselect::_4ma),
93            2 => Some(Maxcur30vselect::_8ma),
94            3 => Some(Maxcur30vselect::_12ma),
95            _ => None,
96        }
97    }
98    #[doc = "Get information via another method"]
99    #[inline(always)]
100    pub fn is_other(&self) -> bool {
101        *self == Maxcur30vselect::Other
102    }
103    #[doc = "4mA"]
104    #[inline(always)]
105    pub fn is_4ma(&self) -> bool {
106        *self == Maxcur30vselect::_4ma
107    }
108    #[doc = "8mA"]
109    #[inline(always)]
110    pub fn is_8ma(&self) -> bool {
111        *self == Maxcur30vselect::_8ma
112    }
113    #[doc = "12mA"]
114    #[inline(always)]
115    pub fn is_12ma(&self) -> bool {
116        *self == Maxcur30vselect::_12ma
117    }
118}
119#[doc = "Maximum Current for 1.8V\n\nValue on reset: 0"]
120#[derive(Clone, Copy, Debug, PartialEq, Eq)]
121#[repr(u8)]
122pub enum Maxcur18vselect {
123    #[doc = "0: Get information via another method"]
124    Other = 0,
125    #[doc = "1: 4mA"]
126    _4ma = 1,
127    #[doc = "2: 8mA"]
128    _8ma = 2,
129    #[doc = "3: 12mA"]
130    _12ma = 3,
131}
132impl From<Maxcur18vselect> for u8 {
133    #[inline(always)]
134    fn from(variant: Maxcur18vselect) -> Self {
135        variant as _
136    }
137}
138impl crate::FieldSpec for Maxcur18vselect {
139    type Ux = u8;
140}
141impl crate::IsEnum for Maxcur18vselect {}
142#[doc = "Field `MAXCUR18V` reader - Maximum Current for 1.8V"]
143pub type Maxcur18vR = crate::FieldReader<Maxcur18vselect>;
144impl Maxcur18vR {
145    #[doc = "Get enumerated values variant"]
146    #[inline(always)]
147    pub const fn variant(&self) -> Option<Maxcur18vselect> {
148        match self.bits {
149            0 => Some(Maxcur18vselect::Other),
150            1 => Some(Maxcur18vselect::_4ma),
151            2 => Some(Maxcur18vselect::_8ma),
152            3 => Some(Maxcur18vselect::_12ma),
153            _ => None,
154        }
155    }
156    #[doc = "Get information via another method"]
157    #[inline(always)]
158    pub fn is_other(&self) -> bool {
159        *self == Maxcur18vselect::Other
160    }
161    #[doc = "4mA"]
162    #[inline(always)]
163    pub fn is_4ma(&self) -> bool {
164        *self == Maxcur18vselect::_4ma
165    }
166    #[doc = "8mA"]
167    #[inline(always)]
168    pub fn is_8ma(&self) -> bool {
169        *self == Maxcur18vselect::_8ma
170    }
171    #[doc = "12mA"]
172    #[inline(always)]
173    pub fn is_12ma(&self) -> bool {
174        *self == Maxcur18vselect::_12ma
175    }
176}
177impl R {
178    #[doc = "Bits 0:7 - Maximum Current for 3.3V"]
179    #[inline(always)]
180    pub fn maxcur33v(&self) -> Maxcur33vR {
181        Maxcur33vR::new((self.bits & 0xff) as u8)
182    }
183    #[doc = "Bits 8:15 - Maximum Current for 3.0V"]
184    #[inline(always)]
185    pub fn maxcur30v(&self) -> Maxcur30vR {
186        Maxcur30vR::new(((self.bits >> 8) & 0xff) as u8)
187    }
188    #[doc = "Bits 16:23 - Maximum Current for 1.8V"]
189    #[inline(always)]
190    pub fn maxcur18v(&self) -> Maxcur18vR {
191        Maxcur18vR::new(((self.bits >> 16) & 0xff) as u8)
192    }
193}
194#[doc = "Maximum Current Capabilities\n\nYou can [`read`](crate::Reg::read) this register and get [`mccar::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
195pub struct MccarSpec;
196impl crate::RegisterSpec for MccarSpec {
197    type Ux = u32;
198}
199#[doc = "`read()` method returns [`mccar::R`](R) reader structure"]
200impl crate::Readable for MccarSpec {}
201#[doc = "`reset()` method sets MCCAR to value 0"]
202impl crate::Resettable for MccarSpec {
203    const RESET_VALUE: u32 = 0;
204}