GitHub

Fox Red Labs / Builds / Smart home and radio

Press the LaunchPad's two buttons and a Mac sees a game controller

An CC2340R5 advertises as a Bluetooth LE gamepad.

MediumNo wiring1 evening (estimate, not timed)

The reader page replaying the Mac's recorded capture of 15 button changes: buttons 1 and 2 light in turn, then together. 13 seconds, no sound. Open the reader to see your own board's presses.

Parts and steps

You need

  1. Build the live gamepad image.TERMINAL

    Build the image with the two buttons switched on. LIVE=1 names the board CC2340R5 Gamepad and sends BTN-1 and BTN-2 as buttons 1 and 2. Without it the build sends the library's fixed test pattern as ESP32 BLE Gamepad. The script only builds; it never flashes.

    LIVE=1 bash ports/esp32-ble-gamepad/boards/cc2340r5/build.sh

    You should see: The last line is built: .../basic_ble.hex (NOT flashed).

  2. Flash the .hex without verify.TERMINAL

    Clip the probe onto the board, plug it into the Mac, and flash the .hex from the cc2340r5 folder (cd cc2340r5). Leave out -v: on CC23xx, verify reads the boot configuration area and reports Values at address 0x4E020750 do not match. Do not flash the .bin. SWD is the debug connection the probe uses. This command is assembled from the board's flash line and this build's output path.

    /Applications/ti/uniflash_9.6.0/dslite.sh --mode flash -c CC2340R5.ccxml -f -u ../ports/esp32-ble-gamepad/boards/cc2340r5/build/freertos/ticlang/basic_ble.hex

    You should see: UniFlash reports success and the board restarts as a Bluetooth gamepad (flash time not recorded for this image).

  3. Pair, and accept the prompt.COMPUTER

    On a Mac, open System Settings, Bluetooth, and press Connect beside CC2340R5 Gamepad. Accept the pairing request when it appears. Then open System Settings, Game Controllers.

    System Settings, Game Controllers on a Mac: CC2340R5 Gamepad listed with a green Connected status

    You should see: Bluetooth shows CC2340R5 Gamepad as Connected, and Game Controllers lists it with a green Connected status, as in the picture, with no driver or app installed.

  4. Open the reader page.BROWSER

    In a new terminal at the repository root, serve the site folder and open the reader page (site/bench/gamepad.html) in Chrome or Edge. The browser hands a gamepad to a page only after a button press, so press BTN-1 once with the page open. No gamepad? The page's Replay the capture button plays the Mac's recorded run.

    python3 -m http.server 8000 --directory site open -a "Google Chrome" http://localhost:8000/bench/gamepad.html

    You should see: The page shows a drawn controller and, once it sees the gamepad, its name. The reader page lists every change it sees.

  5. Press BTN-1 and BTN-2.LAUNCHPAD

    Press BTN-1, then BTN-2, then both together.

    You should see: Checked by eye: button 1 lit red in the reader while BTN-1 was down, button 2 while BTN-2 was down, and both for both. A HID report logger on the Mac received reports starting 03 01, 03 02 and 03 03 for these three states and 03 00 on release (03 is the report ID, the second byte the button bitmask).

Or hand it to a coding assistant

Paste this in a terminal. It hands off to an AI assistant.

git clone --depth 1 --filter=blob:none https://github.com/Fox-Red-Labs/fox-red-labs.git && cd fox-red-labs ./start.sh cc2340r5 ble-gamepad --assistant claude

It runs the steps above and reports what it saw.

Not Claude Code? Copy this prompt instead.
Clone https://github.com/Fox-Red-Labs/fox-red-labs and read cc2340r5/AGENTS.md first. Then run Make a Bluetooth game controller from a LaunchPad on my LP-EM-CC2340R5, following docs/builds/ble-gamepad.md. Tell me when to plug in a board and what you saw at each step.

Make it yours

With an AI assistant

In ports/esp32-ble-gamepad/boards/cc2340r5/board/hid_gamepad.c, change the LIVE build so BTN-2 sends gamepad button 3 instead of button 2. Then rebuild it with LIVE=1 and tell me the flash command, but do not flash the board.

You should see: After you flash and pair again, BTN-2 lights button 3 in the reader instead of button 2.

By hand

Open ports/esp32-ble-gamepad/boards/cc2340r5/board/hid_gamepad.c. In HidGp_loopStep (the FRL_LIVE branch) change frl_gp_press(&loopGp, FRL_BUTTON_2) and frl_gp_release(&loopGp, FRL_BUTTON_2) to use 3, then run steps 1 and 2 again.

You should see: BTN-2 lights button 3 in the reader.

If something goes wrong

make stops at once with sysconfig_cli.sh: not foundName your folders on the same line, for example SDK=<sdk folder> SYSCFG=<sysconfig_cli.sh> CLANG=<ti-cgt-armllvm folder> LIVE=1 bash ports/esp32-ble-gamepad/boards/cc2340r5/build.sh.
You see Error -615 or The target failed to see a correctly formatted SWD headerPress the probe firmly onto the board's debug pins and replug USB.
You see Values at address 0x4E020750 do not matchYou flashed the .bin or used -v; flash the .hex without -v.
The connect hangs about 30 seconds and then dropsThe pairing was not accepted: macOS waits out a 30 s timeout and passes no input. Remove the device and connect again, and accept the request this time.
The page says No gamepad yetPress a button once with the page in front: the browser reveals a gamepad only after input. Use Chrome or Edge.
More troubleshooting
Nothing lightsCheck the board shows as Connected in Bluetooth settings, then press a button once with the reader in front.
The Mac still shows button 2It is running the old image: confirm the flash finished and remove and pair the device again.

