mirror of
https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter
synced 2024-12-21 06:58:55 -05:00
Update RetroJoystickAdapter_Atari.ino
This commit is contained in:
parent
51870e119a
commit
c5cac27d8e
@ -6,7 +6,6 @@
|
||||
const uint8_t inputPinsPort1[] = { 5, 6, 7, 8, 4, A2};
|
||||
const uint8_t inputPinsPort2[] = { 10, 16, 14, 15, 3, A1};
|
||||
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
inline void translateState(uint8_t data, uint8_t *state) {
|
||||
@ -19,21 +18,8 @@ inline void translateState(uint8_t data, uint8_t *state) {
|
||||
if (!bitRead(data, 3)) state[1] = 255; /* right */
|
||||
}
|
||||
|
||||
|
||||
#include "HID.h"
|
||||
|
||||
#if ARDUINO < 10606
|
||||
#error The Joystick2 library requires Arduino IDE 1.6.6 or greater. Please update your IDE.
|
||||
#endif
|
||||
|
||||
#if !defined(USBCON)
|
||||
#error The Joystick2 library can only be used with a USB MCU (e.g. Arduino Leonardo, Arduino Micro, etc.).
|
||||
#endif
|
||||
|
||||
#if !defined(_USING_HID)
|
||||
#error "legacy HID core (non pluggable)"
|
||||
#endif
|
||||
|
||||
#define JOYSTICK_REPORT_ID 0x04
|
||||
#define JOYSTICK2_REPORT_ID 0x05
|
||||
|
||||
@ -75,8 +61,6 @@ inline void translateState(uint8_t data, uint8_t *state) {
|
||||
0xc0 /* END_COLLECTION */
|
||||
|
||||
|
||||
|
||||
|
||||
static const uint8_t hidReportDescriptor[] PROGMEM = {
|
||||
HIDDESC_MACRO(JOYSTICK_REPORT_ID),
|
||||
HIDDESC_MACRO(JOYSTICK2_REPORT_ID)
|
||||
@ -144,10 +128,6 @@ Joystick_ Joystick[2] =
|
||||
//================================================================================
|
||||
//================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
//set all DB9-connector input signal pins as inputs with pullups
|
||||
for (uint8_t i = 0; i < 6; i++) {
|
||||
@ -162,7 +142,6 @@ void setup() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
Joystick[0].data = 0xff;
|
||||
@ -193,5 +172,4 @@ void loop() {
|
||||
Joystick[1].sendState();
|
||||
delayMicroseconds(500);
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user