File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,23 @@ impl<USB: UsbPeripheral> UsbBus<USB> {
9292 }
9393 } )
9494 }
95+
96+ /// Set/clear remote wakeup bit
97+ ///
98+ /// Allows to modify CNTR.RESUME bit from device to perform remote wake up from suspend
99+ /// (e.g. on keyboard/mouse input). To perform remote wake up: when a condition is met
100+ /// during suspend mode, use this method with `true` to set the RESUME bit. Then, after
101+ /// waiting between 1-15 ms (see reference manual) call it again with `false` to clear
102+ /// the bit.
103+ ///
104+ /// This method will not set the bit if device is not suspended because performing remote
105+ /// wake up in other mode is invalid and host will most likely disable such a device.
106+ pub fn remote_wakeup ( & self , resume : bool ) {
107+ interrupt:: free ( |cs| {
108+ self . regs . borrow ( cs)
109+ . cntr . modify ( |r, w| w. resume ( ) . bit ( resume && r. fsusp ( ) . is_suspend ( ) ) ) ;
110+ } )
111+ }
95112}
96113
97114impl < USB : UsbPeripheral > usb_device:: bus:: UsbBus for UsbBus < USB > {
You can’t perform that action at this time.
0 commit comments