Why Raspberry Pi Pico (RP2040) is replacing Arduino Leonardo for hardware mouse control:
- Dual Cortex-M0+ cores running at 133MHz (5x faster than 16MHz ATmega32U4).
- Hardware USB Controller supports custom TinyUSB HID descriptors.
- 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:
#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);
}
}