aboutsummaryrefslogtreecommitdiff
path: root/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
diff options
context:
space:
mode:
authorDamien George2014-11-01 21:26:06 +0000
committerDamien George2015-02-13 14:02:51 +0000
commitd39c7aa517b722161a7dd792fafc5096d58beec8 (patch)
treef7287fe0f4b6790a3538e31b0a5a06b8939fd64f /stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
parentb384bcc5de2c20d1d985e2768729578373bd73c1 (diff)
stmhal: Add Python-configurable USB HID mode.
Different HID modes can be configured in Python. You can either use predefined mouse or keyboard, or write your own report descriptor.
Diffstat (limited to 'stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h')
-rw-r--r--stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
index 48d260bc2..bc1e33eca 100644
--- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
+++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
@@ -1,6 +1,7 @@
#ifndef _USB_CDC_MSC_CORE_H_
#define _USB_CDC_MSC_CORE_H_
+#include "usbd_cdc_msc_hid0.h"
#include "usbd_msc_bot.h"
#include "usbd_msc_scsi.h"
#include "usbd_ioreq.h"
@@ -18,14 +19,6 @@
#define CDC_OUT_EP (0x03)
#define CDC_CMD_EP (0x82)
-// only CDC_MSC and CDC_HID are available
-#define USBD_MODE_CDC (0x01)
-#define USBD_MODE_MSC (0x02)
-#define USBD_MODE_HID (0x04)
-#define USBD_MODE_CDC_MSC (USBD_MODE_CDC | USBD_MODE_MSC)
-#define USBD_MODE_CDC_HID (USBD_MODE_CDC | USBD_MODE_HID)
-#define USBD_MODE_MSC_HID (USBD_MODE_MSC | USBD_MODE_HID)
-
typedef struct {
uint32_t bitrate;
uint8_t format;
@@ -87,9 +80,19 @@ typedef struct {
uint32_t scsi_blk_len;
} USBD_MSC_BOT_HandleTypeDef;
+#define USBD_HID_MOUSE_MAX_PACKET (4)
+#define USBD_HID_MOUSE_REPORT_DESC_SIZE (74)
+
+extern const uint8_t USBD_HID_MOUSE_ReportDesc[USBD_HID_MOUSE_REPORT_DESC_SIZE];
+
+#define USBD_HID_KEYBOARD_MAX_PACKET (8)
+#define USBD_HID_KEYBOARD_REPORT_DESC_SIZE (63)
+
+extern const uint8_t USBD_HID_KEYBOARD_ReportDesc[USBD_HID_KEYBOARD_REPORT_DESC_SIZE];
+
extern USBD_ClassTypeDef USBD_CDC_MSC_HID;
-void USBD_SelectMode(uint32_t mode);
+void USBD_SelectMode(uint32_t mode, USBD_HID_ModeInfoTypeDef *hid_info);
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);
@@ -99,6 +102,7 @@ uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
uint8_t USBD_MSC_RegisterStorage(USBD_HandleTypeDef *pdev, USBD_StorageTypeDef *fops);
+int USBD_HID_CanSendReport(USBD_HandleTypeDef *pdev);
uint8_t USBD_HID_SendReport(USBD_HandleTypeDef *pdev, uint8_t *report, uint16_t len);
#endif // _USB_CDC_MSC_CORE_H_