ra6e1/usbfs/
syscfg.rs

1#[doc = "Register `SYSCFG` reader"]
2pub struct R(crate::R<SYSCFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SYSCFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SYSCFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SYSCFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SYSCFG` writer"]
17pub struct W(crate::W<SYSCFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SYSCFG_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<SYSCFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SYSCFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `USBE` reader - USBFS Operation Enable"]
38pub type USBE_R = crate::BitReader<USBE_A>;
39#[doc = "USBFS Operation Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum USBE_A {
42    #[doc = "0: Disable"]
43    _0 = 0,
44    #[doc = "1: Enable"]
45    _1 = 1,
46}
47impl From<USBE_A> for bool {
48    #[inline(always)]
49    fn from(variant: USBE_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl USBE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> USBE_A {
57        match self.bits {
58            false => USBE_A::_0,
59            true => USBE_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == USBE_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == USBE_A::_1
71    }
72}
73#[doc = "Field `USBE` writer - USBFS Operation Enable"]
74pub type USBE_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSCFG_SPEC, USBE_A, O>;
75impl<'a, const O: u8> USBE_W<'a, O> {
76    #[doc = "Disable"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(USBE_A::_0)
80    }
81    #[doc = "Enable"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(USBE_A::_1)
85    }
86}
87#[doc = "Field `DPRPU` reader - D+ Line Resistor Control"]
88pub type DPRPU_R = crate::BitReader<DPRPU_A>;
89#[doc = "D+ Line Resistor Control\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum DPRPU_A {
92    #[doc = "0: Disable line pull-up"]
93    _0 = 0,
94    #[doc = "1: Enable line pull-up"]
95    _1 = 1,
96}
97impl From<DPRPU_A> for bool {
98    #[inline(always)]
99    fn from(variant: DPRPU_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl DPRPU_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> DPRPU_A {
107        match self.bits {
108            false => DPRPU_A::_0,
109            true => DPRPU_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == DPRPU_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == DPRPU_A::_1
121    }
122}
123#[doc = "Field `DPRPU` writer - D+ Line Resistor Control"]
124pub type DPRPU_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSCFG_SPEC, DPRPU_A, O>;
125impl<'a, const O: u8> DPRPU_W<'a, O> {
126    #[doc = "Disable line pull-up"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(DPRPU_A::_0)
130    }
131    #[doc = "Enable line pull-up"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(DPRPU_A::_1)
135    }
136}
137#[doc = "Field `DRPD` reader - D+/D– Line Resistor Control"]
138pub type DRPD_R = crate::BitReader<DRPD_A>;
139#[doc = "D+/D– Line Resistor Control\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum DRPD_A {
142    #[doc = "0: Disable line pull-down"]
143    _0 = 0,
144    #[doc = "1: Enable line pull-down"]
145    _1 = 1,
146}
147impl From<DRPD_A> for bool {
148    #[inline(always)]
149    fn from(variant: DRPD_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl DRPD_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> DRPD_A {
157        match self.bits {
158            false => DRPD_A::_0,
159            true => DRPD_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == DRPD_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == DRPD_A::_1
171    }
172}
173#[doc = "Field `DRPD` writer - D+/D– Line Resistor Control"]
174pub type DRPD_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSCFG_SPEC, DRPD_A, O>;
175impl<'a, const O: u8> DRPD_W<'a, O> {
176    #[doc = "Disable line pull-down"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(DRPD_A::_0)
180    }
181    #[doc = "Enable line pull-down"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(DRPD_A::_1)
185    }
186}
187#[doc = "Field `DCFM` reader - Controller Function Select"]
188pub type DCFM_R = crate::BitReader<DCFM_A>;
189#[doc = "Controller Function Select\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum DCFM_A {
192    #[doc = "0: Select device controller"]
193    _0 = 0,
194    #[doc = "1: Select host controller"]
195    _1 = 1,
196}
197impl From<DCFM_A> for bool {
198    #[inline(always)]
199    fn from(variant: DCFM_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl DCFM_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> DCFM_A {
207        match self.bits {
208            false => DCFM_A::_0,
209            true => DCFM_A::_1,
210        }
211    }
212    #[doc = "Checks if the value of the field is `_0`"]
213    #[inline(always)]
214    pub fn is_0(&self) -> bool {
215        *self == DCFM_A::_0
216    }
217    #[doc = "Checks if the value of the field is `_1`"]
218    #[inline(always)]
219    pub fn is_1(&self) -> bool {
220        *self == DCFM_A::_1
221    }
222}
223#[doc = "Field `DCFM` writer - Controller Function Select"]
224pub type DCFM_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSCFG_SPEC, DCFM_A, O>;
225impl<'a, const O: u8> DCFM_W<'a, O> {
226    #[doc = "Select device controller"]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(DCFM_A::_0)
230    }
231    #[doc = "Select host controller"]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(DCFM_A::_1)
235    }
236}
237#[doc = "Field `SCKE` reader - USB Clock Enable"]
238pub type SCKE_R = crate::BitReader<SCKE_A>;
239#[doc = "USB Clock Enable\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum SCKE_A {
242    #[doc = "0: Stop clock supply to the USBFS"]
243    _0 = 0,
244    #[doc = "1: Enable clock supply to the USBFS"]
245    _1 = 1,
246}
247impl From<SCKE_A> for bool {
248    #[inline(always)]
249    fn from(variant: SCKE_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl SCKE_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> SCKE_A {
257        match self.bits {
258            false => SCKE_A::_0,
259            true => SCKE_A::_1,
260        }
261    }
262    #[doc = "Checks if the value of the field is `_0`"]
263    #[inline(always)]
264    pub fn is_0(&self) -> bool {
265        *self == SCKE_A::_0
266    }
267    #[doc = "Checks if the value of the field is `_1`"]
268    #[inline(always)]
269    pub fn is_1(&self) -> bool {
270        *self == SCKE_A::_1
271    }
272}
273#[doc = "Field `SCKE` writer - USB Clock Enable"]
274pub type SCKE_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSCFG_SPEC, SCKE_A, O>;
275impl<'a, const O: u8> SCKE_W<'a, O> {
276    #[doc = "Stop clock supply to the USBFS"]
277    #[inline(always)]
278    pub fn _0(self) -> &'a mut W {
279        self.variant(SCKE_A::_0)
280    }
281    #[doc = "Enable clock supply to the USBFS"]
282    #[inline(always)]
283    pub fn _1(self) -> &'a mut W {
284        self.variant(SCKE_A::_1)
285    }
286}
287impl R {
288    #[doc = "Bit 0 - USBFS Operation Enable"]
289    #[inline(always)]
290    pub fn usbe(&self) -> USBE_R {
291        USBE_R::new((self.bits & 1) != 0)
292    }
293    #[doc = "Bit 4 - D+ Line Resistor Control"]
294    #[inline(always)]
295    pub fn dprpu(&self) -> DPRPU_R {
296        DPRPU_R::new(((self.bits >> 4) & 1) != 0)
297    }
298    #[doc = "Bit 5 - D+/D– Line Resistor Control"]
299    #[inline(always)]
300    pub fn drpd(&self) -> DRPD_R {
301        DRPD_R::new(((self.bits >> 5) & 1) != 0)
302    }
303    #[doc = "Bit 6 - Controller Function Select"]
304    #[inline(always)]
305    pub fn dcfm(&self) -> DCFM_R {
306        DCFM_R::new(((self.bits >> 6) & 1) != 0)
307    }
308    #[doc = "Bit 10 - USB Clock Enable"]
309    #[inline(always)]
310    pub fn scke(&self) -> SCKE_R {
311        SCKE_R::new(((self.bits >> 10) & 1) != 0)
312    }
313}
314impl W {
315    #[doc = "Bit 0 - USBFS Operation Enable"]
316    #[inline(always)]
317    #[must_use]
318    pub fn usbe(&mut self) -> USBE_W<0> {
319        USBE_W::new(self)
320    }
321    #[doc = "Bit 4 - D+ Line Resistor Control"]
322    #[inline(always)]
323    #[must_use]
324    pub fn dprpu(&mut self) -> DPRPU_W<4> {
325        DPRPU_W::new(self)
326    }
327    #[doc = "Bit 5 - D+/D– Line Resistor Control"]
328    #[inline(always)]
329    #[must_use]
330    pub fn drpd(&mut self) -> DRPD_W<5> {
331        DRPD_W::new(self)
332    }
333    #[doc = "Bit 6 - Controller Function Select"]
334    #[inline(always)]
335    #[must_use]
336    pub fn dcfm(&mut self) -> DCFM_W<6> {
337        DCFM_W::new(self)
338    }
339    #[doc = "Bit 10 - USB Clock Enable"]
340    #[inline(always)]
341    #[must_use]
342    pub fn scke(&mut self) -> SCKE_W<10> {
343        SCKE_W::new(self)
344    }
345    #[doc = "Writes raw bits to the register."]
346    #[inline(always)]
347    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
348        self.0.bits(bits);
349        self
350    }
351}
352#[doc = "System Configuration Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [syscfg](index.html) module"]
353pub struct SYSCFG_SPEC;
354impl crate::RegisterSpec for SYSCFG_SPEC {
355    type Ux = u16;
356}
357#[doc = "`read()` method returns [syscfg::R](R) reader structure"]
358impl crate::Readable for SYSCFG_SPEC {
359    type Reader = R;
360}
361#[doc = "`write(|w| ..)` method takes [syscfg::W](W) writer structure"]
362impl crate::Writable for SYSCFG_SPEC {
363    type Writer = W;
364    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
365    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
366}
367#[doc = "`reset()` method sets SYSCFG to value 0"]
368impl crate::Resettable for SYSCFG_SPEC {
369    const RESET_VALUE: Self::Ux = 0;
370}