INPUT(1), 0x02, // Data, Variable, Absolute UNIT(1), 0x14, // Unit (Eng Rot:Angular Pos) PHYSICAL_MINIMUM(1), 0x00, // Physical_Minimum (0) This means changing the descriptor as shown below: Additional buttons and functions can be added by modifying the USB Descriptor and adapting the 'report' structure inside the Joystick::update() method. The current implementation represents a simple joystick. You could also develop your own PC applications and access the joystick data through DirectX calls. Buttons or Hat switches can reflect mbed DigitalIn pins or could be read out from I2C or SPI portexpanders.Īny regular PC game that can use joysticks should be able to run with the mbed joystick emulator. You could for example use mbed analog inputs to send X, Y, throttle or rudder values to a game running on your PC. Throttle, Rudder, X,Y and the buttons/hatswitch should be constantly changing through all possible values. Click on its properties button and voila. When all is well you can now find the game controller by clicking on the special gamecontroller icon in the Windows Control Panel. Note that you should see a new generic HID device and a specific Game controller device. The proper functioning of the joystick can be checked by opening the Windows Control Panel on your PC and inspecting the USB HID device list. Windows will automatically install device drivers when the USB joystick device is first connected to your PC. Joystick.update(throttle, rudder, x, y, buttons, hat) Hat = (i > 8) & 0x07 // value 0.7 or 8 for neutral Some other ST F103 examples are here and here. The reference at the end of this page should help you get started.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |