cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID as keyboard emulation as keyboard emulation

Posted on June 26, 2017 at 15:25

This is my first experience with USB as virtual keyboard.

I have configured in CubeMX a Human Interface Device (HID). After that, to have someting written in my notepad I have written the following function:

      uint8_t USB_TX_Buffer[8];

      USB_TX_Buffer[0]= 'H';

      USB_TX_Buffer[1]= 'e';

      USB_TX_Buffer[2]= 'l';

      USB_TX_Buffer[3]= 'l';

      USB_TX_Buffer[4]= 'o';

      USB_TX_Buffer[5]= '\0';

      USBD_HID_SendReport(hUsbDeviceFS, USB_TX_Buffer, 6);

      HAL_Delay(1000);

But I obtain only the movement of the mouse! Can someone suggest me the right way?
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 27, 2017 at 16:21

Now it is working perfectly!

I have only to understand how to manage the capital letters. The others are working perfectly!

View solution in original post

2 REPLIES 2
Imen.D
ST Employee
Posted on June 27, 2017 at 12:17

Hi

Gottardello.Deni

,

You may find a HID example in the Cube firmware package relevant to the STM32 device you are using

, as in this folder : STM32Cube_FW_F4_V1.0\Projects\STM324xG_EVAL\Applications\USB_Host\HID_Standalone.

It is a typical application on how to use the STM32F4xx USB OTG Host peripheral to interact with an USB HID Device such as a Mouse or a Keyboard.

You can look on this ST prese

ntation labs described how to create the HID device with CubeMX:

Hope this helps you.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on June 27, 2017 at 16:21

Now it is working perfectly!

I have only to understand how to manage the capital letters. The others are working perfectly!