add test for mouse_open
add hid descriptor for mouse & mouse interface to descriptor_test refractor extract function hidh_interface_status fix error with MACRO HID_REPORT_ITEM with zero data size --> redundant semicolon
This commit is contained in:
@@ -192,12 +192,12 @@ enum USB_HID_LOCAL_CODE
|
||||
//--------------------------------------------------------------------+
|
||||
//------------- ITEM & TAG -------------//
|
||||
#define HID_REPORT_DATA_0(data)
|
||||
#define HID_REPORT_DATA_1(data) data
|
||||
#define HID_REPORT_DATA_2(data) U16_TO_U8S_LE(data)
|
||||
#define HID_REPORT_DATA_3(data) U32_TO_U8S_LE(data)
|
||||
#define HID_REPORT_DATA_1(data) , data
|
||||
#define HID_REPORT_DATA_2(data) , U16_TO_U8S_LE(data)
|
||||
#define HID_REPORT_DATA_3(data) , U32_TO_U8S_LE(data)
|
||||
|
||||
#define HID_REPORT_ITEM(data, tag, type, size) \
|
||||
( (tag << 4) | (type << 2) | size), HID_REPORT_DATA_##size(data)
|
||||
((tag << 4) | (type << 2) | size) HID_REPORT_DATA_##size(data)
|
||||
|
||||
#define RI_TYPE_MAIN 0
|
||||
#define RI_TYPE_GLOBAL 1
|
||||
|
||||
@@ -53,6 +53,19 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
tusb_interface_status_t hidh_interface_status(uint8_t dev_addr, hidh_interface_info_t *p_hid) ATTR_PURE ATTR_ALWAYS_INLINE;
|
||||
tusb_interface_status_t hidh_interface_status(uint8_t dev_addr, hidh_interface_info_t *p_hid)
|
||||
{
|
||||
switch( tusbh_device_get_state(dev_addr) )
|
||||
{
|
||||
case TUSB_DEVICE_STATE_UNPLUG:
|
||||
case TUSB_DEVICE_STATE_INVALID_PARAMETER:
|
||||
return TUSB_INTERFACE_STATUS_INVALID_PARA;
|
||||
|
||||
default:
|
||||
return p_hid->status;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// KEYBOARD
|
||||
@@ -94,15 +107,7 @@ tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, uint8_t instance_nu
|
||||
|
||||
tusb_interface_status_t tusbh_hid_keyboard_status(uint8_t dev_addr, uint8_t instance_num)
|
||||
{
|
||||
switch( tusbh_device_get_state(dev_addr) )
|
||||
{
|
||||
case TUSB_DEVICE_STATE_UNPLUG:
|
||||
case TUSB_DEVICE_STATE_INVALID_PARAMETER:
|
||||
return TUSB_INTERFACE_STATUS_INVALID_PARA;
|
||||
|
||||
default:
|
||||
return keyboard_data[dev_addr-1].status;
|
||||
}
|
||||
return hidh_interface_status(dev_addr, &keyboard_data[dev_addr-1]);
|
||||
}
|
||||
//------------- Internal API -------------//
|
||||
static inline tusb_error_t hidh_keyboard_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const *p_endpoint_desc) ATTR_ALWAYS_INLINE;
|
||||
@@ -160,6 +165,8 @@ tusb_interface_status_t tusbh_hid_mouse_status(uint8_t dev_addr, uint8_t instanc
|
||||
default:
|
||||
return mouse_data[dev_addr-1].status;
|
||||
}*/
|
||||
|
||||
return TUSB_INTERFACE_STATUS_INVALID_PARA;
|
||||
}
|
||||
|
||||
//------------- Internal API -------------//
|
||||
|
||||
Reference in New Issue
Block a user