请参考:
uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize)
{
/* Use the memory interface function to write to the selected endpoint */
UserToPMABufferCopy(pBufferPointer, GetEPTxAddr(bEpAddr & 0x7F), wBufferSize);
/* Update the data length in the control register */
SetEPTxCount((bEpAddr & 0x7F), wBufferSize);
return 0;
}
void KeyBoard_Send(u8 *buffer_out,u8 count)
{
USB_SIL_Write(EP1_IN, buffer_out, count);
/* enable endpoint for transmission */
SetEPTxValid(ENDP1);
}
void Joystick_Send(void)
{
u8 Buffer_Scan1[8] = {0, 0, 0, 0, 0, 0, 0, 0};
u8 Buffer_Scan2[8] = {0, 0, 0, 0, 0, 0, 0, 0};
Buffer_Scan1[2]=0x04; //key----> number--A
KeyBoard_Send(Buffer_Scan1,8);
KeyBoard_Send(Buffer_Scan2,8);
}
|