clean up, rename some HID device symbol/API

- add tud_hid_n_interface_protocol()
- rename tud_hid_n_boot_mode() to  tud_hid_n_get_protocol()
- rename tud_hid_boot_mode_cb() to tud_hid_set_protocol_cb()
- add HID_PROTOCOL_BOOT/REPORT to avoid magic number 0,1
- rename HID_PROTOCOL_NONE/KEYBOARD/MOUSE to HID_ITF_PROTOCOL_ to avoid
confusion
This commit is contained in:
hathach
2021-05-18 12:32:20 +07:00
parent 2d15e11830
commit e163f85ee0
8 changed files with 92 additions and 64 deletions

View File

@@ -178,7 +178,7 @@ bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t c
if ( HID_SUBCLASS_BOOT == p_interface_desc->bInterfaceSubClass )
{
#if CFG_TUH_HID_KEYBOARD
if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
if ( HID_ITF_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
{
TU_ASSERT( hidh_interface_open(rhport, dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboardh_data[dev_addr-1]) );
TU_LOG2_HEX(keyboardh_data[dev_addr-1].ep_in);
@@ -186,7 +186,7 @@ bool hidh_open_subtask(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t c
#endif
#if CFG_TUH_HID_MOUSE
if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
if ( HID_ITF_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
{
TU_ASSERT ( hidh_interface_open(rhport, dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouseh_data[dev_addr-1]) );
TU_LOG2_HEX(mouseh_data[dev_addr-1].ep_in);