Remap SNES to free up some pins for analog/digital output in the future
This commit is contained in:
parent
22682572de
commit
a4cb9d52c4
20
readme.md
20
readme.md
|
@ -25,12 +25,12 @@ Wiring
|
||||||
|
|
||||||
| DB-25 Pins | Arduino Pro Micro GPIO | ESP32 GPIO | Radio | SNES | PSX | N64 | Gamecube | Genesis |
|
| DB-25 Pins | Arduino Pro Micro GPIO | ESP32 GPIO | Radio | SNES | PSX | N64 | Gamecube | Genesis |
|
||||||
|---------------|------------------------|------------|----------|--------|--------|----------|----------|-------------|
|
|---------------|------------------------|------------|----------|--------|--------|----------|----------|-------------|
|
||||||
| 1 TX | 1 | 1 | - | - | - | - | - | P1-1 |
|
| 1 TX | 1 | 1 | - | LATCH | - | - | - | P1-1 |
|
||||||
| 2 SDA | 2 | 21 | - | LATCH | DATA | DATA1 | DATA1 | P1-3 |
|
| 2 SDA | 2 | 21 | - | CLOCK | DATA | DATA1 | DATA1 | P1-3 |
|
||||||
| 3 SCL | 3 | 22 | - | CLOCK | CMD | - | - | P1-4 |
|
| 3 SCL | 3 | 22 | - | DATA1 | CMD | - | - | P1-4 |
|
||||||
| 4 Analog | 4 | 15 | - | - | ATT | - | - | P1-6 |
|
| 4 Analog | 4 | 15 | - | DATA2 | ATT | - | - | P1-6 |
|
||||||
| 5 Digital | 5 | 16 | - | - | CLK | - | - | P1-7 |
|
| 5 Digital | 5 | 16 | - | DATA3 | CLK | - | - | P1-7 |
|
||||||
| 6 Analog | 6 | 2 | - | - | - | - | - | P1-9 |
|
| 6 Analog | 6 | 2 | - | DATA4 | - | - | - | P1-9 |
|
||||||
| 7 Digital | 7 | 17 | CE | - | - | - | - | P2-7* |
|
| 7 Digital | 7 | 17 | CE | - | - | - | - | P2-7* |
|
||||||
| 8 Analog | 8 | 4 | CSN | - | - | - | - | - |
|
| 8 Analog | 8 | 4 | CSN | - | - | - | - | - |
|
||||||
| 9 Analog | 9 > 1k Ω | 35 > 1k Ω | - | 330 Ω | 100 Ω | 220 Ω | 680 Ω | 470 Ω |
|
| 9 Analog | 9 > 1k Ω | 35 > 1k Ω | - | 330 Ω | 100 Ω | 220 Ω | 680 Ω | 470 Ω |
|
||||||
|
@ -42,10 +42,10 @@ Wiring
|
||||||
| 15 SCLK | 15 | 14 | SCLK | - | - | - | - | P2-9* |
|
| 15 SCLK | 15 | 14 | SCLK | - | - | - | - | P2-9* |
|
||||||
| 16 MOSI | 16 | 13 | MOSI | - | - | - | - | - |
|
| 16 MOSI | 16 | 13 | MOSI | - | - | - | - | - |
|
||||||
| 17 - | - | - | - | - | - | - | - | - |
|
| 17 - | - | - | - | - | - | - | - | - |
|
||||||
| 18 Analog | 18 | 27 | - | DATA1 | - | - | - | P2-1 |
|
| 18 Analog | 18 | 27 | - | - | - | - | - | P2-1 |
|
||||||
| 19 Analog | 19 | 26 | - | DATA2 | - | - | - | P2-2 |
|
| 19 Analog | 19 | 26 | - | - | - | - | - | P2-2 |
|
||||||
| 20 Analog | 20 | 25 | - | DATA3 | - | - | - | P2-3 |
|
| 20 Analog | 20 | 25 | - | - | - | - | - | P2-3 |
|
||||||
| 21 Analog | 21 | 33 | - | DATA4 | - | - | - | P2-4 |
|
| 21 Analog | 21 | 33 | - | - | - | - | - | P2-4 |
|
||||||
| 22 - | - | - | - | - | - | - | - | - |
|
| 22 - | - | - | - | - | - | - | - | - |
|
||||||
| 23 3.3V VCC | - | 3.3V VCC | 3.3V VCC | - | - | 3.3V VCC | 3.3V VCC | - |
|
| 23 3.3V VCC | - | 3.3V VCC | 3.3V VCC | - | - | 3.3V VCC | 3.3V VCC | - |
|
||||||
| 24 5V VCC | 5V VCC OUT | 5V VCC | 5V VCC | 5V VCC | 5V VCC | - | 5V VCC | PX-5 5V VCC |
|
| 24 5V VCC | 5V VCC OUT | 5V VCC | 5V VCC | 5V VCC | 5V VCC | - | 5V VCC | PX-5 5V VCC |
|
||||||
|
|
|
@ -9,20 +9,20 @@
|
||||||
#include "pins.h"
|
#include "pins.h"
|
||||||
|
|
||||||
//shared pins between all controllers
|
//shared pins between all controllers
|
||||||
static const int LATCH_PIN = OR_PIN_2; // brown
|
static const int LATCH_PIN = OR_PIN_1; // brown
|
||||||
static const int CLOCK_PIN = OR_PIN_3; // white
|
static const int CLOCK_PIN = OR_PIN_2; // white
|
||||||
|
|
||||||
//individual data pin for each controller
|
//individual data pin for each controller
|
||||||
static const int DATA_PIN[GAMEPAD_COUNT] = {
|
static const int DATA_PIN[GAMEPAD_COUNT] = {
|
||||||
OR_PIN_18,
|
OR_PIN_3,
|
||||||
#if GAMEPAD_COUNT > 1
|
#if GAMEPAD_COUNT > 1
|
||||||
OR_PIN_19,
|
OR_PIN_4,
|
||||||
#endif
|
#endif
|
||||||
#if GAMEPAD_COUNT > 2
|
#if GAMEPAD_COUNT > 2
|
||||||
OR_PIN_20,
|
OR_PIN_5,
|
||||||
#endif
|
#endif
|
||||||
#if GAMEPAD_COUNT > 3
|
#if GAMEPAD_COUNT > 3
|
||||||
OR_PIN_21,
|
OR_PIN_6,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
// power red, ground black
|
// power red, ground black
|
||||||
|
@ -89,7 +89,7 @@ class GameControllers {
|
||||||
}
|
}
|
||||||
|
|
||||||
void poll(void (*controllerChanged)(const int controller)) {
|
void poll(void (*controllerChanged)(const int controller)) {
|
||||||
memset(changedControllers, 0, GAMEPAD_COUNT);
|
memset(changedControllers, 0, sizeof(changedControllers));
|
||||||
|
|
||||||
digitalWrite(latchPin, HIGH);
|
digitalWrite(latchPin, HIGH);
|
||||||
delayMicroseconds(12);
|
delayMicroseconds(12);
|
||||||
|
|
Loading…
Reference in New Issue