Add+fix ESP32 pinout
This commit is contained in:
parent
91b9703118
commit
78db2a74c7
50
readme.md
50
readme.md
|
@ -25,31 +25,31 @@ Wiring
|
|||
|
||||
| DB-25 Pins | Arduino Pro Micro GPIO | ESP32 GPIO | Radio | SNES | PSX | N64 | Gamecube | Genesis |
|
||||
|---------------|------------------------|------------|----------|--------|--------|----------|----------|-------------|
|
||||
| 1 | 1 | | - | - | - | - | - | P1-1 |
|
||||
| 2 | 2 | | - | LATCH | DATA | DATA1 | DATA1 | P1-3 |
|
||||
| 3 | 3 | | - | CLOCK | CMD | - | - | P1-4 |
|
||||
| 4 | 4 | | - | - | ATT | - | - | P1-6 |
|
||||
| 5 | 5 | | - | - | CLK | - | - | P1-7 |
|
||||
| 6 | 6 | | - | - | - | - | - | P1-9 |
|
||||
| 7 | 7 | | CE | - | - | - | - | P2-7* |
|
||||
| 8 | 8 | | CSN | - | - | - | - | - |
|
||||
| 9 | 9 | | - | - | - | - | - | - |
|
||||
| 10 | 10 | | - | - | - | - | - | - |
|
||||
| 11 | 0 | | - | - | - | - | - | P1-2 |
|
||||
| 12 | - | | - | - | - | - | - | - |
|
||||
| 13 | - | | - | - | - | - | - | - |
|
||||
| 14 | 14 | | MISO | - | - | - | - | P2-6* |
|
||||
| 15 | 15 | | SCLK | - | - | - | - | P2-9* |
|
||||
| 16 | 16 | | MOSI | - | - | - | - | - |
|
||||
| 17 | - | | - | - | - | - | - | - |
|
||||
| 18 | 18 | | - | DATA1 | - | - | - | P2-1 |
|
||||
| 19 | 19 | | - | DATA2 | - | - | - | P2-2 |
|
||||
| 20 | 20 | | - | DATA3 | - | - | - | P2-3 |
|
||||
| 21 | 21 | | - | DATA4 | - | - | - | P2-4 |
|
||||
| 22 | - | | - | - | - | - | - | - |
|
||||
| 23 | - | | 3.3V VCC | - | - | 3.3V VCC | 3.3V VCC | - |
|
||||
| 24 | 5V VCC | | 5V VCC | 5V VCC | 5V VCC | - | 5V VCC | PX-5 5V VCC |
|
||||
| 25 | GND | | GND | GND | - | GND | GND | PX-8 GND |
|
||||
| 1 | 1 | 15 | - | - | - | - | - | P1-1 |
|
||||
| 2 | 2 | 2 | - | LATCH | DATA | DATA1 | DATA1 | P1-3 |
|
||||
| 3 | 3 | 4 | - | CLOCK | CMD | - | - | P1-4 |
|
||||
| 4 | 4 | 16 | - | - | ATT | - | - | P1-6 |
|
||||
| 5 | 5 | 17 | - | - | CLK | - | - | P1-7 |
|
||||
| 6 | 6 | 5 | - | - | - | - | - | P1-9 |
|
||||
| 7 | 7 | 18 | CE | - | - | - | - | P2-7* |
|
||||
| 8 | 8 | 19 | CSN | - | - | - | - | - |
|
||||
| 9 | 9 | 21 | - | - | - | - | - | - |
|
||||
| 10 | 10 | 3 | - | - | - | - | - | - |
|
||||
| 11 | 0 | 1 | - | - | - | - | - | P1-2 |
|
||||
| 12 | - | 22 | - | - | - | - | - | - |
|
||||
| 13 | - | 23 | - | - | - | - | - | - |
|
||||
| 14 | 14 | 12 | MISO | - | - | - | - | P2-6* |
|
||||
| 15 | 15 | 14 | SCLK | - | - | - | - | P2-9* |
|
||||
| 16 | 16 | 13 | MOSI | - | - | - | - | - |
|
||||
| 17 | - | 27 | - | - | - | - | - | - |
|
||||
| 18 | 18 | 26 | - | DATA1 | - | - | - | P2-1 |
|
||||
| 19 | 19 | 25 | - | DATA2 | - | - | - | P2-2 |
|
||||
| 20 | 20 | 33 | - | DATA3 | - | - | - | P2-3 |
|
||||
| 21 | 21 | 32 | - | DATA4 | - | - | - | P2-4 |
|
||||
| 22 | - | 35 | - | - | - | - | - | - |
|
||||
| 23 | - | 3.3V VCC | 3.3V VCC | - | - | 3.3V VCC | 3.3V VCC | - |
|
||||
| 24 | 5V VCC OUT | 5V VCC | 5V VCC | 5V VCC | 5V VCC | - | 5V VCC | PX-5 5V VCC |
|
||||
| 25 | GND | GND | GND | GND | - | GND | GND | PX-8 GND |
|
||||
|
||||
* 2nd player Genesis is incompatible with Radio because it uses the same pins, 1 player Genesis is compatible
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@ PIN # USAGE (colors from my extension cable, check your own)
|
|||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
|
||||
#define DATA1 13
|
||||
#define CMD1 12
|
||||
#define ATT1 14
|
||||
#define CLK1 27
|
||||
#define DATA1 2
|
||||
#define CMD1 4
|
||||
#define ATT1 16
|
||||
#define CLK1 17
|
||||
|
||||
#define CTRL_BYTE_DELAY 18
|
||||
|
||||
|
|
|
@ -9,7 +9,17 @@
|
|||
|
||||
#include "gamepad/Gamepad.h"
|
||||
|
||||
RF24 radio(7, 8); // CE, CSN
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
// esp32
|
||||
#define CE_PIN 18
|
||||
#define CSN_PIN 19
|
||||
#else
|
||||
// micro
|
||||
#define CE_PIN 7
|
||||
#define CSN_PIN 8
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
RF24 radio(CE_PIN, CSN_PIN);
|
||||
|
||||
const byte address[13] = "OpenRetroPad";
|
||||
|
||||
|
|
|
@ -70,17 +70,17 @@ static const int DATA_PIN[GAMEPAD_COUNT][PIN_COUNT] = {
|
|||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
static const int DATA_PIN_SELECT[GAMEPAD_COUNT] = {
|
||||
5,
|
||||
17,
|
||||
#if GAMEPAD_COUNT > 1
|
||||
25,
|
||||
18,
|
||||
#endif
|
||||
};
|
||||
|
||||
//individual data pin for each controller
|
||||
static const int DATA_PIN[GAMEPAD_COUNT][PIN_COUNT] = {
|
||||
{15, 2, 4, 16, 17, 18},
|
||||
{15, 1, 2, 4, 16, 5},
|
||||
#if GAMEPAD_COUNT > 1
|
||||
{36, 39, 34, 35, 33, 27},
|
||||
{26, 25, 33, 32, 12, 14},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,31 @@
|
|||
#endif
|
||||
#define BUTTON_COUNT 12 // SNES has 12, NES only has 8
|
||||
|
||||
//shared pins between all controllers
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
// ESP32
|
||||
static const int LATCH_PIN = 2; // brown
|
||||
static const int CLOCK_PIN = 4; // white
|
||||
|
||||
//individual data pin for each controller
|
||||
static const int DATA_PIN[GAMEPAD_COUNT] = {
|
||||
26,
|
||||
#if GAMEPAD_COUNT > 1
|
||||
25,
|
||||
#endif
|
||||
#if GAMEPAD_COUNT > 2
|
||||
33,
|
||||
#endif
|
||||
#if GAMEPAD_COUNT > 3
|
||||
32,
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
// micro
|
||||
static const int LATCH_PIN = 2; // brown
|
||||
static const int CLOCK_PIN = 3; // white
|
||||
|
||||
//individual data pin for each controller
|
||||
static const int DATA_PIN[GAMEPAD_COUNT] = {
|
||||
18,
|
||||
|
@ -20,15 +45,6 @@ static const int DATA_PIN[GAMEPAD_COUNT] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
//shared pins between all controllers
|
||||
#if defined(CONFIG_BT_ENABLED)
|
||||
// ESP32
|
||||
static const int LATCH_PIN = 16; // brown
|
||||
static const int CLOCK_PIN = 17; // white
|
||||
#else
|
||||
// micro
|
||||
static const int LATCH_PIN = 2; // brown
|
||||
static const int CLOCK_PIN = 3; // white
|
||||
#endif
|
||||
// power red, ground black
|
||||
|
||||
|
|
Loading…
Reference in New Issue