From 8d8fdcb4bec5024503b636bcdbad244bef4e6576 Mon Sep 17 00:00:00 2001 From: Tony Abboud Date: Sun, 30 Aug 2015 17:20:38 -0400 Subject: 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. --- stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'stmhal/usbdev/class/src/usbd_cdc_msc_hid.c') 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; -- cgit v1.2.3