Browse Source

Remap SNES to free up some pins for analog/digital output in the future

master
Travis Burtrum 2 years ago
parent
commit
a4cb9d52c4
  1. 20
      readme.md
  2. 14
      src/SnesNes.cpp

20
readme.md

@ -25,12 +25,12 @@ Wiring @@ -25,12 +25,12 @@ Wiring
| DB-25 Pins | Arduino Pro Micro GPIO | ESP32 GPIO | Radio | SNES | PSX | N64 | Gamecube | Genesis |
|---------------|------------------------|------------|----------|--------|--------|----------|----------|-------------|
| 1 TX | 1 | 1 | - | - | - | - | - | P1-1 |
| 2 SDA | 2 | 21 | - | LATCH | DATA | DATA1 | DATA1 | P1-3 |
| 3 SCL | 3 | 22 | - | CLOCK | CMD | - | - | P1-4 |
| 4 Analog | 4 | 15 | - | - | ATT | - | - | P1-6 |
| 5 Digital | 5 | 16 | - | - | CLK | - | - | P1-7 |
| 6 Analog | 6 | 2 | - | - | - | - | - | P1-9 |
| 1 TX | 1 | 1 | - | LATCH | - | - | - | P1-1 |
| 2 SDA | 2 | 21 | - | CLOCK | DATA | DATA1 | DATA1 | P1-3 |
| 3 SCL | 3 | 22 | - | DATA1 | CMD | - | - | P1-4 |
| 4 Analog | 4 | 15 | - | DATA2 | ATT | - | - | P1-6 |
| 5 Digital | 5 | 16 | - | DATA3 | CLK | - | - | P1-7 |
| 6 Analog | 6 | 2 | - | DATA4 | - | - | - | P1-9 |
| 7 Digital | 7 | 17 | CE | - | - | - | - | P2-7* |
| 8 Analog | 8 | 4 | CSN | - | - | - | - | - |
| 9 Analog | 9 > 1k Ω | 35 > 1k Ω | - | 330 Ω | 100 Ω | 220 Ω | 680 Ω | 470 Ω |
@ -42,10 +42,10 @@ Wiring @@ -42,10 +42,10 @@ Wiring
| 15 SCLK | 15 | 14 | SCLK | - | - | - | - | P2-9* |
| 16 MOSI | 16 | 13 | MOSI | - | - | - | - | - |
| 17 - | - | - | - | - | - | - | - | - |
| 18 Analog | 18 | 27 | - | DATA1 | - | - | - | P2-1 |
| 19 Analog | 19 | 26 | - | DATA2 | - | - | - | P2-2 |
| 20 Analog | 20 | 25 | - | DATA3 | - | - | - | P2-3 |
| 21 Analog | 21 | 33 | - | DATA4 | - | - | - | P2-4 |
| 18 Analog | 18 | 27 | - | - | - | - | - | P2-1 |
| 19 Analog | 19 | 26 | - | - | - | - | - | P2-2 |
| 20 Analog | 20 | 25 | - | - | - | - | - | P2-3 |
| 21 Analog | 21 | 33 | - | - | - | - | - | P2-4 |
| 22 - | - | - | - | - | - | - | - | - |
| 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 |

14
src/SnesNes.cpp

@ -9,20 +9,20 @@ @@ -9,20 +9,20 @@
#include "pins.h"
//shared pins between all controllers
static const int LATCH_PIN = OR_PIN_2; // brown
static const int CLOCK_PIN = OR_PIN_3; // white
static const int LATCH_PIN = OR_PIN_1; // brown
static const int CLOCK_PIN = OR_PIN_2; // white
//individual data pin for each controller
static const int DATA_PIN[GAMEPAD_COUNT] = {
OR_PIN_18,
OR_PIN_3,
#if GAMEPAD_COUNT > 1
OR_PIN_19,
OR_PIN_4,
#endif
#if GAMEPAD_COUNT > 2
OR_PIN_20,
OR_PIN_5,
#endif
#if GAMEPAD_COUNT > 3
OR_PIN_21,
OR_PIN_6,
#endif
};
// power red, ground black
@ -89,7 +89,7 @@ class GameControllers { @@ -89,7 +89,7 @@ class GameControllers {
}
void poll(void (*controllerChanged)(const int controller)) {
memset(changedControllers, 0, GAMEPAD_COUNT);
memset(changedControllers, 0, sizeof(changedControllers));
digitalWrite(latchPin, HIGH);
delayMicroseconds(12);

Loading…
Cancel
Save