From 33ea4c42350eefbd760ae31be95cf711500af7cb Mon Sep 17 00:00:00 2001 From: Dylan Turner Date: Sun, 28 Aug 2022 18:02:50 -0500 Subject: [PATCH 1/5] Switched pins to be correct for fightkey --- configs/Pico/BoardConfig.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/configs/Pico/BoardConfig.h b/configs/Pico/BoardConfig.h index cf79620e..66681e1f 100644 --- a/configs/Pico/BoardConfig.h +++ b/configs/Pico/BoardConfig.h @@ -10,18 +10,20 @@ #define PIN_DPAD_UP 2 #define PIN_DPAD_DOWN 3 -#define PIN_DPAD_RIGHT 4 -#define PIN_DPAD_LEFT 5 -#define PIN_BUTTON_B1 6 -#define PIN_BUTTON_B2 7 -#define PIN_BUTTON_R2 8 -#define PIN_BUTTON_L2 9 -#define PIN_BUTTON_B3 10 -#define PIN_BUTTON_B4 11 -#define PIN_BUTTON_R1 12 -#define PIN_BUTTON_L1 13 -#define PIN_BUTTON_S1 16 -#define PIN_BUTTON_S2 17 +#define PIN_DPAD_RIGHT 5 +#define PIN_DPAD_LEFT 4 +#define PIN_BUTTON_B1 9 +#define PIN_BUTTON_B2 10 +#define PIN_BUTTON_R2 15 +#define PIN_BUTTON_L2 12 +#define PIN_BUTTON_B3 13 +#define PIN_BUTTON_B4 17 +#define PIN_BUTTON_R1 11 +#define PIN_BUTTON_L1 16 +#define PIN_BUTTON_S1 8 +#define PIN_BUTTON_S2 7 + +// Not connected on mine #define PIN_BUTTON_L3 18 #define PIN_BUTTON_R3 19 #define PIN_BUTTON_A1 20 From b7b90c3c6b1f24fbfddddfe726e26963c8bb9877 Mon Sep 17 00:00:00 2001 From: Dylan Turner Date: Sun, 28 Aug 2022 18:17:00 -0500 Subject: [PATCH 2/5] Turned off pullup, since fightkey doesn't use them --- src/gamepad.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gamepad.cpp b/src/gamepad.cpp index c2636e7a..1dafd980 100644 --- a/src/gamepad.cpp +++ b/src/gamepad.cpp @@ -50,20 +50,21 @@ void Gamepad::setup() { gpio_init(gamepadMappings[i]->pin); // Initialize pin gpio_set_dir(gamepadMappings[i]->pin, GPIO_IN); // Set as INPUT - gpio_pull_up(gamepadMappings[i]->pin); // Set as PULLUP + //gpio_pull_up(gamepadMappings[i]->pin); // Set as PULLUP } #ifdef PIN_SETTINGS gpio_init(PIN_SETTINGS); // Initialize pin gpio_set_dir(PIN_SETTINGS, GPIO_IN); // Set as INPUT - gpio_pull_up(PIN_SETTINGS); // Set as PULLUP + //gpio_pull_up(PIN_SETTINGS); // Set as PULLUP #endif } void Gamepad::read() { // Need to invert since we're using pullups - uint32_t values = ~gpio_get_all(); + //uint32_t values = ~gpio_get_all(); + uint32_t values = gpio_get_all(); #ifdef PIN_SETTINGS state.aux = 0 From 68a5d4976d2c9384f482acee718366eb1225ff17 Mon Sep 17 00:00:00 2001 From: Dylan Turner Date: Sun, 28 Aug 2022 18:02:50 -0500 Subject: [PATCH 3/5] Switched pins to be correct for fightkey --- configs/Pico/BoardConfig.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/configs/Pico/BoardConfig.h b/configs/Pico/BoardConfig.h index cf79620e..66681e1f 100644 --- a/configs/Pico/BoardConfig.h +++ b/configs/Pico/BoardConfig.h @@ -10,18 +10,20 @@ #define PIN_DPAD_UP 2 #define PIN_DPAD_DOWN 3 -#define PIN_DPAD_RIGHT 4 -#define PIN_DPAD_LEFT 5 -#define PIN_BUTTON_B1 6 -#define PIN_BUTTON_B2 7 -#define PIN_BUTTON_R2 8 -#define PIN_BUTTON_L2 9 -#define PIN_BUTTON_B3 10 -#define PIN_BUTTON_B4 11 -#define PIN_BUTTON_R1 12 -#define PIN_BUTTON_L1 13 -#define PIN_BUTTON_S1 16 -#define PIN_BUTTON_S2 17 +#define PIN_DPAD_RIGHT 5 +#define PIN_DPAD_LEFT 4 +#define PIN_BUTTON_B1 9 +#define PIN_BUTTON_B2 10 +#define PIN_BUTTON_R2 15 +#define PIN_BUTTON_L2 12 +#define PIN_BUTTON_B3 13 +#define PIN_BUTTON_B4 17 +#define PIN_BUTTON_R1 11 +#define PIN_BUTTON_L1 16 +#define PIN_BUTTON_S1 8 +#define PIN_BUTTON_S2 7 + +// Not connected on mine #define PIN_BUTTON_L3 18 #define PIN_BUTTON_R3 19 #define PIN_BUTTON_A1 20 From 1279ae3ee34f0302a1b8352cd287e388d387aedd Mon Sep 17 00:00:00 2001 From: Dylan Turner Date: Sun, 28 Aug 2022 18:17:00 -0500 Subject: [PATCH 4/5] Turned off pullup, since fightkey doesn't use them --- src/gamepad.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gamepad.cpp b/src/gamepad.cpp index c2636e7a..1dafd980 100644 --- a/src/gamepad.cpp +++ b/src/gamepad.cpp @@ -50,20 +50,21 @@ void Gamepad::setup() { gpio_init(gamepadMappings[i]->pin); // Initialize pin gpio_set_dir(gamepadMappings[i]->pin, GPIO_IN); // Set as INPUT - gpio_pull_up(gamepadMappings[i]->pin); // Set as PULLUP + //gpio_pull_up(gamepadMappings[i]->pin); // Set as PULLUP } #ifdef PIN_SETTINGS gpio_init(PIN_SETTINGS); // Initialize pin gpio_set_dir(PIN_SETTINGS, GPIO_IN); // Set as INPUT - gpio_pull_up(PIN_SETTINGS); // Set as PULLUP + //gpio_pull_up(PIN_SETTINGS); // Set as PULLUP #endif } void Gamepad::read() { // Need to invert since we're using pullups - uint32_t values = ~gpio_get_all(); + //uint32_t values = ~gpio_get_all(); + uint32_t values = gpio_get_all(); #ifdef PIN_SETTINGS state.aux = 0 From 0311302529ac9c14a3cdce659a688c10cd24ac71 Mon Sep 17 00:00:00 2001 From: Dylan Turner Date: Sun, 28 Aug 2022 19:00:12 -0500 Subject: [PATCH 5/5] Fixed layout --- configs/Pico/BoardConfig.h | 20 ++++++++++---------- src/gamepad.cpp | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/configs/Pico/BoardConfig.h b/configs/Pico/BoardConfig.h index 66681e1f..b0937da0 100644 --- a/configs/Pico/BoardConfig.h +++ b/configs/Pico/BoardConfig.h @@ -12,16 +12,16 @@ #define PIN_DPAD_DOWN 3 #define PIN_DPAD_RIGHT 5 #define PIN_DPAD_LEFT 4 -#define PIN_BUTTON_B1 9 -#define PIN_BUTTON_B2 10 -#define PIN_BUTTON_R2 15 -#define PIN_BUTTON_L2 12 -#define PIN_BUTTON_B3 13 -#define PIN_BUTTON_B4 17 -#define PIN_BUTTON_R1 11 -#define PIN_BUTTON_L1 16 -#define PIN_BUTTON_S1 8 -#define PIN_BUTTON_S2 7 +#define PIN_BUTTON_B1 9 // LK +#define PIN_BUTTON_B2 10 // MK +#define PIN_BUTTON_R2 12 // AK +#define PIN_BUTTON_L2 16 // AP +#define PIN_BUTTON_B3 13 // LP +#define PIN_BUTTON_B4 17 // MP +#define PIN_BUTTON_R1 15 // HK +#define PIN_BUTTON_L1 11 // HP +#define PIN_BUTTON_S1 8 // Select +#define PIN_BUTTON_S2 7 // Start // Not connected on mine #define PIN_BUTTON_L3 18 diff --git a/src/gamepad.cpp b/src/gamepad.cpp index 1dafd980..7e9f35ab 100644 --- a/src/gamepad.cpp +++ b/src/gamepad.cpp @@ -37,16 +37,16 @@ void Gamepad::setup() mapButtonA1 = new GamepadButtonMapping(boardOptions.pinButtonA1, GAMEPAD_MASK_A1); mapButtonA2 = new GamepadButtonMapping(boardOptions.pinButtonA2, GAMEPAD_MASK_A2); - gamepadMappings = new GamepadButtonMapping *[GAMEPAD_DIGITAL_INPUT_COUNT] + gamepadMappings = new GamepadButtonMapping *[GAMEPAD_DIGITAL_INPUT_COUNT - 4] { mapDpadUp, mapDpadDown, mapDpadLeft, mapDpadRight, mapButtonB1, mapButtonB2, mapButtonB3, mapButtonB4, mapButtonL1, mapButtonR1, mapButtonL2, mapButtonR2, - mapButtonS1, mapButtonS2, mapButtonL3, mapButtonR3, - mapButtonA1, mapButtonA2 + mapButtonS1, mapButtonS2, //mapButtonL3, mapButtonR3, + //mapButtonA1, mapButtonA2 }; - for (int i = 0; i < GAMEPAD_DIGITAL_INPUT_COUNT; i++) + for (int i = 0; i < GAMEPAD_DIGITAL_INPUT_COUNT - 4; i++) { gpio_init(gamepadMappings[i]->pin); // Initialize pin gpio_set_dir(gamepadMappings[i]->pin, GPIO_IN); // Set as INPUT