Skip to content

Commit

Permalink
GPIO PinXY Assignment in Board Config (#796)
Browse files Browse the repository at this point in the history
* First initial draft of pin-assignment in board config

* Clean-ups to board configs

* Quick fix on gpioaction

* Pulling main into my gpio pin config branch (#797)

* use if-else block logic instead of switch in jslider debouncer (#793)

I'm not going to say we *understand* why this fixes #790, but it appears
to.

* Adds a "pin viewer" in pin mapping page (#794)

---------

Co-authored-by: Brian S. Stephan <bss@incorporeal.org>
Co-authored-by: Pelsin <ian@vidales.se>

---------

Co-authored-by: Brian S. Stephan <bss@incorporeal.org>
Co-authored-by: Pelsin <ian@vidales.se>
  • Loading branch information
3 people committed Jan 16, 2024
1 parent e912451 commit 4bbeebc
Show file tree
Hide file tree
Showing 46 changed files with 752 additions and 865 deletions.
39 changes: 19 additions & 20 deletions configs/BentoBox/BoardConfig.h
Expand Up @@ -11,26 +11,25 @@
#define BOARD_CONFIG_LABEL "BentoBox"

// Main pin mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define PIN_DPAD_UP 2 // UP | UP | UP | UP | UP | UP |
#define PIN_DPAD_DOWN 12 // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define PIN_DPAD_RIGHT 11 // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define PIN_DPAD_LEFT 13 // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define PIN_BUTTON_B1 3 // B1 | A | B | Cross | 2 | K1 |
#define PIN_BUTTON_B2 4 // B2 | B | A | Circle | 3 | K2 |
#define PIN_BUTTON_R2 5 // R2 | RT | ZR | R2 | 8 | K3 |
#define PIN_BUTTON_L2 6 // L2 | LT | ZL | L2 | 7 | K4 |
#define PIN_BUTTON_B3 10 // B3 | X | Y | Square | 1 | P1 |
#define PIN_BUTTON_B4 9 // B4 | Y | X | Triangle | 4 | P2 |
#define PIN_BUTTON_R1 8 // R1 | RB | R | R1 | 6 | P3 |
#define PIN_BUTTON_L1 7 // L1 | LB | L | L1 | 5 | P4 |
#define PIN_BUTTON_S1 21 // S1 | Back | Minus | Select | 9 | Coin |
#define PIN_BUTTON_S2 22 // S2 | Start | Plus | Start | 10 | Start |
#define PIN_BUTTON_L3 18 // L3 | LS | LS | L3 | 11 | LS |
#define PIN_BUTTON_R3 17 // R3 | RS | RS | R3 | 12 | RS |
#define PIN_BUTTON_A1 20 // A1 | Guide | Home | PS | 13 | ~ |
#define PIN_BUTTON_A2 19 // A2 | ~ | Capture | ~ | 14 | ~ |
#define PIN_BUTTON_FN -1 // Hotkey Function |
// // 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_12 GpioAction::BUTTON_PRESS_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_RIGHT // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define GPIO_PIN_03 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 |
#define GPIO_PIN_04 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 |
#define GPIO_PIN_05 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 |
#define GPIO_PIN_06 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_09 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 |
#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 |
#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 |
#define GPIO_PIN_21 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin |
#define GPIO_PIN_22 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_17 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_19 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ |

// Keyboard Mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
Expand Down
39 changes: 19 additions & 20 deletions configs/FightboardV3/BoardConfig.h
Expand Up @@ -11,26 +11,25 @@
#define BOARD_CONFIG_LABEL "Fightboard V3"

// Main pin mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define PIN_DPAD_UP 29 // UP | UP | UP | UP | UP | UP |
#define PIN_DPAD_DOWN 27 // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define PIN_DPAD_RIGHT 26 // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define PIN_DPAD_LEFT 28 // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define PIN_BUTTON_B1 5 // B1 | A | B | Cross | 2 | K1 |
#define PIN_BUTTON_B2 6 // B2 | B | A | Circle | 3 | K2 |
#define PIN_BUTTON_R2 7 // R2 | RT | ZR | R2 | 8 | K3 |
#define PIN_BUTTON_L2 8 // L2 | LT | ZL | L2 | 7 | K4 |
#define PIN_BUTTON_B3 1 // B3 | X | Y | Square | 1 | P1 |
#define PIN_BUTTON_B4 2 // B4 | Y | X | Triangle | 4 | P2 |
#define PIN_BUTTON_R1 3 // R1 | RB | R | R1 | 6 | P3 |
#define PIN_BUTTON_L1 4 // L1 | LB | L | L1 | 5 | P4 |
#define PIN_BUTTON_S1 10 // S1 | Back | Minus | Select | 9 | Coin |
#define PIN_BUTTON_S2 12 // S2 | Start | Plus | Start | 10 | Start |
#define PIN_BUTTON_L3 9 // L3 | LS | LS | L3 | 11 | LS |
#define PIN_BUTTON_R3 13 // R3 | RS | RS | R3 | 12 | RS |
#define PIN_BUTTON_A1 11 // A1 | Guide | Home | PS | 13 | ~ |
#define PIN_BUTTON_A2 17 // A2 | ~ | Capture | ~ | 14 | ~ |
#define PIN_BUTTON_FN -1 // Hotkey Function |
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define GPIO_PIN_29 GpioAction::BUTTON_PRESS_UP // UP | UP | UP | UP | UP | UP |
#define GPIO_PIN_27 GpioAction::BUTTON_PRESS_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define GPIO_PIN_26 GpioAction::BUTTON_PRESS_RIGHT // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define GPIO_PIN_28 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define GPIO_PIN_05 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 |
#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 |
#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 |
#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 |
#define GPIO_PIN_01 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 |
#define GPIO_PIN_02 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 |
#define GPIO_PIN_03 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 |
#define GPIO_PIN_04 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 |
#define GPIO_PIN_10 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin |
#define GPIO_PIN_12 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start |
#define GPIO_PIN_09 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS |
#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS |
#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_A1 // A1 | Guide | Home | PS | 13 | ~ |
#define GPIO_PIN_17 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ |

// Keyboard Mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
Expand Down
39 changes: 19 additions & 20 deletions configs/FightboardV3Mirrored/BoardConfig.h
Expand Up @@ -11,26 +11,25 @@
#define BOARD_CONFIG_LABEL "Fightboard V3 Mirrored"

// Main pin mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define PIN_DPAD_UP 0 // UP | UP | UP | UP | UP | UP |
#define PIN_DPAD_DOWN 2 // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define PIN_DPAD_RIGHT 3 // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define PIN_DPAD_LEFT 1 // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define PIN_BUTTON_B1 9 // B1 | A | B | Cross | 2 | K1 |
#define PIN_BUTTON_B2 12 // B2 | B | A | Circle | 3 | K2 |
#define PIN_BUTTON_R2 13 // R2 | RT | ZR | R2 | 8 | K3 |
#define PIN_BUTTON_L2 14 // L2 | LT | ZL | L2 | 7 | K4 |
#define PIN_BUTTON_B3 15 // B3 | X | Y | Square | 1 | P1 |
#define PIN_BUTTON_B4 28 // B4 | Y | X | Triangle | 4 | P2 |
#define PIN_BUTTON_R1 27 // R1 | RB | R | R1 | 6 | P3 |
#define PIN_BUTTON_L1 26 // L1 | LB | L | L1 | 5 | P4 |
#define PIN_BUTTON_S1 7 // S1 | Back | Minus | Select | 9 | Coin |
#define PIN_BUTTON_S2 5 // S2 | Start | Plus | Start | 10 | Start |
#define PIN_BUTTON_L3 8 // L3 | LS | LS | L3 | 11 | LS |
#define PIN_BUTTON_R3 4 // R3 | RS | RS | R3 | 12 | RS |
#define PIN_BUTTON_A1 6 // A1 | Guide | Home | PS | 13 | ~ |
#define PIN_BUTTON_A2 17 // A2 | ~ | Capture | ~ | 14 | ~ |
#define PIN_BUTTON_FN -1 // Hotkey Function |
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define GPIO_PIN_00 GpioAction::BUTTON_PRESS_UP // UP | UP | UP | UP | UP | UP |
#define GPIO_PIN_02 GpioAction::BUTTON_PRESS_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define GPIO_PIN_03 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_09 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 |
#define GPIO_PIN_12 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 |
#define GPIO_PIN_13 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 |
#define GPIO_PIN_14 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 |
#define GPIO_PIN_15 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 |
#define GPIO_PIN_28 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 |
#define GPIO_PIN_27 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 |
#define GPIO_PIN_26 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 |
#define GPIO_PIN_07 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin |
#define GPIO_PIN_05 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start |
#define GPIO_PIN_08 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS |
#define GPIO_PIN_04 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS |
#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_A1 // A1 | Guide | Home | PS | 13 | ~ |
#define GPIO_PIN_17 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ |

// Keyboard Mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
Expand Down
39 changes: 19 additions & 20 deletions configs/FlatboxRev4/BoardConfig.h
Expand Up @@ -12,26 +12,25 @@

// Main pin mapping Configuration
// Mapping between Flatbox Rev4 switch number (as silkscreened) and GPIO pin listed under "Flatbox Rev4 SW#"
// // Flatbox Rev4 SW# | GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define PIN_DPAD_UP 16 // SW18 | UP | UP | UP | UP | UP | UP |
#define PIN_DPAD_DOWN 10 // SW8 | DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define PIN_DPAD_RIGHT 11 // SW9 | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define PIN_DPAD_LEFT 9 // SW7 | LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define PIN_BUTTON_B1 19 // SW14 | B1 | A | B | Cross | 2 | K1 |
#define PIN_BUTTON_B2 24 // SW15 | B2 | B | A | Circle | 3 | K2 |
#define PIN_BUTTON_R2 26 // SW16 | R2 | RT | ZR | R2 | 8 | K3 |
#define PIN_BUTTON_L2 28 // SW17 | L2 | LT | ZL | L2 | 7 | K4 |
#define PIN_BUTTON_B3 18 // SW10 | B3 | X | Y | Square | 1 | P1 |
#define PIN_BUTTON_B4 25 // SW11 | B4 | Y | X | Triangle | 4 | P2 |
#define PIN_BUTTON_R1 27 // SW12 | R1 | RB | R | R1 | 6 | P3 |
#define PIN_BUTTON_L1 29 // SW13 | L1 | LB | L | L1 | 5 | P4 |
#define PIN_BUTTON_S1 5 // SW2 | S1 | Back | Minus | Select | 9 | Coin |
#define PIN_BUTTON_S2 6 // SW1 | S2 | Start | Plus | Start | 10 | Start |
#define PIN_BUTTON_L3 2 // SW5 | L3 | LS | LS | L3 | 11 | LS |
#define PIN_BUTTON_R3 1 // SW6 | R3 | RS | RS | R3 | 12 | RS |
#define PIN_BUTTON_A1 4 // SW3 | A1 | Guide | Home | PS | 13 | ~ |
#define PIN_BUTTON_A2 3 // SW4 | A2 | ~ | Capture | ~ | 14 | ~ |
#define PIN_BUTTON_FN -1 // Hotkey Function |
// // Flatbox Rev4 SW# | GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
#define GPIO_PIN_16 GpioAction::BUTTON_PRESS_UP // UP | UP | UP | UP | UP | UP |
#define GPIO_PIN_10 GpioAction::BUTTON_PRESS_DOWN // DOWN | DOWN | DOWN | DOWN | DOWN | DOWN |
#define GPIO_PIN_11 GpioAction::BUTTON_PRESS_RIGHT // RIGHT | RIGHT | RIGHT | RIGHT | RIGHT | RIGHT |
#define GPIO_PIN_09 GpioAction::BUTTON_PRESS_LEFT // LEFT | LEFT | LEFT | LEFT | LEFT | LEFT |
#define GPIO_PIN_19 GpioAction::BUTTON_PRESS_B1 // B1 | A | B | Cross | 2 | K1 |
#define GPIO_PIN_24 GpioAction::BUTTON_PRESS_B2 // B2 | B | A | Circle | 3 | K2 |
#define GPIO_PIN_26 GpioAction::BUTTON_PRESS_R2 // R2 | RT | ZR | R2 | 8 | K3 |
#define GPIO_PIN_28 GpioAction::BUTTON_PRESS_L2 // L2 | LT | ZL | L2 | 7 | K4 |
#define GPIO_PIN_18 GpioAction::BUTTON_PRESS_B3 // B3 | X | Y | Square | 1 | P1 |
#define GPIO_PIN_25 GpioAction::BUTTON_PRESS_B4 // B4 | Y | X | Triangle | 4 | P2 |
#define GPIO_PIN_27 GpioAction::BUTTON_PRESS_R1 // R1 | RB | R | R1 | 6 | P3 |
#define GPIO_PIN_29 GpioAction::BUTTON_PRESS_L1 // L1 | LB | L | L1 | 5 | P4 |
#define GPIO_PIN_05 GpioAction::BUTTON_PRESS_S1 // S1 | Back | Minus | Select | 9 | Coin |
#define GPIO_PIN_06 GpioAction::BUTTON_PRESS_S2 // S2 | Start | Plus | Start | 10 | Start |
#define GPIO_PIN_02 GpioAction::BUTTON_PRESS_L3 // L3 | LS | LS | L3 | 11 | LS |
#define GPIO_PIN_01 GpioAction::BUTTON_PRESS_R3 // R3 | RS | RS | R3 | 12 | RS |
#define GPIO_PIN_04 GpioAction::BUTTON_PRESS_A1 // A1 | Guide | Home | PS | 13 | ~ |
#define GPIO_PIN_03 GpioAction::BUTTON_PRESS_A2 // A2 | ~ | Capture | ~ | 14 | ~ |

// Keyboard Mapping Configuration
// // GP2040 | Xinput | Switch | PS3/4/5 | Dinput | Arcade |
Expand Down

0 comments on commit 4bbeebc

Please sign in to comment.