We often point out the Raspberry Pi's beautiful relationship with gaming—especially retro gaming. But we never expected retro gaming on the Raspberry Pi to be like this. Maker and developer Guy Dupont is at it again, this time using an RP2040 to play a game of Pong on the firmware of his mouse.
You're not alone if you're wondering how to play a game with mouse firmware. The way Dupont has pulled this off is fascinating and impressive. In a nutshell, it moves the cursor rapidly to generate a "persistence of vision," which is essentially an illusion that makes the cursor appear in multiple locations at once. The RP2040 hosts the game by intercepting the mouse input to the PC.
Dupont programmed a few controls to operate the game, but it also functions like a regular mouse when not used to simulate Pong. The Pong game has a scorekeeping system but doesn't represent the score using numbers. Instead, the cursor will appear closer to the winning side after a point is scored. The cursor will move closer and closer to the winning side as the score increases but rest in the middle of the score when tied.
Dupont was kind enough to share details on how the project goes together and what you can do to recreate it at home. You don't need a special mouse; Dupont is using a generic HP mouse. You'll need an RP2040 board with a second USB port, but if you aren't sure where to start, Dupon recommends an Adafruit Feather RP2040 with a USB Host.
Because he's using the Adafruit Feather RP2040, he programmed it using the TinyUSB Arduino Library. That said, your mileage may vary if you choose to use a different board. The complete source code for the project is available at Github.