Turn STM32F4 Discovery into an HID USB device
ST provides ready made code for having an HID device. It might need to be a bit customized depending on what you want, but 80-90% is already done. Take a look at their website.

Look at the STM32F4 page for that particular device. Tons of examples.