![]() ![]() – usbd_ioreq.c, usbd_ctlreq.c (provides the USB IO requests) – usbd_core.c (provides all USB device core functions) Lets take a look on CubeMX generated files: You might wonder where this mouse came from. It should show as additional Mouse device under “Mice and other pointing devices”. When this is done, connect your usb cable to PC and wait for OS to initialise device. 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |