mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-25 03:02:26 +00:00
fix compiling error for tests project
start to add support for host hid mouse
This commit is contained in:
parent
1776bb53f6
commit
24ade0458e
@ -45,4 +45,11 @@
|
|||||||
#include "mock_hcd.h"
|
#include "mock_hcd.h"
|
||||||
#include "descriptor_test.h"
|
#include "descriptor_test.h"
|
||||||
|
|
||||||
|
void setUp(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void tearDown(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
|
|
||||||
//------------- CLASS -------------//
|
//------------- CLASS -------------//
|
||||||
#define TUSB_CFG_HOST_HID_KEYBOARD 1
|
#define TUSB_CFG_HOST_HID_KEYBOARD 1
|
||||||
|
#define TUSB_CFG_HOST_HID_MOUSE 1
|
||||||
|
|
||||||
#define HOST_HCD_XFER_INTERRUPT
|
#define HOST_HCD_XFER_INTERRUPT
|
||||||
#define HOST_HCD_XFER_BULK
|
#define HOST_HCD_XFER_BULK
|
||||||
|
@ -123,6 +123,27 @@ static inline void hidh_keyboard_close(uint8_t dev_addr)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// MOUSE
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#if TUSB_CFG_HOST_HID_MOUSE
|
||||||
|
|
||||||
|
//------------- Internal API -------------//
|
||||||
|
static inline tusb_error_t hidh_mouse_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const *p_endpoint_desc) ATTR_ALWAYS_INLINE;
|
||||||
|
static inline tusb_error_t hidh_mouse_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const *p_endpoint_desc)
|
||||||
|
{
|
||||||
|
|
||||||
|
return TUSB_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void hidh_mouse_close(uint8_t dev_addr) ATTR_ALWAYS_INLINE;
|
||||||
|
static inline void hidh_mouse_close(uint8_t dev_addr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// CLASS-USBD API (don't require to verify parameters)
|
// CLASS-USBD API (don't require to verify parameters)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -133,7 +154,7 @@ void hidh_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TUSB_CFG_HOST_HID_MOUSE
|
#if TUSB_CFG_HOST_HID_MOUSE
|
||||||
hidh_mouse_init();
|
// hidh_mouse_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TUSB_CFG_HOST_HID_GENERIC
|
#if TUSB_CFG_HOST_HID_GENERIC
|
||||||
@ -169,7 +190,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|||||||
|
|
||||||
#if TUSB_CFG_HOST_HID_MOUSE
|
#if TUSB_CFG_HOST_HID_MOUSE
|
||||||
case HID_PROTOCOL_MOUSE:
|
case HID_PROTOCOL_MOUSE:
|
||||||
ASSERT_STATUS ( hidh_keyboard_open(dev_addr, p_desc, p_length) );
|
ASSERT_STATUS ( hidh_mouse_open(dev_addr, (tusb_descriptor_endpoint_t const *) p_desc) );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -135,11 +135,12 @@ void hcd_port_reset(uint8_t hostid)
|
|||||||
// NXP specific, port reset will automatically be 0 when reset sequence complete
|
// NXP specific, port reset will automatically be 0 when reset sequence complete
|
||||||
// there is chance device is unplugged while reset sequence is not complete
|
// there is chance device is unplugged while reset sequence is not complete
|
||||||
while( regs->portsc_bit.port_reset) {}
|
while( regs->portsc_bit.port_reset) {}
|
||||||
#endif
|
|
||||||
// TODO finalize delay after reset, hack delay 100 ms, otherwise speed is detected as LOW in most cases
|
// TODO finalize delay after reset, hack delay 100 ms, otherwise speed is detected as LOW in most cases
|
||||||
volatile uint32_t delay_us = 100000;
|
volatile uint32_t delay_us = 100000;
|
||||||
delay_us *= (SystemCoreClock / 1000000) / 3;
|
delay_us *= (SystemCoreClock / 1000000) / 3;
|
||||||
while(delay_us--);
|
while(delay_us--);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hcd_port_connect_status(uint8_t hostid)
|
bool hcd_port_connect_status(uint8_t hostid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user