Adapt various input devices to various output devices.
https://github.com/OpenRetroPad/OpenRetroPad
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
577 B
33 lines
577 B
|
|
#include "Arduino.h" |
|
|
|
#include <SPI.h> |
|
#include <nRF24L01.h> |
|
#include <RF24.h> |
|
|
|
#define GAMEPAD_REPORT_ARRAY_ADD 1 |
|
|
|
#include "gamepad/Gamepad.h" |
|
|
|
#include "pins.h" |
|
|
|
RF24 radio(OR_PIN_7, OR_PIN_8); // CE, CSN |
|
|
|
const byte address[13] = "OpenRetroPad"; |
|
|
|
GAMEPAD_CLASS gamepad; |
|
|
|
void setup() { |
|
gamepad.begin(); |
|
radio.begin(); |
|
radio.openReadingPipe(0, address); |
|
radio.setPALevel(RF24_PA_MIN); |
|
radio.startListening(); |
|
} |
|
|
|
void loop() { |
|
if (radio.available() && gamepad.isConnected()) { |
|
radio.read(&gamepad.gamepadReport, 16); |
|
gamepad.sync(gamepad.gamepadReport[15]); |
|
} |
|
}
|
|
|