From 1bb8f56c3b0107b35ecfa4feab66fac99865f747 Mon Sep 17 00:00:00 2001 From: Diego Ismirlian Date: Tue, 6 Jun 2017 09:24:10 -0300 Subject: HID class driver fixes --- os/hal/include/usbh/dev/hid.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'os/hal/include/usbh/dev/hid.h') diff --git a/os/hal/include/usbh/dev/hid.h b/os/hal/include/usbh/dev/hid.h index 62eda50..0d6b894 100644 --- a/os/hal/include/usbh/dev/hid.h +++ b/os/hal/include/usbh/dev/hid.h @@ -62,14 +62,21 @@ typedef enum { USBHHID_REPORTTYPE_FEATURE = 3, } usbhhid_reporttype_t; +typedef enum { + USBHHID_PROTOCOL_BOOT = 0, + USBHHID_PROTOCOL_REPORT = 1, +} usbhhid_protocol_t; + typedef struct USBHHIDDriver USBHHIDDriver; typedef struct USBHHIDConfig USBHHIDConfig; -typedef void (*usbhhid_report_callback)(USBHHIDDriver *hidp); +typedef void (*usbhhid_report_callback)(USBHHIDDriver *hidp, uint16_t len); struct USBHHIDConfig { usbhhid_report_callback cb_report; void *report_buffer; + uint16_t report_len; + usbhhid_protocol_t protocol; }; struct USBHHIDDriver { @@ -94,14 +101,13 @@ struct USBHHIDDriver { /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ -#define usbhhidGetState(hidp) ((hidp)->state) /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ -extern USBHHIDDriver USBHHID[HAL_USBHHID_MAX_INSTANCES]; +extern USBHHIDDriver USBHHIDD[HAL_USBHHID_MAX_INSTANCES]; #ifdef __cplusplus extern "C" { @@ -125,6 +131,12 @@ extern "C" { return hidp->type; } + static inline usbhhid_state_t usbhhidGetState(USBHHIDDriver *hidp) { + return hidp->state; + } + + void usbhhidStart(USBHHIDDriver *hidp, const USBHHIDConfig *cfg); + /* global initializer */ void usbhhidInit(void); #ifdef __cplusplus -- cgit v1.2.3