diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index b3c28856..53244092 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -883,7 +883,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDData(p_int, g_hidData); + UserReadHIDData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index ca0fcf93..24699c14 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -30,11 +30,12 @@ #endif #if( 0 < HID_SIMULATE_INTERRUPTS ) -#define HID_DEASSERT_COUNT 10000000 +#define HID_DEASSERT_COUNT 10000 #define HID_INTERRUPT_COUNT 1000000000 #endif +void UserInitHIDData(void); +void UserReadHIDData(unsigned char hidData[ HID_DATA_SIZE ]); +void UserSetHIDData(const unsigned hidData); + #endif /* ( 0 < HID_CONTROLS ) */ - -void UserReadHIDData(in port p_int, unsigned char hidData[HID_DATA_SIZE]); - diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 2c907f16..dfba7fed 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -8,20 +8,28 @@ #define HID_REPORT_INTERRUPT_ASSERTED 0x01 #define HID_REPORT_INTERRUPT_DEASSERTED 0x00 -void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) +static unsigned char s_hidData; + +void UserInitHIDData( void ) { - unsigned curr_val; + s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; +} - p_int :> curr_val; +void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) +{ + hidData[ 0 ] = s_hidData; - if( curr_val == NDP10X_ASSERT_LEVEL ) { - hidData[ 0 ] = HID_REPORT_INTERRUPT_ASSERTED; - } else { - hidData[ 0 ] = HID_REPORT_INTERRUPT_DEASSERTED; + for( unsigned i = 1; i < HID_DATA_SIZE; ++i ) { + hidData[ i ] = 0U; } +} - for( unsigned idx = 1; idx < HID_DATA_SIZE; ++idx ) { - hidData[ idx ] = 0U; +void UserSetHIDData( const unsigned hidData ) +{ + if( hidData == NDP10X_ASSERT_LEVEL ) { + s_hidData = HID_REPORT_INTERRUPT_ASSERTED; + } else { + s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; } }