fix descriptors for device

This commit is contained in:
hathach 2012-12-07 10:53:52 +07:00
parent daa1e125a1
commit cc45f35d70
4 changed files with 37 additions and 37 deletions

View File

@ -13,7 +13,7 @@ buildname := $(shell echo $(notdir $(build_dir)) | tr a-z A-Z)
board = $(buildname)
mcu = $(shell echo $(MCU) | tr A-Z a-z)
$(info board $(board) )
$(warning board $(board) )
ifeq (,$(findstring BOARD_,$(board)))
$(error build's name must be name exactly the same as the macro BOARD_NAME defined in the tinyusb/demos/boards/board.h)
@ -25,7 +25,7 @@ ifeq (,$(MCU))
$(error build name must contain one of supported mcu: $(mcu_support))
endif
$(info MCU $(MCU) $(mcu))
$(warning MCU $(MCU) $(mcu))
################ Build Manipulate ################
#Remove all other mcu in demos/bsp and keep only needed one

View File

@ -367,8 +367,8 @@ ATTR_ALIGNED(4) const USB_STR_DESCRIPTOR USB_StringDescriptor =
.strManufacturer = {'t', 'i', 'n', 'y', 'U', 'S', 'B'},
.Product = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_PRODUCT)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE },
.strProduct = {'D', 'e', 'v', 'i', 'c', ' ', 'e', 'K', 'e', 'y', 'b', 'o', 'a', 'r', 'd'},
.strProduct = {'D', 'e', 'v', 'i', 'c', 'e', ' ', 'K', 'e', 'y', 'b', 'o', 'a', 'r', 'd'},
.Serial = { .bLength = USB_STRING_LEN(USB_STRING_SERIAL_LEN), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE },
.Serial = { .bLength = USB_STRING_LEN(sizeof(CFG_USB_STRING_SERIAL)-1), .bDescriptorType = USB_STRING_DESCRIPTOR_TYPE },
.strSerial = {'1', '2', '3', '4'}
};

View File

@ -44,38 +44,38 @@ int main(void)
#endif
}
// #ifdef CFG_CLASS_CDC
// if (usb_isConfigured())
// {
// uint8_t cdc_char;
// if( tusb_cdc_getc(&cdc_char) )
// {
// switch (cdc_char)
// {
// #ifdef CFG_CLASS_HID_KEYBOARD
// case '1' :
// {
// uint8_t keys[6] = {HID_USAGE_KEYBOARD_aA + 'e' - 'a'};
// tusb_hid_keyboard_sendKeys(0x08, keys, 1); // windows + E --> open explorer
// }
// break;
// #endif
//
// #ifdef CFG_CLASS_HID_MOUSE
// case '2' :
// tusb_hid_mouse_send(0, 10, 10);
// break;
// #endif
//
// default :
// cdc_char = toupper(cdc_char);
// tusb_cdc_putc(cdc_char);
// break;
//
// }
// }
// }
//#endif
#ifdef CFG_CLASS_CDC
if (usb_isConfigured())
{
uint8_t cdc_char;
if( tusb_cdc_getc(&cdc_char) )
{
switch (cdc_char)
{
#ifdef CFG_CLASS_HID_KEYBOARD
case '1' :
{
uint8_t keys[6] = {HID_USAGE_KEYBOARD_aA + 'e' - 'a'};
tusb_hid_keyboard_sendKeys(0x08, keys, 1); // windows + E --> open explorer
}
break;
#endif
#ifdef CFG_CLASS_HID_MOUSE
case '2' :
tusb_hid_mouse_send(0, 10, 10);
break;
#endif
default :
cdc_char = toupper(cdc_char);
tusb_cdc_putc(cdc_char);
break;
}
}
}
#endif
}
return 0;

View File

@ -5,6 +5,6 @@ proj_path = $(build_dir)/..
#get workspace absolute path
workspace_dir = $(shell cd $(proj_path)/../../.. ; pwd)
#workspace_dir = $(proj_path)/../../../
$(info workspace $(workspace_dir))
$(warning workspace $(workspace_dir))
include $(workspace_dir)/demos/demos.mk