mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
rename macro configure in examples
This commit is contained in:
parent
f9aee11063
commit
8c2ec83c59
@ -37,7 +37,7 @@
|
||||
|
||||
#include "descriptors.h"
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
ATTR_ALIGNED(4) const uint8_t HID_KeyboardReportDescriptor[] = {
|
||||
HID_UsagePage ( HID_USAGE_PAGE_GENERIC ),
|
||||
HID_Usage ( HID_USAGE_GENERIC_KEYBOARD ),
|
||||
@ -80,7 +80,7 @@ ATTR_ALIGNED(4) const uint8_t HID_KeyboardReportDescriptor[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
ATTR_ALIGNED(4) const uint8_t HID_MouseReportDescriptor[] = {
|
||||
HID_UsagePage ( HID_USAGE_PAGE_GENERIC ),
|
||||
HID_Usage ( HID_USAGE_GENERIC_MOUSE ),
|
||||
@ -130,7 +130,7 @@ ATTR_ALIGNED(4) const USB_DEVICE_DESCRIPTOR USB_DeviceDescriptor =
|
||||
.bDeviceClass = USB_DEVICE_CLASS_IAD,
|
||||
.bDeviceSubClass = USB_DEVICE_SUBCLASS_IAD,
|
||||
.bDeviceProtocol = USB_DEVICE_PROTOCOL_IAD,
|
||||
#elif defined CFG_CLASS_CDC
|
||||
#elif defined TUSB_CFG_DEVICE_CDC
|
||||
.bDeviceClass = CDC_COMMUNICATION_INTERFACE_CLASS,
|
||||
.bDeviceSubClass = 0x00,
|
||||
.bDeviceProtocol = 0x00,
|
||||
@ -187,7 +187,7 @@ ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_FsConfigDescriptor =
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_CDC
|
||||
#ifdef TUSB_CFG_DEVICE_CDC
|
||||
// USB CDC Serial Interface
|
||||
// CDC Control Interface
|
||||
.CDC_CCI_Interface =
|
||||
@ -276,7 +276,7 @@ ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_FsConfigDescriptor =
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
///// USB HID Keyboard interface
|
||||
.HID_KeyboardInterface =
|
||||
{
|
||||
@ -316,7 +316,7 @@ ATTR_ALIGNED(4) const USB_FS_CONFIGURATION_DESCRIPTOR USB_FsConfigDescriptor =
|
||||
},
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
.HID_MouseInterface =
|
||||
{
|
||||
.bLength = sizeof(USB_INTERFACE_DESCRIPTOR),
|
||||
|
@ -67,21 +67,21 @@ typedef PRE_PACK struct POST_PACK _USB_STR_DESCRIPTOR
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Interface Assosication Descriptor if device is CDC + other class
|
||||
#define IAD_DESC_REQUIRED ( defined(CFG_CLASS_CDC) && (TUSB_CLASS_HID) )
|
||||
#define IAD_DESC_REQUIRED ( defined(TUSB_CFG_DEVICE_CDC) && (DEVICE_CLASS_HID) )
|
||||
|
||||
#ifdef CFG_CLASS_CDC
|
||||
#ifdef TUSB_CFG_DEVICE_CDC
|
||||
#define INTERFACES_OF_CDC 2
|
||||
#else
|
||||
#define INTERFACES_OF_CDC 0
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
#define INTERFACES_OF_HID_KEYBOARD 1
|
||||
#else
|
||||
#define INTERFACES_OF_HID_KEYBOARD 0
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
#define INTERFACES_OF_HID_MOUSE 1
|
||||
#else
|
||||
#define INTERFACES_OF_HID_MOUSE 0
|
||||
@ -121,7 +121,7 @@ typedef struct
|
||||
USB_Descriptor_InterfaceAssociation_t CDC_IAD;
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_CDC
|
||||
#ifdef TUSB_CFG_DEVICE_CDC
|
||||
//CDC - Serial
|
||||
//CDC Control Interface
|
||||
USB_INTERFACE_DESCRIPTOR CDC_CCI_Interface;
|
||||
@ -136,14 +136,14 @@ typedef struct
|
||||
USB_ENDPOINT_DESCRIPTOR CDC_DataInEndpoint;
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
//Keyboard HID Interface
|
||||
USB_INTERFACE_DESCRIPTOR HID_KeyboardInterface;
|
||||
HID_DESCRIPTOR HID_KeyboardHID;
|
||||
USB_ENDPOINT_DESCRIPTOR HID_KeyboardEndpoint;
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
//Mouse HID Interface
|
||||
USB_INTERFACE_DESCRIPTOR HID_MouseInterface;
|
||||
HID_DESCRIPTOR HID_MouseHID;
|
||||
|
@ -28,22 +28,22 @@ int main(void)
|
||||
|
||||
printf("hello world\n");
|
||||
|
||||
#ifndef CFG_CLASS_CDC
|
||||
#ifndef TUSB_CFG_DEVICE_CDC
|
||||
if (usb_isConfigured())
|
||||
{
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
uint8_t keys[6] = {HID_USAGE_KEYBOARD_aA};
|
||||
tusb_hid_keyboard_sendKeys(0x00, keys, 1);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
tusb_hid_mouse_send(0, 10, 10);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CFG_CLASS_CDC
|
||||
#ifdef TUSB_CFG_DEVICE_CDC
|
||||
if (usb_isConfigured())
|
||||
{
|
||||
uint8_t cdc_char;
|
||||
@ -51,7 +51,7 @@ int main(void)
|
||||
{
|
||||
switch (cdc_char)
|
||||
{
|
||||
#ifdef CFG_CLASS_HID_KEYBOARD
|
||||
#ifdef TUSB_CFG_DEVICE_HID_KEYBOARD
|
||||
case '1' :
|
||||
{
|
||||
uint8_t keys[6] = {HID_USAGE_KEYBOARD_aA + 'e' - 'a'};
|
||||
@ -60,7 +60,7 @@ int main(void)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CFG_CLASS_HID_MOUSE
|
||||
#ifdef TUSB_CFG_DEVICE_HID_MOUSE
|
||||
case '2' :
|
||||
tusb_hid_mouse_send(0, 10, 10);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user