Skip to content

Commit

Permalink
Merge pull request #17 from fhoedemakers/USB
Browse files Browse the repository at this point in the history
Support for more usb input devices
  • Loading branch information
fhoedemakers authored Oct 25, 2024
2 parents c993063 + 1571d70 commit 4e98536
Show file tree
Hide file tree
Showing 12 changed files with 544 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildandrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
releases/${{ env.APP_NAME }}WsRP2040PiZero.uf2
releases/pico2_${{ env.APP_NAME }}AdaFruitDVISD.uf2
releases/pico2_${{ env.APP_NAME }}PimoroniDV.uf2
PCB/pico_nesPCB_v2.0.zip
PCB/pico_nesPCB_v2.1.zip
body_path: CHANGELOG.md


3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "pico_lib"]
path = pico_lib
url = https://github.com/fhoedemakers/pico_lib.git
[submodule "tusb_xinput"]
path = tusb_xinput
url = https://github.com/fhoedemakers/tusb_xinput.git
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,44 @@ Binaries are at the end of this page.
- pico2_picosmsPlusimoroniDV.uf2: Pimoroni Pico DV Demo Base with Pico 2/RP2350
- pico_nesPCB_v20.zip: PCB Design. For more info see the [Pico-InfonesPlus sister project](https://github.com/fhoedemakers/pico-infonesPlus#pcb-with-raspberry-pi-pico-or-pico-2).

3D-printed case design for PCB: [https://www.thingiverse.com/thing:6689537](https://www.thingiverse.com/thing:6689537).
For the latest two player PCB 2.0, you need:

- Top_v2.0_with_Bootsel_Button.stl. This allows for software upgrades without removing the cover. (*)
- Base_v2.0.stl
- Power_Switch.stl.

(*) in case you don't want to access the bootsel button on the Pico, you can choose Base_v2.0.stl

3D-printed case design for Waveshare RP2040-PiZero: [https://www.thingiverse.com/thing:6758682](https://www.thingiverse.com/thing:6758682)

# Release notes

## v0.12

### Features

- Add support for these USB gamepads:
- Sega Mega Drive/Genesis Mini 1 and Mini 2 controllers.
- PlayStation Classic controller.
- Mantapad, cheap [NES](https://nl.aliexpress.com/w/wholesale-nes-controller-usb.html?spm=a2g0o.home.search.0) and [SNES](https://nl.aliexpress.com/w/wholesale-snes-controller-usb.html?spm=a2g0o.productlist.search.0) USB controllers from AliExpress. When starting a game, it is possible you have to unplug and replug the controller to get it working.
- XInput controllers like Xbox 360 and Xbox One controllers. 8bitdo controllers are also XInput controllers and should work. Hold X + Start to switch to XInput mode. (LED 1 and 2 will blink). For Xbox controllers, remove the batteries before connecting the USB cable. Playing with batteries in the controller will work, but can cause the controller to stop working. Sometimes the controller will not work after flashing a game. In that case, unplug the controller and plug it back in. In case of 8bitdo controllers, unplug the controller, hold start to turn it off, then plug it back in. This will make the controller work again.
- Add USB keyboard support:
- A: Select
- S: Start
- Z: B
- X: A
- Cursor keys: D-pad
- When an USB device is connected, the device type is shown at the bottom of the menu. Unsupported devices show as xxxx:xxxx.
- Minor cosmetic changes to the menu system.
- Minor changes in PCB design (pico_nesPCB_v2.1.zip)
- D3 and D4 of NES controller port 2 are connected to GPIO28 (D3) and GPIO27 (D4), for possible future zapper use.
- More ground points are added.

XInput driver: https://github.com/Ryzee119/tusb_XInput by [Ryzee119](https://github.com/Ryzee119) When building from source, make sure you do a **git submodule update --init** from within the source folder to get the XInput driver.

For more details, see the [README](https://github.com/fhoedemakers/pico-infonesPlus/blob/main/README.md#gamecontroller-support) and [troubleshooting](https://github.com/fhoedemakers/pico-infonesPlus/blob/main/README.md#troubleshooting-usb-controllers) section

## v0.11

### Features
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ PRIVATE
tinyusb_host
dvi
util
xinput_host
)

target_include_directories(${projectname}
Expand All @@ -215,6 +216,7 @@ add_subdirectory(drivers/fatfs)
add_subdirectory(drivers/sdcard)
add_subdirectory(pico_lib/dvi)
add_subdirectory(pico_lib/util)
add_subdirectory(tusb_xinput xinput_host)
pico_add_extra_outputs(${projectname})


Expand Down
Binary file added PCB/pico_nesPCB_v2.1.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace io
uint8_t axis[3]{0x80, 0x80, 0x80};
Hat hat{Hat::RELEASED};
uint32_t buttons{0};

char GamePadName[20]{};
public:
void convertButtonsFromAxis(int axisX, int axisY);
void convertButtonsFromHat();
Expand All @@ -54,4 +54,4 @@ namespace io
GamePadState &getCurrentGamePadState(int i);
}

#endif /* _510036F3_0134_6411_4376_A918ACA8AC4C */
#endif /* _510036F3_0134_6411_4376_A918ACA8AC4C */
Loading

0 comments on commit 4e98536

Please sign in to comment.