diff options
| author | Tony Abboud | 2015-08-30 17:20:38 -0400 |
|---|---|---|
| committer | Damien George | 2015-09-03 23:30:43 +0100 |
| commit | 8d8fdcb4bec5024503b636bcdbad244bef4e6576 (patch) | |
| tree | 21dcf9e6e35ec71543abd30c39c2b5368ef1b11c /stmhal/usbdev | |
| parent | 821b7f22fec342cf0b1b61d959e6c07b9543c696 (diff) | |
stmhal: add option to query for the current usb mode
Fetch the current usb mode and return a string representation when
pyb.usb_mode() is called with no args. The possible string values are interned
as qstr's. None will be returned if an incorrect mode is set.
Diffstat (limited to 'stmhal/usbdev')
| -rw-r--r-- | stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h | 2 | ||||
| -rw-r--r-- | stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h index 52d845b24..248ce17f3 100644 --- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h +++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h @@ -94,6 +94,8 @@ extern USBD_ClassTypeDef USBD_CDC_MSC_HID; // returns 0 on success, -1 on failure int USBD_SelectMode(uint32_t mode, USBD_HID_ModeInfoTypeDef *hid_info); +// returns the current usb mode +uint8_t USBD_GetMode(); uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev, USBD_CDC_ItfTypeDef *fops); uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint16_t length); diff --git a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c index bbb666861..d50934ada 100644 --- a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c +++ b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c @@ -559,6 +559,11 @@ __ALIGN_BEGIN const uint8_t USBD_HID_KEYBOARD_ReportDesc[USBD_HID_KEYBOARD_REPOR 0xC0 // End Collection }; +// return the saved usb mode +uint8_t USBD_GetMode() { + return usbd_mode; +} + int USBD_SelectMode(uint32_t mode, USBD_HID_ModeInfoTypeDef *hid_info) { // save mode usbd_mode = mode; |
