From a3f20f858b2e63b9c714e966cb2c976e9313b7b8 Mon Sep 17 00:00:00 2001 From: Hugues Kamba Date: Fri, 4 Oct 2019 13:50:35 +0100 Subject: [PATCH] USBDevice: add documentation on USB suspend/resume to enter deep sleep It is possible to temporarily suspend USB and safely preserve its configuration. This is needed to allow a device to enter deep sleep as a USBDevice instance prevents deep sleep. USB operation can be suspended with `deinit` and restored with `connect`. --- drivers/internal/USBDevice.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/internal/USBDevice.h b/drivers/internal/USBDevice.h index 8d8fcf44d3..bc9902e1c8 100644 --- a/drivers/internal/USBDevice.h +++ b/drivers/internal/USBDevice.h @@ -97,6 +97,11 @@ public: * Power down this instance * * Disable interrupts and stop sending events. + * This method can be used for temporary power-saving; This call can allow + * USB to be temporarily disabled to permit power saving. + * However, it is up to the user to make sure all the + * transfers have concluded (for example when USB power is lost). + * USBDevice::connect can be used to resume USB operation. */ void deinit(); @@ -109,6 +114,8 @@ public: /** * Connect a device + * This method can also be used to resume USB operation when USB power is + * detected after it was suspended via USBDevice::deinit. */ void connect();