Every fix for this board: the FAQ.

What to build next

Every build. The code for all of them is in the GitHub repository.

Evidence and limitsThe CC2340R5's two buttons reached a Mac as game-controller input: 15 of 15 button changes received, with the same report bytes as the ESP32 library. Ran on 1 board. Results, sources, timing and limits.

Expected result: After flashing and accepting the pairing request, a Mac lists the LaunchPad under Game Controllers and receives BTN-1 and BTN-2 as buttons 1 and 2 of a gamepad.

What this shows

  • A LaunchPad can be a Bluetooth LE game controller: 15 of 15 button changes arrived at a Mac as HID input reports, and macOS lists the board under Game Controllers with no driver.
  • The report bytes are the ESP32-BLE-Gamepad library's: the default build's 96-byte descriptor (the report layout the gamepad announces to the host) and four test reports match the library's output on an ESP32-C6, 5 of 5 lines; the LIVE build was not re-run against it.
What this does not establish, and limits

What this does not establish

  • Latency and battery life were not measured.

Limits to keep in mind

  • Only the two buttons are live; the report also has joystick axes and a directional pad (hat) that nothing moves.
  • Pairing has to be accepted once, or macOS waits a 30 s timeout and receives no input.
  • The reader page's live view was checked by eye once, in Chrome, and not recorded.
  • Only macOS 15.7.9 on one Intel Mac was tried. Windows, Linux, Android and iOS are not tested, and the reader page needs Chrome or Edge.
  • Whether pairing survives a reflash was not tested. The step 6 change is untested.

Sources

Why this board

It has a Bluetooth LE radio and two user buttons on the board.

Versions, sizes and timing

Button changes received by the Mac15 of 15, reports 03 01, 03 02, 03 03, 03 00
Report bytes against the ESP32-C6 library outputdescriptor and 4 test reports, 5 of 5 lines identicalESP32 Bluetooth gamepad port matrix notes
Image size (default build; the LIVE build's size was not recorded)189.4 kB flash; 33.8 kB of 36 kB static RAMREADME notes
Button read interval20 ms, one notification per changethe source
SoftwareSimpleLink Low Power F3 SDK 9.21.00.36, TI Arm Clang 5.1.1.LTS, SysConfig 1.28.0, Intel Mac, macOS 15.7.9README notes

Evidence

  • On 2026-10-20 a Mac paired with the board as CC2340R5 Gamepad and listed it under Game Controllers with no driver. Fifteen button changes (each button alone, then both) arrived as input reports on the Mac's HID interface, 15 of 15, none missed.
  • The report bytes match the ESP32-BLE-Gamepad library's own output on an ESP32-C6: the 96-byte descriptor and four test reports, 5 of 5 lines identical. ESP32 Bluetooth gamepad port matrix notes
  • On 2026-10-20 the reader page open in Chrome lit buttons 1 and 2 as BTN-1 and BTN-2 were pressed. Checked by eye; no recording. the page

Other boards

What the status words mean

Works ran here and did what it shouldCould work some of it ran; real porting effort is left; hover for whatNot for this chip the chip or its vendor software cannot; hover for why

Result grid

Project
LP-MSPM0G3507MSPM0G3507 chip
LP-MSPM0L1306MSPM0L1306 chip
LP-EM-CC2340R5CC2340R52 chip
LAUNCHXL-F2800137TMS320F2800137 chip
Make a Bluetooth game controller from a LaunchPad
LP-MSPM0G3507Not for this chipNo radio
LP-MSPM0L1306Not for this chipNo radio
LP-EM-CC2340R5WorksBoth buttons reached a Mac as game-controller input: 15 of 15 button changes received, none missed
LAUNCHXL-F2800137Not for this chipNo radio on this chip

Works ran here and did what it shouldShould work it builds; only naming, packaging or build glue is in the way; hover for whichCould work some of it ran; real porting effort is left; hover for whatNot for this chip the chip or its vendor software cannot; hover for why

Experiments (1)

StatusWhat was triedResult
WorksDoes a popular ESP32 Bluetooth gamepad library carry over to TI, ST and C2000 boards, and on which boards does it give the same bytes?
ESP32-C6-DevKitC-1, MSPM0 G3519, NUCLEO-U083RC, LAUNCHXL-F2800137, CC2340R5, 2026-10-19
The report core of ESP32-BLE-Gamepad gives the same descriptor and report bytes on the ESP32-C6, the MSPM0 G3519, the NUCLEO-U083RC, the LAUNCHXL-F2800137 and the CC2340R5 (5 of 5 lines each); on the CC2340R5...

Source files

Code brought from elsewhere

This project uses code that was written for other chips or tools. Each links to how to get it running.

Start with your code, and the prompt to port your own

Get the code and tell us how it wentThe clone command, the board folder with its AGENTS.md, reports from others, and the three report forms.

Get the code

Clone the repository and open the board's folder below. AGENTS.md is a plain text file of notes for AI coding assistants, and llms.txt at the root indexes the site for one.

git clone https://github.com/Fox-Red-Labs/fox-red-labs.git

Code is BSD-3-Clause, writing is CC BY 4.0; third-party folders keep their own licenses.

Built it? Tell us

Built this, or got stuck? Report it on GitHub with a few short answers. Your report shows here in your words, marked as yours. A failure that repeats on the bench gets its fix here.