diff --git a/configs/Pico/BoardConfig.h b/configs/Pico/BoardConfig.h index cf79620e..b0937da0 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 // 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 #define PIN_BUTTON_R3 19 #define PIN_BUTTON_A1 20 diff --git a/src/gamepad.cpp b/src/gamepad.cpp index c2636e7a..7e9f35ab 100644 --- a/src/gamepad.cpp +++ b/src/gamepad.cpp @@ -37,33 +37,34 @@ 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 - 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