diff options
| author | hathach <[email protected]> | 2012-12-20 16:56:19 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-12-20 16:56:19 +0700 |
| commit | 00b3f485194a491b9da7420f3358c4117292319e (patch) | |
| tree | 1820c1455e10335e25bd5ce866e2a77fc7bea733 /tinyusb/class | |
| parent | ec4a3f60488fbd9eaf51c12b1cce79f0a7d3064f (diff) | |
rename a bunch of configure macros
Diffstat (limited to 'tinyusb/class')
| -rw-r--r-- | tinyusb/class/cdc.c | 2 | ||||
| -rw-r--r-- | tinyusb/class/hid.c | 22 | ||||
| -rw-r--r-- | tinyusb/class/hid.h | 14 |
3 files changed, 24 insertions, 14 deletions
diff --git a/tinyusb/class/cdc.c b/tinyusb/class/cdc.c index de08eeeda..ea7613301 100644 --- a/tinyusb/class/cdc.c +++ b/tinyusb/class/cdc.c @@ -38,7 +38,7 @@ #include "cdc.h" #include "common/fifo.h" -#if defined CFG_CLASS_CDC && defined CFG_TUSB_DEVICE +#if defined TUSB_CFG_DEVICE_CDC && defined TUSB_CFG_DEVICE static USBD_HANDLE_T g_hCdc; static CDC_LINE_CODING line_coding; diff --git a/tinyusb/class/hid.c b/tinyusb/class/hid.c index 659765c1a..b5416faa3 100644 --- a/tinyusb/class/hid.c +++ b/tinyusb/class/hid.c @@ -37,14 +37,14 @@ #include "hid.h" -#if defined TUSB_CLASS_HID && defined CFG_TUSB_DEVICE +#if defined DEVICE_CLASS_HID && defined TUSB_CFG_DEVICE -#ifdef CFG_CLASS_HID_KEYBOARD +#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD USB_HID_KeyboardReport_t hid_keyboard_report; volatile static bool bKeyChanged = false; #endif -#ifdef CFG_CLASS_HID_MOUSE +#ifdef TUSB_CFG_DEVICE_HID_MOUSE USB_HID_MouseReport_t hid_mouse_report; volatile static bool bMouseChanged = false; #endif @@ -64,7 +64,7 @@ ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t switch (pHidCtrl->protocol) { - #ifdef CFG_CLASS_HID_KEYBOARD + #ifdef TUSB_CFG_DEVICE_HID_KEYBOARD case HID_PROTOCOL_KEYBOARD: *pBuffer = (uint8_t*) &hid_keyboard_report; *plength = sizeof(USB_HID_KeyboardReport_t); @@ -77,7 +77,7 @@ ErrorCode_t HID_GetReport( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t break; #endif - #ifdef CFG_CLASS_HID_MOUSE + #ifdef TUSB_CFG_DEVICE_HID_MOUSE case HID_PROTOCOL_MOUSE: *pBuffer = (uint8_t*) &hid_mouse_report; *plength = sizeof(USB_HID_MouseReport_t); @@ -127,7 +127,7 @@ ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event) USB_HID_CTRL_T* pHidCtrl = (USB_HID_CTRL_T*)data; switch(pHidCtrl->protocol) { - #ifdef CFG_CLASS_HID_KEYBOARD + #ifdef TUSB_CFG_DEVICE_HID_KEYBOARD case HID_PROTOCOL_KEYBOARD: if (!bKeyChanged) { @@ -138,7 +138,7 @@ ErrorCode_t HID_EpIn_Hdlr (USBD_HANDLE_T hUsb, void* data, uint32_t event) break; #endif - #ifdef CFG_CLASS_HID_MOUSE + #ifdef TUSB_CFG_DEVICE_HID_MOUSE case HID_PROTOCOL_MOUSE: if (!bMouseChanged) { @@ -222,18 +222,18 @@ TUSB_Error_t tusb_hid_init(USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR const *c /**************************************************************************/ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb) { - #ifdef CFG_CLASS_HID_KEYBOARD + #ifdef TUSB_CFG_DEVICE_HID_KEYBOARD 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_CLASS_HID_MOUSE + #ifdef TUSB_CFG_DEVICE_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 return tERROR_NONE; } -#ifdef CFG_CLASS_HID_KEYBOARD +#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD /**************************************************************************/ /*! @brief Send the supplied key codes out via HID USB keyboard emulation @@ -295,7 +295,7 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui } #endif -#ifdef CFG_CLASS_HID_MOUSE +#ifdef TUSB_CFG_DEVICE_HID_MOUSE /**************************************************************************/ /*! @brief Send the supplied mouse event out via HID USB mouse emulation diff --git a/tinyusb/class/hid.h b/tinyusb/class/hid.h index b5516e259..4779e9e81 100644 --- a/tinyusb/class/hid.h +++ b/tinyusb/class/hid.h @@ -57,8 +57,14 @@ // TODO refractor #include "common/common.h" + +#ifdef TUSB_CFG_DEVICE #include "device/dcd.h" +#endif +#ifdef TUSB_CFG_HOST +#include "device/hcd.h" +#endif /** \struct USB_HID_MouseReport_t * \brief Standard HID Boot Protocol Mouse Report. @@ -160,7 +166,7 @@ enum USB_HID_LOCAL_CODE * \return Error Code of the \ref TUSB_ERROR enum * \note */ -TUSB_Error_t tusb_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 tusb_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); /** \brief Notify HID class that usb is configured * @@ -178,7 +184,7 @@ TUSB_Error_t tusb_hid_configured(USBD_HANDLE_T hUsb); * \return Error Code of the \ref TUSB_ERROR enum * \note */ -TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey) ATTR_NON_NULL; +TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], uint8_t numkey); /** \brief * @@ -190,6 +196,10 @@ TUSB_Error_t tusb_hid_keyboard_sendKeys(uint8_t modifier, uint8_t keycodes[], ui TUSB_Error_t tusb_hid_mouse_send(uint8_t buttons, int8_t x, int8_t y); #endif + +#ifdef TUSB_CFG_HOST +#endif + #ifdef __cplusplus } #endif |
