diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4c90a36f8..135856cce 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -50,6 +50,7 @@ on: - OSUMGP-RP2040 - PicoAnn - PicoFightingBoard + - PimoroniPicoPlus2 - PXPGamepad - ReflexCtrlGenesis6 - ReflexCtrlNES @@ -76,15 +77,25 @@ env: jobs: call-node-workflow: uses: ./.github/workflows/node.js.yml + build-config-list: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v6.0.1 + - id: set-matrix + run: | + CONFIG_DIRS=$(ls -d ./configs/*/ | cut -f3 -d'/' | jq -R -s -c 'split("\n")[:-1]') + echo "matrix=$CONFIG_DIRS" >> $GITHUB_OUTPUT build: - needs: call-node-workflow + needs: [call-node-workflow, build-config-list] # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-22.04 strategy: matrix: - GP2040_BOARDCONFIG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.board_config != '' && fromJSON(format('["{0}"]', github.event.inputs.board_config)) || fromJSON('["ARCController", "ASiLVLABC", "ASiLVLWASD", "Blank", "Pico", "PicoW", "Pico2", "BentoBox", "FlatboxRev4", "FlatboxRev5", "FlatboxRev5RGB", "FlatboxRev5USBPassthrough", "FlatboxRev5Southpaw", "FlatboxRev8", "Granola", "GranolaBeacon", "KB2040", "KeyboardConverter", "Haute42COSMOX", "Haute42COSMOXCAS", "Haute42COSMOXCAT", "Haute42COSMOXMLite", "Haute42COSMOXMUltra", "Haute42COSMOXXAnalog", "Liatris", "MavercadeRev1", "MavercadeRev2", "MavercadeRev3", "MiSTercadeV2", "OpenCore0", "OpenCore0MIXUP", "OpenCore0WASD", "OSUMGP-RP2040", "PicoAnn", "PicoFightingBoard", "PXPGamepad", "ReflexCtrlGenesis6", "ReflexCtrlNES", "ReflexCtrlSaturn", "ReflexCtrlSNES", "ReflexCtrlVB", "ReflexEncodeV1.2", "ReflexEncodeV2.0", "RP2040AdvancedBreakoutBoard", "RP2040AdvancedBreakoutBoardUSBPassthrough", "RP2040MiniBreakoutBoard", "RP2040MiniBreakoutBoardUSBPassthrough", "SeeedXIAORP2040", "SparkFunProMicro", "SparkFunProMicroRP2350", "WaveshareZero", "Stress", "SGFDevices", "ZeroRhythm"]') }} + GP2040_BOARDCONFIG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.board_config != '' && fromJSON(format('["{0}"]', github.event.inputs.board_config)) || fromJSON(needs.build-config-list.outputs.matrix) }} steps: - name: Setup cmake uses: jwlawson/actions-setup-cmake@v2 diff --git a/configs/PimoroniPicoPlus2/BoardConfig.h b/configs/PimoroniPicoPlus2/BoardConfig.h new file mode 100644 index 000000000..1b6bd05a9 --- /dev/null +++ b/configs/PimoroniPicoPlus2/BoardConfig.h @@ -0,0 +1,98 @@ +/* + * SPDX-License-Identifier: MIT + * SPDX-FileCopyrightText: Copyright (c) 2024 OpenStickCommunity (gp2040-ce.info) + */ + +#ifndef PICO_PLUS_2_BOARD_CONFIG_H_ +#define PICO_PLUS_2_BOARD_CONFIG_H_ + +#include "enums.pb.h" +#include "class/hid/hid.h" + +#define BOARD_CONFIG_LABEL "PimoroniPicoPlus2" + +// 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_05 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | +#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 | +#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 | +#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 | +#define GPIO_PIN_09 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 | +#define GPIO_PIN_10 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 | +#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 | +#define GPIO_PIN_12 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 | +#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 | +#define GPIO_PIN_16 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin | +#define GPIO_PIN_17 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start | +#define GPIO_PIN_18 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS | +#define GPIO_PIN_19 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS | +#define GPIO_PIN_20 GpioAction::BUTTON_PRESS_A1 // A1 | Guide | Home | PS | 13 | ~ | +#define GPIO_PIN_21 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ | + +// Setting GPIO pins to assigned by add-on +// +#define GPIO_PIN_00 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_01 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_15 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_28 GpioAction::ASSIGNED_TO_ADDON + +// 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 | + +#define TURBO_ENABLED 1 +#define GPIO_PIN_14 GpioAction::BUTTON_PRESS_TURBO +#define TURBO_LED_PIN 15 + +#define BOARD_LEDS_PIN 28 +#define LED_BRIGHTNESS_MAXIMUM 100 +#define LED_BRIGHTNESS_STEPS 5 +#define LED_FORMAT LED_FORMAT_GRB +#define LEDS_PER_PIXEL 1 + +#define LEDS_DPAD_LEFT 0 +#define LEDS_DPAD_DOWN 1 +#define LEDS_DPAD_RIGHT 2 +#define LEDS_DPAD_UP 3 +#define LEDS_BUTTON_B3 4 +#define LEDS_BUTTON_B4 5 +#define LEDS_BUTTON_R1 6 +#define LEDS_BUTTON_L1 7 +#define LEDS_BUTTON_B1 8 +#define LEDS_BUTTON_B2 9 +#define LEDS_BUTTON_R2 10 +#define LEDS_BUTTON_L2 11 +#define LEDS_BUTTON_A1 12 +#define LEDS_BUTTON_L3 13 +#define LEDS_BUTTON_R3 14 +#define LEDS_BUTTON_A2 15 + +#define HAS_I2C_DISPLAY 1 +#define I2C0_ENABLED 1 +#define I2C0_PIN_SDA 0 +#define I2C0_PIN_SCL 1 +#define BUTTON_LAYOUT BUTTON_LAYOUT_STICKLESS +#define BUTTON_LAYOUT_RIGHT BUTTON_LAYOUT_STICKLESSB + +#endif \ No newline at end of file diff --git a/configs/PimoroniPicoPlus2/PimoroniPicoPlus2.cmake b/configs/PimoroniPicoPlus2/PimoroniPicoPlus2.cmake new file mode 100644 index 000000000..2e1434c43 --- /dev/null +++ b/configs/PimoroniPicoPlus2/PimoroniPicoPlus2.cmake @@ -0,0 +1,2 @@ +set(PICO_BOARD pimoroni_pico_plus2_rp2350) +set(PICO_PLATFORM rp2350-arm-s) \ No newline at end of file diff --git a/configs/PimoroniPicoPlus2/README.md b/configs/PimoroniPicoPlus2/README.md new file mode 100644 index 000000000..11ba5829c --- /dev/null +++ b/configs/PimoroniPicoPlus2/README.md @@ -0,0 +1,28 @@ +# GP2040 Configuration for Pimoroni Pico Plus 2 + +![Pin Mapping](assets/PimoroniPicoPlus2.png) + +Basic pin setup for a stock [Pimoroni Pico Plus 2](https://shop.pimoroni.com/products/pimoroni-pico-plus-2?variant=42092668289107). Combine with a simple GPIO breakout/screw terminal board for an easy DIY arcade stick. + +## Main Pin Mapping Configuration + +| RP2040 Pin | Action | GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade | +|------------|-------------------------------|--------|--------|--------|----------|--------|--------| +| GPIO_PIN_02| GpioAction::BUTTON_PRESS_UP | UP | UP | UP | UP | UP | UP | +| GPIO_PIN_03| GpioAction::BUTTON_PRESS_DOWN | DOWN | DOWN | DOWN | DOWN | DOWN | DOWN | +| GPIO_PIN_04| GpioAction::BUTTON_PRESS_RIGHT| RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | +| GPIO_PIN_05| GpioAction::BUTTON_PRESS_LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | +| GPIO_PIN_06| GpioAction::BUTTON_PRESS_B1 | B1 | A | B | Cross | 2 | K1 | +| GPIO_PIN_07| GpioAction::BUTTON_PRESS_B2 | B2 | B | A | Circle | 3 | K2 | +| GPIO_PIN_08| GpioAction::BUTTON_PRESS_R2 | R2 | RT | ZR | R2 | 8 | K3 | +| GPIO_PIN_09| GpioAction::BUTTON_PRESS_L2 | L2 | LT | ZL | L2 | 7 | K4 | +| GPIO_PIN_10| GpioAction::BUTTON_PRESS_B3 | B3 | X | Y | Square | 1 | P1 | +| GPIO_PIN_11| GpioAction::BUTTON_PRESS_B4 | B4 | Y | X | Triangle | 4 | P2 | +| GPIO_PIN_12| GpioAction::BUTTON_PRESS_R1 | R1 | RB | R | R1 | 6 | P3 | +| GPIO_PIN_13| GpioAction::BUTTON_PRESS_L1 | L1 | LB | L | L1 | 5 | P4 | +| GPIO_PIN_16| GpioAction::BUTTON_PRESS_S1 | S1 | Back | Minus | Select | 9 | Coin | +| GPIO_PIN_17| GpioAction::BUTTON_PRESS_S2 | S2 | Start | Plus | Start | 10 | Start | +| GPIO_PIN_18| GpioAction::BUTTON_PRESS_L3 | L3 | LS | LS | L3 | 11 | LS | +| GPIO_PIN_19| GpioAction::BUTTON_PRESS_R3 | R3 | RS | RS | R3 | 12 | RS | +| GPIO_PIN_20| GpioAction::BUTTON_PRESS_A1 | A1 | Guide | Home | PS | 13 | ~ | +| GPIO_PIN_21| GpioAction::BUTTON_PRESS_A2 | A2 | ~ | Capture| ~ | 14 | ~ | \ No newline at end of file diff --git a/configs/PimoroniPicoPlus2/assets/PimoroniPicoPlus2.png b/configs/PimoroniPicoPlus2/assets/PimoroniPicoPlus2.png new file mode 100644 index 000000000..95597a268 Binary files /dev/null and b/configs/PimoroniPicoPlus2/assets/PimoroniPicoPlus2.png differ diff --git a/configs/WaveshareRP2350BPlusW/BoardConfig.h b/configs/WaveshareRP2350BPlusW/BoardConfig.h new file mode 100644 index 000000000..3aeeb3ea0 --- /dev/null +++ b/configs/WaveshareRP2350BPlusW/BoardConfig.h @@ -0,0 +1,98 @@ +/* + * SPDX-License-Identifier: MIT + * SPDX-FileCopyrightText: Copyright (c) 2024 OpenStickCommunity (gp2040-ce.info) + */ + +#ifndef WAVESHARE_RP2350B_PLUS_W_CONFIG_H_ +#define WAVESHARE_RP2350B_PLUS_W_CONFIG_H_ + +#include "enums.pb.h" +#include "class/hid/hid.h" + +#define BOARD_CONFIG_LABEL "WaveshareRP2350BPlusW" + +// 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_05 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | +#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 | +#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 | +#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 | +#define GPIO_PIN_09 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 | +#define GPIO_PIN_10 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 | +#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 | +#define GPIO_PIN_12 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 | +#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 | +#define GPIO_PIN_16 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin | +#define GPIO_PIN_17 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start | +#define GPIO_PIN_18 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS | +#define GPIO_PIN_19 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS | +#define GPIO_PIN_20 GpioAction::BUTTON_PRESS_A1 // A1 | Guide | Home | PS | 13 | ~ | +#define GPIO_PIN_21 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ | + +// Setting GPIO pins to assigned by add-on +// +#define GPIO_PIN_00 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_01 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_15 GpioAction::ASSIGNED_TO_ADDON +#define GPIO_PIN_42 GpioAction::ASSIGNED_TO_ADDON + +// 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 | + +#define TURBO_ENABLED 1 +#define GPIO_PIN_14 GpioAction::BUTTON_PRESS_TURBO +#define TURBO_LED_PIN 15 + +#define BOARD_LEDS_PIN 42 +#define LED_BRIGHTNESS_MAXIMUM 100 +#define LED_BRIGHTNESS_STEPS 5 +#define LED_FORMAT LED_FORMAT_GRB +#define LEDS_PER_PIXEL 1 + +#define LEDS_DPAD_LEFT 0 +#define LEDS_DPAD_DOWN 1 +#define LEDS_DPAD_RIGHT 2 +#define LEDS_DPAD_UP 3 +#define LEDS_BUTTON_B3 4 +#define LEDS_BUTTON_B4 5 +#define LEDS_BUTTON_R1 6 +#define LEDS_BUTTON_L1 7 +#define LEDS_BUTTON_B1 8 +#define LEDS_BUTTON_B2 9 +#define LEDS_BUTTON_R2 10 +#define LEDS_BUTTON_L2 11 +#define LEDS_BUTTON_A1 12 +#define LEDS_BUTTON_L3 13 +#define LEDS_BUTTON_R3 14 +#define LEDS_BUTTON_A2 15 + +#define HAS_I2C_DISPLAY 1 +#define I2C0_ENABLED 1 +#define I2C0_PIN_SDA 0 +#define I2C0_PIN_SCL 1 +#define BUTTON_LAYOUT BUTTON_LAYOUT_STICKLESS +#define BUTTON_LAYOUT_RIGHT BUTTON_LAYOUT_STICKLESSB + +#endif \ No newline at end of file diff --git a/configs/WaveshareRP2350BPlusW/README.md b/configs/WaveshareRP2350BPlusW/README.md new file mode 100644 index 000000000..7077e69eb --- /dev/null +++ b/configs/WaveshareRP2350BPlusW/README.md @@ -0,0 +1,28 @@ +# GP2040 Configuration for Waveshare RP2350B-Plus-W + +![Pin Mapping](assets/WaveshareRP2350BPlusW.png) + +Basic pin setup for a stock [Waveshare RP2350B-Plus-W](https://www.waveshare.com/wiki/RP2350B-Plus-W). Combine with a simple GPIO breakout/screw terminal board for an easy DIY arcade stick. + +## Main Pin Mapping Configuration + +| RP2040 Pin | Action | GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade | +|------------|-------------------------------|--------|--------|--------|----------|--------|--------| +| GPIO_PIN_02| GpioAction::BUTTON_PRESS_UP | UP | UP | UP | UP | UP | UP | +| GPIO_PIN_03| GpioAction::BUTTON_PRESS_DOWN | DOWN | DOWN | DOWN | DOWN | DOWN | DOWN | +| GPIO_PIN_04| GpioAction::BUTTON_PRESS_RIGHT| RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | +| GPIO_PIN_05| GpioAction::BUTTON_PRESS_LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | LEFT | +| GPIO_PIN_06| GpioAction::BUTTON_PRESS_B1 | B1 | A | B | Cross | 2 | K1 | +| GPIO_PIN_07| GpioAction::BUTTON_PRESS_B2 | B2 | B | A | Circle | 3 | K2 | +| GPIO_PIN_08| GpioAction::BUTTON_PRESS_R2 | R2 | RT | ZR | R2 | 8 | K3 | +| GPIO_PIN_09| GpioAction::BUTTON_PRESS_L2 | L2 | LT | ZL | L2 | 7 | K4 | +| GPIO_PIN_10| GpioAction::BUTTON_PRESS_B3 | B3 | X | Y | Square | 1 | P1 | +| GPIO_PIN_11| GpioAction::BUTTON_PRESS_B4 | B4 | Y | X | Triangle | 4 | P2 | +| GPIO_PIN_12| GpioAction::BUTTON_PRESS_R1 | R1 | RB | R | R1 | 6 | P3 | +| GPIO_PIN_13| GpioAction::BUTTON_PRESS_L1 | L1 | LB | L | L1 | 5 | P4 | +| GPIO_PIN_16| GpioAction::BUTTON_PRESS_S1 | S1 | Back | Minus | Select | 9 | Coin | +| GPIO_PIN_17| GpioAction::BUTTON_PRESS_S2 | S2 | Start | Plus | Start | 10 | Start | +| GPIO_PIN_18| GpioAction::BUTTON_PRESS_L3 | L3 | LS | LS | L3 | 11 | LS | +| GPIO_PIN_19| GpioAction::BUTTON_PRESS_R3 | R3 | RS | RS | R3 | 12 | RS | +| GPIO_PIN_20| GpioAction::BUTTON_PRESS_A1 | A1 | Guide | Home | PS | 13 | ~ | +| GPIO_PIN_21| GpioAction::BUTTON_PRESS_A2 | A2 | ~ | Capture| ~ | 14 | ~ | \ No newline at end of file diff --git a/configs/WaveshareRP2350BPlusW/WaveshareRP2350BPlusW.cmake b/configs/WaveshareRP2350BPlusW/WaveshareRP2350BPlusW.cmake new file mode 100644 index 000000000..b92c9db1c --- /dev/null +++ b/configs/WaveshareRP2350BPlusW/WaveshareRP2350BPlusW.cmake @@ -0,0 +1,2 @@ +set(PICO_BOARD waveshare_rp2350b_plus_w) +set(PICO_PLATFORM rp2350-arm-s) \ No newline at end of file diff --git a/configs/WaveshareRP2350BPlusW/assets/WaveshareRP2350BPlusW.png b/configs/WaveshareRP2350BPlusW/assets/WaveshareRP2350BPlusW.png new file mode 100644 index 000000000..edb7e08ba Binary files /dev/null and b/configs/WaveshareRP2350BPlusW/assets/WaveshareRP2350BPlusW.png differ diff --git a/configs/WaveshareRP2350BPlusW/waveshare_rp2350b_plus_w.h b/configs/WaveshareRP2350BPlusW/waveshare_rp2350b_plus_w.h new file mode 100644 index 000000000..27e010c95 --- /dev/null +++ b/configs/WaveshareRP2350BPlusW/waveshare_rp2350b_plus_w.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2024 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 +// ----------------------------------------------------- + +// This header may be included by other board headers as "boards/waveshare_rp2350_plus_w.h" + +#ifndef _BOARDS_WAVESHARE_RP2350B_PLUS_W +#define _BOARDS_WAVESHARE_RP2350B_PLUS_W + +pico_board_cmake_set(PICO_PLATFORM, rp2350) + +// For board detection +#define WAVESHARE_RP2350B_PLUS_W + +// --- RP2350 VARIANT --- +#define PICO_RP2350A 0 + +// --- 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 + +// --- 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 + +// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (4 * 1024 * 1024) +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) +#endif +// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) +// note the SMSP mode pin is on WL_GPIO1 + +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 +#endif + +#ifndef CYW43_WL_GPIO_LED_PIN +#define CYW43_WL_GPIO_LED_PIN 0 +#endif + +// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS. +// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered. +// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined. +#ifndef CYW43_WL_GPIO_VBUS_PIN +#define CYW43_WL_GPIO_VBUS_PIN 2 +#endif + +// If CYW43_USES_VSYS_PIN is defined then CYW43 uses the VSYS GPIO (defined by PICO_VSYS_PIN) for other purposes. +// If this is the case, to use the VSYS GPIO it's necessary to ensure CYW43 is not using it. +// This can be achieved by wrapping the use of the VSYS GPIO in cyw43_thread_enter / cyw43_thread_exit. +#ifndef CYW43_USES_VSYS_PIN +#define CYW43_USES_VSYS_PIN 1 +#endif + +// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC. +// There is an example in adc/read_vsys in pico-examples. +#ifndef PICO_VSYS_PIN +#define PICO_VSYS_PIN 43 +#endif + +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 +#ifndef PICO_RP2350_A2_SUPPORTED +#define PICO_RP2350_A2_SUPPORTED 1 +#endif + +// cyw43 SPI pins can't be changed at runtime +#ifndef CYW43_PIN_WL_DYNAMIC +#define CYW43_PIN_WL_DYNAMIC 0 +#endif + +// gpio pin to power up the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_REG_ON +#define CYW43_DEFAULT_PIN_WL_REG_ON 36ULL +#endif + +// gpio pin for spi data out to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT +#define CYW43_DEFAULT_PIN_WL_DATA_OUT 37ULL +#endif + +// gpio pin for spi data in from the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN +#define CYW43_DEFAULT_PIN_WL_DATA_IN 37ULL +#endif + +// gpio (irq) pin for the irq line from the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 37ULL +#endif + +// gpio pin for the spi clock line to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_CLOCK +#define CYW43_DEFAULT_PIN_WL_CLOCK 39ULL +#endif + +// gpio pin for the spi chip select to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_CS +#define CYW43_DEFAULT_PIN_WL_CS 38ULL +#endif + +#endif \ No newline at end of file diff --git a/proto/config.proto b/proto/config.proto index 860aaaf3e..2529a2b0f 100644 --- a/proto/config.proto +++ b/proto/config.proto @@ -214,7 +214,7 @@ message GpioMappingInfo message GpioMappings { - repeated GpioMappingInfo pins = 1 [(nanopb).max_count = 30]; + repeated GpioMappingInfo pins = 1 [(nanopb).max_count = 48]; optional string profileLabel = 2 [(nanopb).max_length = 16]; optional bool enabled = 3 [default = false]; } diff --git a/src/config_utils.cpp b/src/config_utils.cpp index df4c67bd2..1aa1bc5a0 100644 --- a/src/config_utils.cpp +++ b/src/config_utils.cpp @@ -269,6 +269,60 @@ #ifndef GPIO_PIN_29 #define GPIO_PIN_29 GpioAction::NONE #endif +#ifndef GPIO_PIN_30 + #define GPIO_PIN_30 GpioAction::NONE +#endif +#ifndef GPIO_PIN_31 + #define GPIO_PIN_31 GpioAction::NONE +#endif +#ifndef GPIO_PIN_32 + #define GPIO_PIN_32 GpioAction::NONE +#endif +#ifndef GPIO_PIN_33 + #define GPIO_PIN_33 GpioAction::NONE +#endif +#ifndef GPIO_PIN_34 + #define GPIO_PIN_34 GpioAction::NONE +#endif +#ifndef GPIO_PIN_35 + #define GPIO_PIN_35 GpioAction::NONE +#endif +#ifndef GPIO_PIN_36 + #define GPIO_PIN_36 GpioAction::NONE +#endif +#ifndef GPIO_PIN_37 + #define GPIO_PIN_37 GpioAction::NONE +#endif +#ifndef GPIO_PIN_38 + #define GPIO_PIN_38 GpioAction::NONE +#endif +#ifndef GPIO_PIN_39 + #define GPIO_PIN_39 GpioAction::NONE +#endif +#ifndef GPIO_PIN_40 + #define GPIO_PIN_40 GpioAction::NONE +#endif +#ifndef GPIO_PIN_41 + #define GPIO_PIN_41 GpioAction::NONE +#endif +#ifndef GPIO_PIN_42 + #define GPIO_PIN_42 GpioAction::NONE +#endif +#ifndef GPIO_PIN_43 + #define GPIO_PIN_43 GpioAction::NONE +#endif +#ifndef GPIO_PIN_44 + #define GPIO_PIN_44 GpioAction::NONE +#endif +#ifndef GPIO_PIN_45 + #define GPIO_PIN_45 GpioAction::NONE +#endif +#ifndef GPIO_PIN_46 + #define GPIO_PIN_46 GpioAction::NONE +#endif +#ifndef GPIO_PIN_47 + #define GPIO_PIN_47 GpioAction::NONE +#endif #define MAX_PROFILES (uint8_t)6 @@ -1243,7 +1297,16 @@ void gpioMappingsMigrationCore(Config& config) GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, - GpioAction::NONE, GpioAction::NONE, GpioAction::NONE}; + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, +#if NUM_BANK0_GPIOS > 32 + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, + GpioAction::NONE, GpioAction::NONE, GpioAction::NONE, +#endif + }; // flag additional pins as being used by an addon not managed here const auto markAddonPinIfUsed = [&](Pin_t gpPin) -> void { @@ -1421,7 +1484,16 @@ void gpioMappingsMigrationCore(Config& config) GPIO_PIN_18, GPIO_PIN_19, GPIO_PIN_20, GPIO_PIN_21, GPIO_PIN_22, GPIO_PIN_23, GPIO_PIN_24, GPIO_PIN_25, GPIO_PIN_26, - GPIO_PIN_27, GPIO_PIN_28, GPIO_PIN_29}; + GPIO_PIN_27, GPIO_PIN_28, GPIO_PIN_29, +#if NUM_BANK0_GPIOS > 32 + GPIO_PIN_30, GPIO_PIN_31, GPIO_PIN_32, + GPIO_PIN_33, GPIO_PIN_34, GPIO_PIN_35, + GPIO_PIN_36, GPIO_PIN_37, GPIO_PIN_38, + GPIO_PIN_39, GPIO_PIN_40, GPIO_PIN_41, + GPIO_PIN_42, GPIO_PIN_43, GPIO_PIN_44, + GPIO_PIN_45, GPIO_PIN_46, GPIO_PIN_47, +#endif + }; // If we didn't import from protobuf, import from boardconfig for(unsigned int i = 0; i < NUM_BANK0_GPIOS; i++) { diff --git a/src/webconfig.cpp b/src/webconfig.cpp index 83a6ef541..1bb779b35 100644 --- a/src/webconfig.cpp +++ b/src/webconfig.cpp @@ -649,6 +649,26 @@ std::string getProfileOptions() writePinDoc(i, "pin27", profileOptions.gpioMappingsSets[i].pins[27]); writePinDoc(i, "pin28", profileOptions.gpioMappingsSets[i].pins[28]); writePinDoc(i, "pin29", profileOptions.gpioMappingsSets[i].pins[29]); +#if NUM_BANK0_GPIOS > 32 + writePinDoc(i, "pin30", profileOptions.gpioMappingsSets[i].pins[30]); + writePinDoc(i, "pin31", profileOptions.gpioMappingsSets[i].pins[31]); + writePinDoc(i, "pin32", profileOptions.gpioMappingsSets[i].pins[32]); + writePinDoc(i, "pin33", profileOptions.gpioMappingsSets[i].pins[33]); + writePinDoc(i, "pin34", profileOptions.gpioMappingsSets[i].pins[34]); + writePinDoc(i, "pin35", profileOptions.gpioMappingsSets[i].pins[35]); + writePinDoc(i, "pin36", profileOptions.gpioMappingsSets[i].pins[36]); + writePinDoc(i, "pin37", profileOptions.gpioMappingsSets[i].pins[37]); + writePinDoc(i, "pin38", profileOptions.gpioMappingsSets[i].pins[38]); + writePinDoc(i, "pin39", profileOptions.gpioMappingsSets[i].pins[39]); + writePinDoc(i, "pin40", profileOptions.gpioMappingsSets[i].pins[40]); + writePinDoc(i, "pin41", profileOptions.gpioMappingsSets[i].pins[41]); + writePinDoc(i, "pin42", profileOptions.gpioMappingsSets[i].pins[42]); + writePinDoc(i, "pin43", profileOptions.gpioMappingsSets[i].pins[43]); + writePinDoc(i, "pin44", profileOptions.gpioMappingsSets[i].pins[44]); + writePinDoc(i, "pin45", profileOptions.gpioMappingsSets[i].pins[45]); + writePinDoc(i, "pin46", profileOptions.gpioMappingsSets[i].pins[46]); + writePinDoc(i, "pin47", profileOptions.gpioMappingsSets[i].pins[47]); +#endif writeDoc(doc, "alternativePinMappings", i, "profileLabel", profileOptions.gpioMappingsSets[i].profileLabel); doc["alternativePinMappings"][i]["enabled"] = profileOptions.gpioMappingsSets[i].enabled; } @@ -1189,6 +1209,26 @@ std::string getPinMappings() writePinDoc("pin27", gpioMappings.pins[27]); writePinDoc("pin28", gpioMappings.pins[28]); writePinDoc("pin29", gpioMappings.pins[29]); +#if NUM_BANK0_GPIOS > 32 + writePinDoc("pin30", gpioMappings.pins[30]); + writePinDoc("pin31", gpioMappings.pins[31]); + writePinDoc("pin32", gpioMappings.pins[32]); + writePinDoc("pin33", gpioMappings.pins[33]); + writePinDoc("pin34", gpioMappings.pins[34]); + writePinDoc("pin35", gpioMappings.pins[35]); + writePinDoc("pin36", gpioMappings.pins[36]); + writePinDoc("pin37", gpioMappings.pins[37]); + writePinDoc("pin38", gpioMappings.pins[38]); + writePinDoc("pin39", gpioMappings.pins[39]); + writePinDoc("pin40", gpioMappings.pins[40]); + writePinDoc("pin41", gpioMappings.pins[41]); + writePinDoc("pin42", gpioMappings.pins[42]); + writePinDoc("pin43", gpioMappings.pins[43]); + writePinDoc("pin44", gpioMappings.pins[44]); + writePinDoc("pin45", gpioMappings.pins[45]); + writePinDoc("pin46", gpioMappings.pins[46]); + writePinDoc("pin47", gpioMappings.pins[47]); +#endif writeDoc(doc, "profileLabel", gpioMappings.profileLabel); doc["enabled"] = gpioMappings.enabled; @@ -1544,17 +1584,25 @@ std::string setHETriggerOptions() calibrationSmoothingFactor = doc["heTriggerSmoothingFactor"]; ema_smoothing = (float)calibrationSmoothingFactor / 100.f; // 99 = max smoothing factor + uint8_t pinStart, pinEnd; +#if NUM_BANK0_GPIOS <= 32 + pinStart = 26; + pinEnd = 29; +#elif NUM_BANK0_GPIOS > 32 + pinStart = 40; + pinEnd = 47; +#endif for (int i = 0; i < 4; i++) { if ( calibrationSelectPins[i] != -1 && calibrationSelectPins[i] >= 0 && - calibrationSelectPins[i] <= 29 ) { + calibrationSelectPins[i] <= pinEnd ) { gpio_init(calibrationSelectPins[i]); gpio_set_dir(calibrationSelectPins[i], GPIO_OUT); gpio_put(calibrationSelectPins[i], 0); } if ( calibrationADCPins[i] != -1 && - calibrationADCPins[i] >= 26 && - calibrationADCPins[i] <= 29 ) { + calibrationADCPins[i] >= pinStart && + calibrationADCPins[i] <= pinEnd ) { adc_gpio_init(calibrationADCPins[i]); } } diff --git a/www/src/Pages/PinMapping.scss b/www/src/Pages/PinMapping.scss index b1697e993..1220797bd 100644 --- a/www/src/Pages/PinMapping.scss +++ b/www/src/Pages/PinMapping.scss @@ -2,7 +2,7 @@ display: grid; grid-auto-flow: column; grid-template-columns: 1fr 1fr; - grid-template-rows: repeat(15, auto); + grid-template-rows: repeat(var(--pin-count, 15), auto); } @media only screen and (max-width: 680px) { diff --git a/www/src/Pages/PinMapping.tsx b/www/src/Pages/PinMapping.tsx index 062672dcd..d14e75a89 100644 --- a/www/src/Pages/PinMapping.tsx +++ b/www/src/Pages/PinMapping.tsx @@ -247,7 +247,7 @@ const PinSelectList = memo(function PinSelectList({ [buttonNames], ); return ( -
+
32 ? 12 : 15) }}> {Object.entries(pins).map(([pin, pinData], index) => (