MickGyver / DaemonBite-Arcade-Encoder

An arcade controller project for the MiSTer FPGA project and any other device accepting USB HID joysticks. Up to 12 buttons are supported. Can also be used to create NeoGeo/Atari/Commodore/Amiga controller to USB adapters.
GNU General Public License v3.0
280 stars 48 forks source link

Error compiling downloaded code #3

Closed leeyanhuilyh closed 3 years ago

leeyanhuilyh commented 4 years ago

Hi there. First of all, thank you for creating this project. My issue is that I am not able to compile the code. There are a lot of error messages here, so I think I might be missing some libraries. Here are the error messages:

In file included from C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:24:0: Gamepad.h:43:1: error: expected class-name before '{' token { ^ Gamepad.h:49:23: error: 'USBSetup' has not been declared int getDescriptor(USBSetup& setup); ^~~~ Gamepad.h:51:16: error: 'USBSetup' has not been declared bool setup(USBSetup& setup); ^~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino: In function 'void setup()': DaemonBiteArcadeEncoder:71:3: error: 'DDRF' was not declared in this scope DDRF &= ~B11110000; // Set A0-A3 as inputs ^~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:71:3: note: suggested alternative: 'WDRF' DDRF &= ~B11110000; // Set A0-A3 as inputs ^~~~ WDRF DaemonBiteArcadeEncoder:72:3: error: 'PORTF' was not declared in this scope PORTF |= B11110000; // Enable internal pull-up resistors ^~~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:72:3: note: suggested alternative: 'PORT0' PORTF |= B11110000; // Enable internal pull-up resistors ^~~~~ PORT0 DaemonBiteArcadeEncoder:81:3: error: 'DDRE' was not declared in this scope DDRE &= ~B01000000; // Pin 7 as input ^~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:81:3: note: suggested alternative: 'DDRB' DDRE &= ~B01000000; // Pin 7 as input ^~~~ DDRB DaemonBiteArcadeEncoder:82:3: error: 'PORTE' was not declared in this scope PORTE |= B01000000; // Enable internal pull-up resistor ^~~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:82:3: note: suggested alternative: 'PORT0' PORTE |= B01000000; // Enable internal pull-up resistor ^~~~~ PORT0 C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino: In function 'void loop()': DaemonBiteArcadeEncoder:108:20: error: 'PINF' was not declared in this scope axesDirect = ~(PINF & B11110000); ^~~~ In file included from sketch\Gamepad.cpp:26:0: Gamepad.h:43:1: error: expected class-name before '{' token { ^ Gamepad.h:49:23: error: 'USBSetup' has not been declared int getDescriptor(USBSetup& setup); ^~~~ C:\Users\metal\Desktop\DaemonBite-Arcade-Encoder\DaemonBiteArcadeEncoder\DaemonBiteArcadeEncoder.ino:108:20: note: suggested alternative: 'PIN0' axesDirect = ~(PINF & B11110000); ^~~~ PIN0 Gamepad.h:51:16: error: 'USBSetup' has not been declared bool setup(USBSetup& setup); ^~~~ sketch\Gamepad.cpp: In constructor 'Gamepad::Gamepad()': Gamepad.cpp:75:28: error: class 'Gamepad' does not have any field named 'PluggableUSBModule' Gamepad::Gamepad_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1) ^~~~~~ Gamepad.cpp:75:71: error: 'HID_REPORTPROTOCOL' was not declared in this scope Gamepad::Gamepad_(void) : PluggableUSBModule(1, 1, epType), protocol(HID_REPORT_PROTOCOL), idle(1) ^~~~~~~ Gamepad.cpp:77:15: error: 'EP_TYPE_INTERRUPT_IN' was not declared in this scope epType[0] = EP_TYPE_INTERRUPT_IN; ^~~~~~~~ sketch\Gamepad.cpp:77:15: note: suggested alternative: 'EMPTY_INTERRUPT' epType[0] = EP_TYPE_INTERRUPT_IN; ^~~~~~~~ EMPTYINTERRUPT Gamepad.cpp:78:3: error: 'PluggableUSB' was not declared in this scope PluggableUSB().plug(this); ^~~~ sketch\Gamepad.cpp: In member function 'int Gamepad::getInterface(uint8_t)': Gamepad.cpp:84:3: error: 'HIDDescriptor' was not declared in this scope HIDDescriptor hidInterface = { ^~~~~ sketch\Gamepad.cpp:84:3: note: suggested alternative: 'getDescriptor' HIDDescriptor hidInterface = { ^~~~~ getDescriptor Gamepad.cpp:89:30: error: 'hidInterface' was not declared in this scope return USB_SendControl(0, &hidInterface, sizeof(hidInterface)); ^~~~ sketch\Gamepad.cpp:89:30: note: suggested alternative: 'getInterface' return USB_SendControl(0, &hidInterface, sizeof(hidInterface)); ^~~~ getInterface Gamepad.cpp:89:10: error: 'USB_SendControl' was not declared in this scope return USBSendControl(0, &hidInterface, sizeof(hidInterface)); ^~~~~~~ sketch\Gamepad.cpp: At global scope: Gamepad.cpp:92:29: error: 'int Gamepad::getDescriptor' is not a static data member of 'class Gamepad' int Gamepad::getDescriptor(USBSetup& setup) ^~~~ Gamepad.cpp:92:29: error: 'USBSetup' was not declared in this scope sketch\Gamepad.cpp:92:29: note: suggested alternative: 'setup' int Gamepad::getDescriptor(USBSetup& setup) ^~~~ setup Gamepad.cpp:108:22: error: 'bool Gamepad::setup' is not a static data member of 'class Gamepad' bool Gamepad::setup(USBSetup& setup) ^~~~ Gamepad.cpp:108:22: error: 'USBSetup' was not declared in this scope sketch\Gamepad.cpp:108:22: note: suggested alternative: 'setup' bool Gamepad::setup(USBSetup& setup) ^~~~ setup sketch\Gamepad.cpp: In member function 'void Gamepad::send()': Gamepad.cpp:159:12: error: 'pluggedEndpoint' was not declared in this scope USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_GamepadReport, sizeof(GamepadReport)); ^~~~~~~ Gamepad.cpp:159:30: error: 'TRANSFER_RELEASE' was not declared in this scope USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_GamepadReport, sizeof(GamepadReport)); ^~~~ sketch\Gamepad.cpp:159:30: note: suggested alternative: 'ATOMIC_RELEASE' USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_GamepadReport, sizeof(GamepadReport)); ^~~~ ATOMIC_RELEASE Gamepad.cpp:159:3: error: 'USB_Send' was not declared in this scope USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_GamepadReport, sizeof(GamepadReport)); ^~~~ sketch\Gamepad.cpp:159:3: note: suggested alternative: 'USBS0' USB_Send(pluggedEndpoint | TRANSFER_RELEASE, &_GamepadReport, sizeof(GamepadReport)); ^~~~ USBS0 sketch\Gamepad.cpp: In member function 'uint8t Gamepad::getShortName(char)': Gamepad.cpp:164:7: error: 'next' was not declared in this scope if(!next) ^~~~ sketch\Gamepad.cpp:164:7: note: suggested alternative: 'exit' if(!next) ^~~~ exit exit status 1 expected class-name before '{' token

Could someone shed some light on this issue? Thanks.

vcoraba commented 3 years ago

I had same problem but I could compile selecting Arduino Leonardo Instead arduino mini Pro. Good luck

0x15e commented 3 years ago

The naming for the board this uses is really tricky. It's meant to be used with the "Arduino Pro Micro", which is a board made by Sparkfun (this board, more info here).

Unfortunately, over the years, there's also been about 100 other combinations of Arduino names including words like "pro," "mini," "micro," etc. so it gets really hard to tell the things apart. As you found, selecting the Leonardo gets the job done. I suspect that installing Sparkfun's board files would probably get you the proper name for it in the list too, if that was important to you.

I remember being a little confused by this back when I put my adapters together as well. @MickGyver would it be possible to clarify the programming documentation a little? I think just some extra notes in the "Programming the Arduino" section would be enough. Just explain which board should be used and what it might be called in the IDE. I could probably do a PR for this but it might take a while before I can get around to it.

leeyanhuilyh commented 3 years ago

Sorry for the late update. You guys are right, it should be compiled with Arduino Leonardo. Closing this issue. Thanks for your help!