bl702_pac/usb/
usb_lpm_config.rs

1#[doc = "Register `usb_lpm_config` reader"]
2pub struct R(crate::R<USB_LPM_CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<USB_LPM_CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<USB_LPM_CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<USB_LPM_CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `usb_lpm_config` writer"]
17pub struct W(crate::W<USB_LPM_CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<USB_LPM_CONFIG_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<USB_LPM_CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<USB_LPM_CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `cr_lpm_en` reader - "]
38pub type CR_LPM_EN_R = crate::BitReader<bool>;
39#[doc = "Field `cr_lpm_en` writer - "]
40pub type CR_LPM_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, USB_LPM_CONFIG_SPEC, bool, O>;
41#[doc = "Field `cr_lpm_resp_upd` reader - "]
42pub type CR_LPM_RESP_UPD_R = crate::BitReader<bool>;
43#[doc = "Field `cr_lpm_resp_upd` writer - "]
44pub type CR_LPM_RESP_UPD_W<'a, const O: u8> =
45    crate::BitWriter<'a, u32, USB_LPM_CONFIG_SPEC, bool, O>;
46#[doc = "Field `cr_lpm_resp` reader - "]
47pub type CR_LPM_RESP_R = crate::FieldReader<u8, u8>;
48#[doc = "Field `cr_lpm_resp` writer - "]
49pub type CR_LPM_RESP_W<'a, const O: u8> =
50    crate::FieldWriter<'a, u32, USB_LPM_CONFIG_SPEC, u8, u8, 2, O>;
51#[doc = "Field `sts_lpm_attr` reader - "]
52pub type STS_LPM_ATTR_R = crate::FieldReader<u16, u16>;
53#[doc = "Field `sts_lpm_attr` writer - "]
54pub type STS_LPM_ATTR_W<'a, const O: u8> =
55    crate::FieldWriter<'a, u32, USB_LPM_CONFIG_SPEC, u16, u16, 11, O>;
56#[doc = "Field `sts_lpm` reader - "]
57pub type STS_LPM_R = crate::BitReader<bool>;
58#[doc = "Field `sts_lpm` writer - "]
59pub type STS_LPM_W<'a, const O: u8> = crate::BitWriter<'a, u32, USB_LPM_CONFIG_SPEC, bool, O>;
60impl R {
61    #[doc = "Bit 0"]
62    #[inline(always)]
63    pub fn cr_lpm_en(&self) -> CR_LPM_EN_R {
64        CR_LPM_EN_R::new((self.bits & 1) != 0)
65    }
66    #[doc = "Bit 1"]
67    #[inline(always)]
68    pub fn cr_lpm_resp_upd(&self) -> CR_LPM_RESP_UPD_R {
69        CR_LPM_RESP_UPD_R::new(((self.bits >> 1) & 1) != 0)
70    }
71    #[doc = "Bits 2:3"]
72    #[inline(always)]
73    pub fn cr_lpm_resp(&self) -> CR_LPM_RESP_R {
74        CR_LPM_RESP_R::new(((self.bits >> 2) & 3) as u8)
75    }
76    #[doc = "Bits 20:30"]
77    #[inline(always)]
78    pub fn sts_lpm_attr(&self) -> STS_LPM_ATTR_R {
79        STS_LPM_ATTR_R::new(((self.bits >> 20) & 0x07ff) as u16)
80    }
81    #[doc = "Bit 31"]
82    #[inline(always)]
83    pub fn sts_lpm(&self) -> STS_LPM_R {
84        STS_LPM_R::new(((self.bits >> 31) & 1) != 0)
85    }
86}
87impl W {
88    #[doc = "Bit 0"]
89    #[inline(always)]
90    #[must_use]
91    pub fn cr_lpm_en(&mut self) -> CR_LPM_EN_W<0> {
92        CR_LPM_EN_W::new(self)
93    }
94    #[doc = "Bit 1"]
95    #[inline(always)]
96    #[must_use]
97    pub fn cr_lpm_resp_upd(&mut self) -> CR_LPM_RESP_UPD_W<1> {
98        CR_LPM_RESP_UPD_W::new(self)
99    }
100    #[doc = "Bits 2:3"]
101    #[inline(always)]
102    #[must_use]
103    pub fn cr_lpm_resp(&mut self) -> CR_LPM_RESP_W<2> {
104        CR_LPM_RESP_W::new(self)
105    }
106    #[doc = "Bits 20:30"]
107    #[inline(always)]
108    #[must_use]
109    pub fn sts_lpm_attr(&mut self) -> STS_LPM_ATTR_W<20> {
110        STS_LPM_ATTR_W::new(self)
111    }
112    #[doc = "Bit 31"]
113    #[inline(always)]
114    #[must_use]
115    pub fn sts_lpm(&mut self) -> STS_LPM_W<31> {
116        STS_LPM_W::new(self)
117    }
118    #[doc = "Writes raw bits to the register."]
119    #[inline(always)]
120    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
121        self.0.bits(bits);
122        self
123    }
124}
125#[doc = "usb_lpm_config.\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 [usb_lpm_config](index.html) module"]
126pub struct USB_LPM_CONFIG_SPEC;
127impl crate::RegisterSpec for USB_LPM_CONFIG_SPEC {
128    type Ux = u32;
129}
130#[doc = "`read()` method returns [usb_lpm_config::R](R) reader structure"]
131impl crate::Readable for USB_LPM_CONFIG_SPEC {
132    type Reader = R;
133}
134#[doc = "`write(|w| ..)` method takes [usb_lpm_config::W](W) writer structure"]
135impl crate::Writable for USB_LPM_CONFIG_SPEC {
136    type Writer = W;
137    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
138    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
139}
140#[doc = "`reset()` method sets usb_lpm_config to value 0"]
141impl crate::Resettable for USB_LPM_CONFIG_SPEC {
142    const RESET_VALUE: Self::Ux = 0;
143}