4 Replies Latest reply on Apr 9, 2018 12:10 PM by lujoc_2750256

    HID mouse X Y resolution

      I have been playing with the HID mouse example. I have been wondering how you can increase the resolution of X Y on the pointer. I have tried playing with descriptor wizard but I just seam to break the pointing functionality. It seams with the the logical max at 127 and min at -127 when I make a step by 1 it is still quite large. I would like to have a few steps between so the functionality is like a normal mouse. Just to clarify I was using the example provided with the CY8CKIT-059. I have search all over but no clear answers.



      Jorden Luke

        • 1. Re: HID mouse X Y resolution

          For a USB HID mouse I believe X and Y are limited to one signed byte (so -127 to 127).


          the X and Y bytes are meant to be a delta. So you are reporting how much the mouse cursor has moved in each direction since the last report.  After this movement data has been reported to the host, the X and Y values should be reset to 0 until more movement occurs.


          If a value of 1/-1 is moving the cursor too quickly, I would have a look at the sensitivity settings in the host OS.

          • 2. Re: HID mouse X Y resolution

            I am running the CE95394 HID Mouse example from Cypress when the code running main is as follows.

            void main()


            CYGlobalIntEnable;                        /* Enable Global Interrupts */

            USBFS_1_Start(0, USBFS_1_DWR_VDDD_OPERATION);   /* Start USBFS Operation/device 0 and with 5V operation */

            while(!USBFS_1_bGetConfiguration());      /* Wait for Device to enumerate */


               USBFS_1_LoadInEP(1, (uint8 *)Mouse_Data, 3); /* Loads an inital value into EP1 and sends it out to the PC */




                    while(!USBFS_1_bGetEPAckState(1));  /* Wait for ACK before loading data */

            USBFS_1_LoadInEP(1, (uint8 *)Mouse_Data, 3); /* Load latest mouse data into EP1 and send to PC */


            switch (Delay){ /* Switch statement creates a state machine for mouse movement */

            case 128:

                            Mouse_Data[1] = 5;  /* Moves mouse to right */

            Mouse_Data[2] = 0;  /* Keeps Y static */


            case 256:

                            Mouse_Data[1] = 0; /* Keeps X static */

            Mouse_Data[2] = -5; /* Moves mouse down */


            case 384:

                            Mouse_Data[1] = -5; /* Moves mouse to left */

            Mouse_Data[2] = 0;  /* Keeps Y static */


            case 512:

                            Mouse_Data[1] = 0;  /* Keeps X static */

                Mouse_Data[2] = 5; /* Moves mouse up */







                    if(Button_1_Read() == 0)    /* Check the button state and load the report with the curren status */


                        Mouse_Data[0] = 0x01;   /* Report button 1 is pressed */




                        Mouse_Data[0] = 0x00;   /* Report button 1 is not pressed */







            This moves the pointer around the screen in a square about fairly large. I have changed it to 1  and -1, it still isn't as fine as the mouse I use on the desktop. When I run this code it doesn't give me options on the computer to change the sensitivity of this mouse just the optical mouse I am using.  Setting the code to 127 and -127 make it jump from corner to corner of the screen. I have seen on other forums where they have changed to the descriptor values and made it work for other platforms I just can't seam to get that one to work here.

            • 3. Re: HID mouse X Y resolution

              Bear in mind that in that example code, it is sending each direction 128 times before it switches to another.  change the case statements to smaller increments (say, 32,64,128,256) and you will get less distance covered on each axis.

              • 4. Re: HID mouse X Y resolution

                Holy Cow How did I miss that?!! I feel kind of dumb. I was about to make you explain till I noted where the Load function is being called. Ok Yeah I guess I need to hand trace the code a bit better. LOL. Thanks for your help  I see what is going on now. Now I just have to think about this this going forward.


                Thanks KTrenholm_19552 for the simple insight.