Skip to content

Commit 2915dee

Browse files
author
Amanda Butler
authored
Merge pull request #1154 from ARMmbed/hk-add-usb-deepsleep-block-info
Add information on power saving options for USB components
2 parents 8e8d106 + bf213b9 commit 2915dee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/api/usb/usb_component.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ int main(void)
8787
The `connect()` and `disconnect()` functions control the state of the physical USB line to the host. When a device is connected, it is visible to the host PC to which it is attached. Once connected, the host PC must finish setup.
8888

8989
USB components provide at least one service. When a service is available for use, it is `ready`. For example, the USBSerial component enters the `ready` state after a serial port has been opened on the host PC. To determine whether a USB component's service is ready, you can use the `ready()` function. It returns `true` if the USB component is ready for use and `false` otherwise. Some components provide multiple services, such as USBAudio, which can send or receive data and has two separate ready functions - `read_ready()` and `write_ready()`. Furthermore, for each `ready()` function, there is also a corresponding `wait_ready()` function, which you can use to block until the USB component's service is available.
90+
91+
## USB component and power saving
92+
93+
Some instantiated USB components prevent devices from going to deep sleep because their `USBPhyHw` implentation holds a deep sleep lock. You can temporarily disable USB using `USBDevice::deinit()` to permit deep sleep. However, you must make sure all the data transfers have concluded to avoid any data corruption. The USB host controls the enumeration process, so it chooses when and how to restore the device. Even if the device state is returned to what it was before the disconnect, the host PC software may not be where it left off - for example, you may need to reopen a serial port.
94+
95+
You can use `USBDevice::connect()` to resume USB component operation when USB power is detected after it was previously suspended through `USBDevice::deinit()`.

0 commit comments

Comments
 (0)