Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for PXP-Gamepad pcb #1098

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
GP2040_BOARDCONFIG: [ARCController, Blank, Pico, PicoW, BentoBox, ergoSHIFTRev2, FightboardV3, FightboardV3Mirrored, FlatboxRev4, FlatboxRev5, FlatboxRev5RGB, FlatboxRev5USBPassthrough, FlatboxRev5Southpaw, Granola, KB2040, KeyboardConverter, Haute42COSMOX, Liatris, MavercadeRev1, MavercadeRev2, MiSTercadeV2, OpenCore0, OpenCore0WASD, PicoAnn, PicoFightingBoard, RanaTadpole, ReflexCtrlGenesis6, ReflexCtrlNES, ReflexCtrlSaturn, ReflexCtrlSNES, ReflexCtrlVB, ReflexEncodeV1.2, ReflexEncodeV2.0, RP2040AdvancedBreakoutBoard, RP2040AdvancedBreakoutBoardUSBPassthrough, RP2040MiniBreakoutBoard, SparkFunProMicro, WaveshareZero, Stress, SGFDevices, ZeroRhythm]
GP2040_BOARDCONFIG: [ARCController, Blank, Pico, PicoW, BentoBox, ergoSHIFTRev2, FightboardV3, FightboardV3Mirrored, FlatboxRev4, FlatboxRev5, FlatboxRev5RGB, FlatboxRev5USBPassthrough, FlatboxRev5Southpaw, Granola, KB2040, KeyboardConverter, Haute42COSMOX, Liatris, MavercadeRev1, MavercadeRev2, MiSTercadeV2, OpenCore0, OpenCore0WASD, PicoAnn, PicoFightingBoard, PXPGamepad, RanaTadpole, ReflexCtrlGenesis6, ReflexCtrlNES, ReflexCtrlSaturn, ReflexCtrlSNES, ReflexCtrlVB, ReflexEncodeV1.2, ReflexEncodeV2.0, RP2040AdvancedBreakoutBoard, RP2040AdvancedBreakoutBoardUSBPassthrough, RP2040MiniBreakoutBoard, SparkFunProMicro, WaveshareZero, Stress, SGFDevices, ZeroRhythm]

steps:
#Global Setup
Expand Down
79 changes: 79 additions & 0 deletions configs/PXPGamepad/BoardConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: Copyright (c) 2024 OpenStickCommunity (gp2040-ce.info)
*/

#ifndef PXPGAMEPAD_CONFIG_H_
#define PXPGAMEPAD_CONFIG_H_

#include "enums.pb.h"
#include "class/hid/hid.h"

#define BOARD_CONFIG_LABEL "PXP-Gamepad"

// Main pin mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define GPIO_PIN_02 GpioAction::BUTTON_PRESS_UP // UP | UP | UP | UP | UP | UP |
#define GPIO_PIN_03 GpioAction::BUTTON_PRESS_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define GPIO_PIN_04 GpioAction::BUTTON_PRESS_RIGHT // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define GPIO_PIN_01 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 |
#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 |
#define GPIO_PIN_15 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 |
#define GPIO_PIN_00 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 |
#define GPIO_PIN_12 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 |
#define GPIO_PIN_14 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 |
#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 |
#define GPIO_PIN_05 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 |
#define GPIO_PIN_09 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin |
#define GPIO_PIN_10 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start |
#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS |
#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS |

