Developer knowledge network ยท moderated exchange

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Knowledge indexLive
4Categories
919Threads
2.8KPosts
Guide

Hardware USB mouse delta packet emulation with Raspberry Pi Pico

colorbot_crafter
Hardware Modder
MEMBER
Rep: 126
Join Date: Mar 2021
Posts: 14
Thanks: 78
1 months ago ยท Jun 29, 2026 8:39 PM
#1

Why Raspberry Pi Pico (RP2040) is replacing Arduino Leonardo for hardware mouse control:

  1. Dual Cortex-M0+ cores running at 133MHz (5x faster than 16MHz ATmega32U4).
  2. Hardware USB Controller supports custom TinyUSB HID descriptors.
  3. UART / Serial baud rate supports up to 921,600 baud, reducing serial packet latency from 4ms down to 0.1ms.

Code snippet in C with TinyUSB:

C
#include "tusb.h"
void send_mouse_delta(int8_t dx, int8_t dy, uint8_t buttons) {
    if (tud_hid_ready()) {
        tud_hid_mouse_report(0, buttons, dx, dy, 0, 0);
    }
}
dma_ghost
DMA Guru
MEMBER
Rep: 115
Join Date: Jan 2020
Posts: 12
Thanks: 83
1 months ago ยท Jun 30, 2026 12:52 AM
#2

RP2040 is awesome. You can also spoof the USB string descriptors (Manufacturer, Product, Serial) in flash memory.

val_driver_guy
Driver Dev
MEMBER
Rep: 42
Join Date: May 2019
Posts: 24
Thanks: 37
1 months ago ยท Jun 30, 2026 11:03 AM
#3

0.1ms transfer latency is huge. Completely eliminates input delay on fast flicks.