From 68fa17e17ca900ec2800c55c9345a2a0fed3fca9 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Feb 2021 14:07:33 +0700 Subject: [PATCH] more API rename --- examples/host/cdc_msc_hid/src/main.c | 4 ++-- src/class/hid/hid_device.h | 4 ++-- src/class/hid/hid_host.c | 8 ++++---- src/class/hid/hid_host.h | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c index c6ab54682..84e88e509 100644 --- a/examples/host/cdc_msc_hid/src/main.c +++ b/examples/host/cdc_msc_hid/src/main.c @@ -257,7 +257,7 @@ void hid_task(void) uint8_t const addr = 1; #if CFG_TUH_HID_KEYBOARD - if ( tuh_hid_keyboard_is_mounted(addr) ) + if ( tuh_hid_keyboard_mounted(addr) ) { if ( !tuh_hid_keyboard_is_busy(addr) ) { @@ -268,7 +268,7 @@ void hid_task(void) #endif #if CFG_TUH_HID_MOUSE - if ( tuh_hid_mouse_is_mounted(addr) ) + if ( tuh_hid_mouse_mounted(addr) ) { if ( !tuh_hid_mouse_is_busy(addr) ) { diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h index 0c59d5d20..7520d3453 100644 --- a/src/class/hid/hid_device.h +++ b/src/class/hid/hid_device.h @@ -50,7 +50,7 @@ #endif //--------------------------------------------------------------------+ -// Application API (Multiple Ports) +// Application API (Multiple Instances) // CFG_TUD_HID > 1 //--------------------------------------------------------------------+ @@ -76,7 +76,7 @@ bool tud_hid_n_mouse_report(uint8_t itf, uint8_t report_id, uint8_t buttons, int bool tud_hid_n_gamepad_report(uint8_t itf, uint8_t report_id, int8_t x, int8_t y, int8_t z, int8_t rz, int8_t rx, int8_t ry, uint8_t hat, uint16_t buttons); //--------------------------------------------------------------------+ -// Application API (Single Port) +// Application API (Single Instance) //--------------------------------------------------------------------+ static inline bool tud_hid_ready(void); static inline bool tud_hid_boot_mode(void); diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index 7ae50e4d7..aa6188a24 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -113,7 +113,7 @@ tusb_error_t hidh_interface_get_report(uint8_t dev_addr, void * report, hidh_int static hidh_interface_t keyboardh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1 //------------- KEYBOARD PUBLIC API (parameter validation required) -------------// -bool tuh_hid_keyboard_is_mounted(uint8_t dev_addr) +bool tuh_hid_keyboard_mounted(uint8_t dev_addr) { return tuh_device_is_configured(dev_addr) && (keyboardh_data[dev_addr-1].ep_in != 0); } @@ -125,7 +125,7 @@ tusb_error_t tuh_hid_keyboard_get_report(uint8_t dev_addr, void* p_report) bool tuh_hid_keyboard_is_busy(uint8_t dev_addr) { - return tuh_hid_keyboard_is_mounted(dev_addr) && hcd_edpt_busy(dev_addr, keyboardh_data[dev_addr-1].ep_in); + return tuh_hid_keyboard_mounted(dev_addr) && hcd_edpt_busy(dev_addr, keyboardh_data[dev_addr-1].ep_in); } #endif @@ -138,14 +138,14 @@ bool tuh_hid_keyboard_is_busy(uint8_t dev_addr) static hidh_interface_t mouseh_data[CFG_TUSB_HOST_DEVICE_MAX]; // does not have addr0, index = dev_address-1 //------------- Public API -------------// -bool tuh_hid_mouse_is_mounted(uint8_t dev_addr) +bool tuh_hid_mouse_mounted(uint8_t dev_addr) { return tuh_device_is_configured(dev_addr) && (mouseh_data[dev_addr-1].ep_in != 0); } bool tuh_hid_mouse_is_busy(uint8_t dev_addr) { - return tuh_hid_mouse_is_mounted(dev_addr) && hcd_edpt_busy(dev_addr, mouseh_data[dev_addr-1].ep_in); + return tuh_hid_mouse_mounted(dev_addr) && hcd_edpt_busy(dev_addr, mouseh_data[dev_addr-1].ep_in); } tusb_error_t tuh_hid_mouse_get_report(uint8_t dev_addr, void * report) diff --git a/src/class/hid/hid_host.h b/src/class/hid/hid_host.h index d43158186..f777fe45d 100644 --- a/src/class/hid/hid_host.h +++ b/src/class/hid/hid_host.h @@ -46,6 +46,16 @@ #define CFG_TUH_HID_MAX_REPORT 8 #endif +//--------------------------------------------------------------------+ +// Application API (Multiple Instances) +// CFG_TUH_HID > 1 +//--------------------------------------------------------------------+ + + +//--------------------------------------------------------------------+ +// Application API (Single Instance) +//--------------------------------------------------------------------+ + //--------------------------------------------------------------------+ // KEYBOARD Application API //--------------------------------------------------------------------+ @@ -63,7 +73,7 @@ extern uint8_t const hid_keycode_to_ascii_tbl[2][128]; // TODO used weak attr if * \retval true if device supports Keyboard interface * \retval false if device does not support Keyboard interface or is not mounted */ -bool tuh_hid_keyboard_is_mounted(uint8_t dev_addr); +bool tuh_hid_keyboard_mounted(uint8_t dev_addr); /** \brief Check if the interface is currently busy or not * \param[in] dev_addr device address @@ -128,7 +138,7 @@ void tuh_hid_keyboard_unmounted_cb(uint8_t dev_addr); * \retval true if device supports Mouse interface * \retval false if device does not support Mouse interface or is not mounted */ -bool tuh_hid_mouse_is_mounted(uint8_t dev_addr); +bool tuh_hid_mouse_mounted(uint8_t dev_addr); /** \brief Check if the interface is currently busy or not * \param[in] dev_addr device address