Button for triggering sending USB reports and LEDs for status. This is a template HID mouse, that works straight out of the box and is instantly recognised by PC when connecting USB cable. Note 2: Initialise USB as Full-Speed device, as Human Interface Device Class. In my case, I used 16MHz external oscillator. Note 1: USB in general need a proper reliable clock. Intialise all peripheral: USB, HSE, SWD, button (to send USB reports), leds (just for testing purposes).Update (): see the latest project with STM32 + USB + AHK here! Default USB HID device with STM32CubeMx STM32L100 discovery board was used for test. Here is an example of a basic – default code, which turns out to be USB HID mouse, and a guide how to transform this code to keyboard. I decided to break down this to smaller parts of modifying STM32 USB HID code, generated with STM32CubeMx. There is a post (STM32 And Custom USB HID Device? Yes Please!) that gets a lot of attention, although at the time it was created, only vague “how-to” was presented.