Эх сурвалжийг харах

rename tud_hid_mouse_busy to tud_hid_mouse_ready

hathach 7 жил өмнө
parent
commit
b370283174

+ 1 - 1
examples/device/nrf52840/src/main.c

@@ -132,7 +132,7 @@ void usb_hid_task(void)
 
 
   /*------------- Mouse -------------*/
-  //    if ( !tud_hid_mouse_busy() )
+  //    if ( tud_hid_mouse_ready() )
   //    {
   //      // Poll every 10ms
   //      static tu_timeout_t tm = { .start = 0, .interval = 10 };

+ 5 - 4
src/class/hid/hid_device.c

@@ -173,14 +173,15 @@ bool tud_hid_keyboard_key_sequence(const char* str, uint32_t interval_ms)
 // MOUSE APPLICATION API
 //--------------------------------------------------------------------+
 #if CFG_TUD_HID_MOUSE
-bool tud_hid_mouse_busy(void)
+bool tud_hid_mouse_ready(void)
 {
-  return dcd_edpt_busy(TUD_OPT_RHPORT, _mse_itf.ep_in);
+  VERIFY( _mse_itf.ep_in != 0 );
+  return !dcd_edpt_busy(TUD_OPT_RHPORT, _mse_itf.ep_in);
 }
 
-bool tud_hid_mouse_report(hid_mouse_report_t const *p_report)
+static bool hidd_mouse_report(hid_mouse_report_t const *p_report)
 {
-  VERIFY( tud_mounted() && !tud_hid_mouse_busy() );
+  VERIFY( tud_hid_mouse_ready() );
 
   hidd_interface_t * p_hid = &_mse_itf;
   memcpy(p_hid->report_buf, p_report, sizeof(hid_mouse_report_t));

+ 1 - 7
src/class/hid/hid_device.h

@@ -119,15 +119,9 @@ ATTR_WEAK void tud_hid_keyboard_set_report_cb(hid_report_type_t report_type, uin
  * \retval      false if the interface is not busy meaning the stack successfully transferred data from/to host
  * \note        This function is primarily used for polling/waiting result after \ref tusbd_hid_mouse_send.
  */
-bool tud_hid_mouse_busy(void);
+bool tud_hid_mouse_ready(void);
 
-/** \brief        Perform transfer queuing
- * \param[in,out] p_report Report data, if NULL, an empty report (all zeroes) is used
- * \returns       true on success, false otherwise (not mounted or busy)
- */
-bool tud_hid_mouse_report(hid_mouse_report_t const *p_report);
 bool tud_hid_mouse_data(uint8_t buttons, int8_t x, int8_t y, int8_t scroll, int8_t pan);
-
 bool tud_hid_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan);
 
 bool tud_hid_mouse_button_press(uint8_t buttons);