// Keyboard Mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define KEY_DPAD_UP HID_KEY_ARROW_UP // UP | UP | UP | UP | UP | UP |
#define KEY_DPAD_DOWN HID_KEY_ARROW_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define KEY_DPAD_RIGHT HID_KEY_ARROW_RIGHT // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define KEY_DPAD_LEFT HID_KEY_ARROW_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define KEY_BUTTON_B1 HID_KEY_SHIFT_LEFT // B1 | A | B | Cross | 2 | K1 |
#define KEY_BUTTON_B2 HID_KEY_Z // B2 | B | A | Circle | 3 | K2 |
#define KEY_BUTTON_R2 HID_KEY_X // R2 | RT | ZR | R2 | 8 | K3 |
#define KEY_BUTTON_L2 HID_KEY_V // L2 | LT | ZL | L2 | 7 | K4 |
#define KEY_BUTTON_B3 HID_KEY_CONTROL_LEFT // B3 | X | Y | Square | 1 | P1 |
#define KEY_BUTTON_B4 HID_KEY_ALT_LEFT // B4 | Y | X | Triangle | 4 | P2 |
#define KEY_BUTTON_R1 HID_KEY_SPACE // R1 | RB | R | R1 | 6 | P3 |
#define KEY_BUTTON_L1 HID_KEY_C // L1 | LB | L | L1 | 5 | P4 |
#define KEY_BUTTON_S1 HID_KEY_5 // S1 | Back | Minus | Select | 9 | Coin |
#define KEY_BUTTON_S2 HID_KEY_1 // S2 | Start | Plus | Start | 10 | Start |
#define KEY_BUTTON_L3 HID_KEY_EQUAL // L3 | LS | LS | L3 | 11 | LS |
#define KEY_BUTTON_R3 HID_KEY_MINUS // R3 | RS | RS | R3 | 12 | RS |
#define KEY_BUTTON_A1 HID_KEY_9 // A1 | Guide | Home | PS | 13 | ~ |
#define KEY_BUTTON_A2 HID_KEY_F2 // A2 | ~ | Capture | ~ | 14 | ~ |
#define KEY_BUTTON_FN -1 // Hotkey Function |

// Setting GPIO pins to assigned by add-on
//
#define GPIO_PIN_26 GpioAction::ASSIGNED_TO_ADDON
#define GPIO_PIN_27 GpioAction::ASSIGNED_TO_ADDON
#define GPIO_PIN_28 GpioAction::ASSIGNED_TO_ADDON
#define GPIO_PIN_29 GpioAction::ASSIGNED_TO_ADDON

// Analog Configuration
//
#define ANALOG_INPUT_ENABLED 1
#define ANALOG_ADC_1_VRX 27
#define ANALOG_ADC_1_VRY 26
#define ANALOG_ADC_1_MODE DPAD_MODE_LEFT_ANALOG
#define ANALOG_ADC_1_INVERT INVERT_X
#define ANALOG_ADC_2_VRX 29
#define ANALOG_ADC_2_VRY 28
#define ANALOG_ADC_2_MODE DPAD_MODE_RIGHT_ANALOG
#define ANALOG_ADC_2_INVERT INVERT_X
#define FORCED_CIRCULARITY_ENABLED 0
#define DEFAULT_INNER_DEADZONE 5
#define DEFAULT_OUTER_DEADZONE 50
#define AUTO_CALIBRATE_ENABLED 1


#endif
3 changes: 3 additions & 0 deletions configs/PXPGamepad/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GP2040 Configuration for the PXP-Gamepad

https://github.com/MegaBitmap/PXP-Gamepad
86 changes: 86 additions & 0 deletions configs/PXPGamepad/pxpgamepad.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------


#ifndef _BOARDS_PXPGAMEPAD_H
#define _BOARDS_PXPGAMEPAD_H

// For board detection
#define PXPGAMEPAD

//For crappy crystal
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
#endif

// --- UART ---
#ifndef PICO_DEFAULT_UART
#define PICO_DEFAULT_UART 0
#endif
#ifndef PICO_DEFAULT_UART_TX_PIN
#define PICO_DEFAULT_UART_TX_PIN 0
#endif
#ifndef PICO_DEFAULT_UART_RX_PIN
#define PICO_DEFAULT_UART_RX_PIN 1
#endif

// // no onboard LED

// no PICO_DEFAULT_WS2812_PIN

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 0
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 4
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 5
#endif

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 16
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 17
#endif

// --- FLASH ---

#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
#endif

// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
#define PICO_SMPS_MODE_PIN 23

#ifndef PICO_RP2040_B0_SUPPORTED
#define PICO_RP2040_B0_SUPPORTED 1
#endif

#endif