summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2012-12-07 10:53:52 +0700
committerhathach <[email protected]>2012-12-07 10:53:52 +0700
commitcc45f35d706ee9388be422d9a89ab204fac2a591 (patch)
tree853b88c6c825552333a131e444ff1a1470cc3fd3
parentdaa1e125a1b9ffb2414d32b4fddeaa1487c29110 (diff)
fix descriptors for device
-rw-r--r--demos/demos.mk4
-rw-r--r--demos/device/keyboard/descriptors.c4
-rw-r--r--demos/device/keyboard/main.c64
-rw-r--r--demos/device/keyboard/makefile.defs2
4 files changed, 37 insertions, 37 deletions
diff --git a/demos/demos.mk b/demos/demos.mk
index a3a1f82d2..fe8eb0ff3 100644
--- a/demos/demos.mk
+++ b/demos/demos.mk
@@ -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
diff --git a/demos/device/keyboard/descriptors.c b/demos/device/keyboard/descriptors.c
index 2b8cbc854..929ec17f2 100644
--- a/demos/device/keyboard/descriptors.c
+++ b/demos/device/keyboard/descriptors.c
@@ -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'}
};
diff --git a/demos/device/keyboard/main.c b/demos/device/keyboard/main.c
index 859139997..e792d36ab 100644
--- a/demos/device/keyboard/main.c
+++ b/demos/device/keyboard/main.c
@@ -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;
diff --git a/demos/device/keyboard/makefile.defs b/demos/device/keyboard/makefile.defs
index 4784abf16..8532b57e8 100644
--- a/demos/device/keyboard/makefile.defs
+++ b/demos/device/keyboard/makefile.defs
@@ -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