usb: Add API for getting status of remote wakeup
This change adds a posibility to check the status of remote wakeup feature. Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This commit is contained in:
parent
404f67ab5e
commit
75c0f52cca
3 changed files with 15 additions and 1 deletions
|
@ -36,6 +36,8 @@ Changes in this release
|
|||
|
||||
* Replaced custom LwM2M :c:struct:`float32_value` type with a native double type.
|
||||
|
||||
* Added function for getting status of USB device remote wakeup feature.
|
||||
|
||||
==========================
|
||||
|
||||
Removed APIs in this release
|
||||
|
|
|
@ -433,6 +433,13 @@ bool usb_transfer_is_busy(uint8_t ep);
|
|||
*/
|
||||
int usb_wakeup_request(void);
|
||||
|
||||
/**
|
||||
* @brief Get status of the USB remote wakeup feature
|
||||
*
|
||||
* @return true if remote wakeup has been enabled by the host, false otherwise.
|
||||
*/
|
||||
bool usb_get_remote_wakeup_status(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -1369,10 +1369,15 @@ int usb_ep_read_continue(uint8_t ep)
|
|||
return usb_dc_ep_read_continue(ep);
|
||||
}
|
||||
|
||||
bool usb_get_remote_wakeup_status(void)
|
||||
{
|
||||
return usb_dev.remote_wakeup;
|
||||
}
|
||||
|
||||
int usb_wakeup_request(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_USB_DEVICE_REMOTE_WAKEUP)) {
|
||||
if (usb_dev.remote_wakeup) {
|
||||
if (usb_get_remote_wakeup_status()) {
|
||||
return usb_dc_wakeup_request();
|
||||
}
|
||||
return -EACCES;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue