diff options
| author | hathach <[email protected]> | 2012-11-29 16:32:49 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-11-29 16:32:49 +0700 |
| commit | b8b92e120220ee19f623809673323344e257bd4b (patch) | |
| tree | 6f3248e5da2d684d41be5f27e84e8beb6f023382 /tinyusb/class | |
| parent | 8f57cb6ccb65c0519d78661cb36be12e6079f965 (diff) | |
hid mouse working
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/hid.c | 17 | ||||
| -rw-r--r-- | tinyusb/class/hid.h | 19 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tinyusb/class/hid.c b/tinyusb/class/hid.c index 84a5799e0..7175fb55f 100644 --- a/tinyusb/class/hid.c +++ b/tinyusb/class/hid.c @@ -36,7 +36,6 @@ */ #include "hid.h" -//#include "../systick/systick.h" #ifdef CLASS_HID @@ -45,7 +44,7 @@ USB_HID_KeyboardReport_t hid_keyboard_report; volatile static bool bKeyChanged = false; #endif -#ifdef CFG_USB_HID_MOUSE +#ifdef CFG_CLASS_HID_MOUSE USB_HID_MouseReport_t hid_mouse_report; volatile static bool bMouseChanged = false; #endif @@ -78,7 +77,7 @@ ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t break; #endif - #ifdef CFG_USB_HID_MOUSE + #ifdef CFG_CLASS_HID_MOUSE case HID_PROTOCOL_MOUSE: *pBuffer = (uint8_t*) &hid_mouse_report; *plength = sizeof(USB_HID_MouseReport_t); @@ -139,7 +138,7 @@ ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event) break; #endif - #ifdef CFG_USB_HID_MOUSE + #ifdef CFG_CLASS_HID_MOUSE case HID_PROTOCOL_MOUSE: if (!bMouseChanged) { @@ -213,7 +212,7 @@ TUSB_Error_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *co *mem_base += (*mem_size - hid_param.mem_size); *mem_size = hid_param.mem_size; - return LPC_OK; + return tERROR_NONE; } /**************************************************************************/ @@ -227,7 +226,7 @@ TUSB_Error_t usb_hid_configured(USBD_HANDLE_T hUsb) USBD_API->hw->WriteEP(hUsb , HID_KEYBOARD_EP_IN , (uint8_t* ) &hid_keyboard_report , sizeof(USB_HID_KeyboardReport_t) ); // initial packet for IN endpoint , will not work if omitted #endif - #ifdef CFG_USB_HID_MOUSE + #ifdef CFG_CLASS_HID_MOUSE USBD_API->hw->WriteEP(hUsb , HID_MOUSE_EP_IN , (uint8_t* ) &hid_mouse_report , sizeof(USB_HID_MouseReport_t) ); // initial packet for IN endpoint, will not work if omitted #endif @@ -292,11 +291,11 @@ TUSB_Error_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uin bKeyChanged = true; - return LPC_OK; + return tERROR_NONE; } #endif -#ifdef CFG_USB_HID_MOUSE +#ifdef CFG_CLASS_HID_MOUSE /**************************************************************************/ /*! @brief Send the supplied mouse event out via HID USB mouse emulation @@ -341,7 +340,7 @@ TUSB_Error_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y) bMouseChanged = true; - return LPC_OK; + return tERROR_NONE; } #endif diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index aabf5df8a..74ce21278 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -38,19 +38,10 @@ #ifndef _TUSB_HID_H_ #define _TUSB_HID_H_ -#ifdef __cplusplus - extern "C" { -#endif - // TODO refractor #include "common/common.h" #include "device/dcd.h" -TUSB_Error_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size) ATTR_NON_NULL; -TUSB_Error_t usb_hid_configured(USBD_HANDLE_T hUsb); - -TUSB_Error_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey) ATTR_NON_NULL; -TUSB_Error_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y); /** \brief Standard HID Boot Protocol Mouse Report. * @@ -136,6 +127,16 @@ enum USB_HID_LOCAL_CODE }; #ifdef __cplusplus + extern "C" { +#endif + +TUSB_Error_t usb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *const pIntfDesc, uint8_t const * const pHIDReportDesc, uint32_t ReportDescLength, uint32_t* mem_base, uint32_t* mem_size) ATTR_NON_NULL; +TUSB_Error_t usb_hid_configured(USBD_HANDLE_T hUsb); + +TUSB_Error_t usb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey) ATTR_NON_NULL; +TUSB_Error_t usb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y); + +#ifdef __cplusplus } #endif |
