add class_hid_keyboard_init and test code

add define _TINY_USB_SOURCE_FILE_ to hide internal API from application
This commit is contained in:
hathach
2013-01-27 12:18:01 +07:00
parent d286c95765
commit 5feb1c90b4
5 changed files with 44 additions and 10 deletions

View File

@@ -48,6 +48,7 @@
- MCU=MCU_LPC43XX
- CORE_M4
- __CODE_RED
- _TINY_USB_SOURCE_FILE_
:test_preprocess:
- *common_defines
- _TEST_

View File

@@ -90,7 +90,7 @@ void tearDown(void)
}
//--------------------------------------------------------------------+
// keyboard_install, keyboard_no_instances
// keyboard_install, keyboard_no_instances, keybaord_init
//--------------------------------------------------------------------+
void test_keyboard_no_instances_invalid_para(void)
{
@@ -107,6 +107,16 @@ void test_keyboard_install_ok(void)
TEST_ASSERT_EQUAL(1, tusbh_hid_keyboard_no_instances(device_hdl));
}
void test_keyboard_init(void)
{
class_hid_keyboard_info_t keyboard_info_zero[TUSB_CFG_HOST_DEVICE_MAX];
memset(&keyboard_info_zero, 0, sizeof(class_hid_keyboard_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
class_hid_keyboard_init();
TEST_ASSERT_EQUAL_MEMORY(keyboard_info_zero, keyboard_info_pool, sizeof(class_hid_keyboard_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
}
//--------------------------------------------------------------------+
// keyboard_get
//--------------------------------------------------------------------+