rename a bunch of configure macros
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -57,8 +57,14 @@
|
||||
|
||||
// TODO refractor
|
||||
#include "common/common.h"
|
||||
#include "device/dcd.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
|
||||
|
||||
Reference in New Issue
Block a user