stm32h5_staging/common/usb/2d6f59ef/lpmcsr.rs
1///Register `LPMCSR` reader
2pub type R = crate::R<LPMCSRrs>;
3///Register `LPMCSR` writer
4pub type W = crate::W<LPMCSRrs>;
5///Field `LPMEN` reader - LPM support enable Device mode This bit is set by the software to enable the LPM support within the USB Device. If this bit is at 0 no LPM transactions are handled.
6pub type LPMEN_R = crate::BitReader;
7///Field `LPMEN` writer - LPM support enable Device mode This bit is set by the software to enable the LPM support within the USB Device. If this bit is at 0 no LPM transactions are handled.
8pub type LPMEN_W<'a, REG> = crate::BitWriter<'a, REG>;
9///Field `LPMACK` reader - LPM token acknowledge enable Device mode: The NYET/ACK is returned only on a successful LPM transaction: No errors in both the EXT token and the LPM token (else ERROR) A valid bLinkState = 0001B (L1) is received (else STALL)
10pub type LPMACK_R = crate::BitReader;
11///Field `LPMACK` writer - LPM token acknowledge enable Device mode: The NYET/ACK is returned only on a successful LPM transaction: No errors in both the EXT token and the LPM token (else ERROR) A valid bLinkState = 0001B (L1) is received (else STALL)
12pub type LPMACK_W<'a, REG> = crate::BitWriter<'a, REG>;
13///Field `REMWAKE` reader - bRemoteWake value Device mode This bit contains the bRemoteWake value received with last ACKed LPM Token
14pub type REMWAKE_R = crate::BitReader;
15///Field `BESL` reader - BESL value Device mode These bits contain the BESL value received with last ACKed LPM Token
16pub type BESL_R = crate::FieldReader;
17impl R {
18 ///Bit 0 - LPM support enable Device mode This bit is set by the software to enable the LPM support within the USB Device. If this bit is at 0 no LPM transactions are handled.
19 #[inline(always)]
20 pub fn lpmen(&self) -> LPMEN_R {
21 LPMEN_R::new((self.bits & 1) != 0)
22 }
23 ///Bit 1 - LPM token acknowledge enable Device mode: The NYET/ACK is returned only on a successful LPM transaction: No errors in both the EXT token and the LPM token (else ERROR) A valid bLinkState = 0001B (L1) is received (else STALL)
24 #[inline(always)]
25 pub fn lpmack(&self) -> LPMACK_R {
26 LPMACK_R::new(((self.bits >> 1) & 1) != 0)
27 }
28 ///Bit 3 - bRemoteWake value Device mode This bit contains the bRemoteWake value received with last ACKed LPM Token
29 #[inline(always)]
30 pub fn remwake(&self) -> REMWAKE_R {
31 REMWAKE_R::new(((self.bits >> 3) & 1) != 0)
32 }
33 ///Bits 4:7 - BESL value Device mode These bits contain the BESL value received with last ACKed LPM Token
34 #[inline(always)]
35 pub fn besl(&self) -> BESL_R {
36 BESL_R::new(((self.bits >> 4) & 0x0f) as u8)
37 }
38}
39impl core::fmt::Debug for R {
40 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
41 f.debug_struct("LPMCSR")
42 .field("lpmen", &self.lpmen())
43 .field("lpmack", &self.lpmack())
44 .field("remwake", &self.remwake())
45 .field("besl", &self.besl())
46 .finish()
47 }
48}
49impl W {
50 ///Bit 0 - LPM support enable Device mode This bit is set by the software to enable the LPM support within the USB Device. If this bit is at 0 no LPM transactions are handled.
51 #[inline(always)]
52 pub fn lpmen(&mut self) -> LPMEN_W<LPMCSRrs> {
53 LPMEN_W::new(self, 0)
54 }
55 ///Bit 1 - LPM token acknowledge enable Device mode: The NYET/ACK is returned only on a successful LPM transaction: No errors in both the EXT token and the LPM token (else ERROR) A valid bLinkState = 0001B (L1) is received (else STALL)
56 #[inline(always)]
57 pub fn lpmack(&mut self) -> LPMACK_W<LPMCSRrs> {
58 LPMACK_W::new(self, 1)
59 }
60}
61/**USB_LPMCSR
62
63You can [`read`](crate::Reg::read) this register and get [`lpmcsr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`lpmcsr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
64pub struct LPMCSRrs;
65impl crate::RegisterSpec for LPMCSRrs {
66 type Ux = u32;
67}
68///`read()` method returns [`lpmcsr::R`](R) reader structure
69impl crate::Readable for LPMCSRrs {}
70///`write(|w| ..)` method takes [`lpmcsr::W`](W) writer structure
71impl crate::Writable for LPMCSRrs {
72 type Safety = crate::Unsafe;
73 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
74 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
75}
76///`reset()` method sets LPMCSR to value 0
77impl crate::Resettable for LPMCSRrs {
78 const RESET_VALUE: u32 = 0;
79}