wie in einem anderen Thread schon bereichtet versuche ich derzeit aus einer PSP ein mobiles Recalbox Handheld zu machen.
Derzeit versuche ich die Inputs der PSP Knöpfe mit dem Teensy einzulesen, sodass dieser diese Eingaben als USB Gamepad an Recalbox weitergibt.
Folgendes habe ich bezüglich Teensy geschafft:
- Alles Buttons und den Analogstick der PSP mit dem Teensy verbinden.
-Inputs erkennen und verarbeiten.
-Der Teensy gibt vor ein USB Gamepad zu sein.
-Recalbox erkennt den Teensy als Gamepad in der Controllerkonfiguration
Aber folgendes geht weder in Recalbox oder einem Emulator am PC:
-Recalbox: Button Mapping funktioniert nicht, egal was ic h drücke es tut sich garnix.
-Snes9x unter Win7: Ich kann die Buttons mappen, jedoch im Spiel geht wiederum nichts.
Anbei mein Code aus Arduino/Teensyduino:
Code: Alles auswählen
const int pinBtnUp = 17;
const int pinBtnLeft = 18;
const int pinBtnRight = 19;
const int pinBtnDown = 20;
const int pinBtnKreis = 1;
const int pinBtnDreieck = 2;
const int pinBtnViereck = 3;
const int pinBtnX = 4;
const int pinBtnL = 16;
const int pinBtnR = 0;
const int pinBtnStart = 5;
const int pinBtnSelect = 6;
const int pinBtnHome = 7;
const int pinLEDOutput = 13;
void setup() {
//Setup the pin modes.
pinMode( pinLEDOutput, OUTPUT );
//Special for the Teensy is the INPUT_PULLUP
//It enables a pullup resitor on the pin.
pinMode( pinBtnUp, INPUT_PULLUP );
pinMode( pinBtnLeft, INPUT_PULLUP );
pinMode( pinBtnRight, INPUT_PULLUP );
pinMode( pinBtnDown, INPUT_PULLUP );
pinMode( pinBtnKreis, INPUT_PULLUP );
pinMode( pinBtnDreieck, INPUT_PULLUP );
pinMode( pinBtnViereck, INPUT_PULLUP );
pinMode( pinBtnX, INPUT_PULLUP );
pinMode( pinBtnL, INPUT_PULLUP );
pinMode( pinBtnR, INPUT_PULLUP );
pinMode( pinBtnStart, INPUT_PULLUP );
pinMode( pinBtnSelect, INPUT_PULLUP );
pinMode( pinBtnHome, INPUT_PULLUP );
}
void loop() {
// read analog inputs and set X-Y position
Joystick.X(analogRead(15));
Joystick.Y(analogRead(14));
// read the digital inputs and set the buttons
Joystick.button(1, digitalRead(pinBtnUp));
Joystick.button(2, digitalRead(pinBtnLeft));
Joystick.button(3, digitalRead(pinBtnRight));
Joystick.button(4, digitalRead(pinBtnDown));
Joystick.button(5, digitalRead(pinBtnKreis));
Joystick.button(6, digitalRead(pinBtnDreieck));
Joystick.button(7, digitalRead(pinBtnViereck));
Joystick.button(8, digitalRead(pinBtnX));
Joystick.button(9, digitalRead(pinBtnL));
Joystick.button(10, digitalRead(pinBtnR));
Joystick.button(11, digitalRead(pinBtnStart));
Joystick.button(12, digitalRead(pinBtnSelect));
Joystick.button(13, digitalRead(pinBtnHome));
// a brief delay, so this runs 20 times per second
delay(50);
}
In der joy.cpl unter Windows, sind alle Buttons High, bis man sie drückt. Ein PS3 Controller zB ist aber immer Low und beim Drücken wechselt er zu High. Ich kann mir vorstellen, dass der Vergleich ein bisschen hinkt aber kann es daran liegen??
Danke und LG
Sascha
EDIT:
Ich habe das Problem jetzt behoben. Ich musste die eingelesenen Werte der Buttons tatsächlich invertieren, damit sich der Teensy wie ein handelsübliches Gamepad verhält, also nur bei Tastendruck High ausgibt. Sprich:
Code: Alles auswählen
Joystick.button(1, !digitalRead(pinBtnUp)); etc.
Jetzt brauche ich nurnoch einen PI Zero um mein Projekt fertig zu stellen.
Nächste Challange wird noch eine Audi Ausgabe vom PI Zero...