Need mouse or joystick sending percentage coordinates

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Posts: 1
Joined: Tue Nov 24, 2015 4:15 pm

Need mouse or joystick sending percentage coordinates

Post by franofcholet » Tue Nov 24, 2015 4:21 pm


In my project, I need to know the screen resolution before sending the coordinates. I have 2 solutions : either I get the screen resolution and send absolute coordinates, or I send directly percentage coordinates.

I cant find in the libraries if I am allow to do it with a mouse or joystick device.

Do you know wether it's possible ?

Thanks for your help !

Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: Need mouse or joystick sending percentage coordinates

Post by ulao » Wed Nov 25, 2015 4:24 am

Your basic usb set up will not allow data to the client. You send to host normally. If you want to do stuff like that you will need to use the usbFunctionWrite. This can be done with HID based drivers or by making your own vendor specific. There are lots of usbFunctionWrite examples around the forms.

The examples that come with this driver include a data transfer demo. If you only need to get the resolution on boot that could be handy. Otherwise you will need to create a vendor specific driver and send that data in bulk. Another "hack" way to do it would be with software. You could write a PID based device using force feedback and use something like custom force. Then in the software when you create the custom force effect and sendwhat ever you want.

Just a heads up, this may get tricky. Best of luck.

Post Reply