Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino Mega ADK support in USB Host Shield 2.0 library #3

Merged
merged 3 commits into from Jan 23, 2012

Conversation

@kibab
Copy link
Contributor

commented Jan 23, 2012

Hi Oleg,
thank you for your great work, USB Host Shield is really very useful software! One thing I've noticed is that it doesn't support Arduino Mega ADK board (designed by Google based on your USB host shield).
On Mega ADK, USB host controller Max3421e is already on the board, and it uses different pins for SPI SS, MAX INT and MAX RST. Thus some pins should be different for Mega ADK board.
I have added support for Mega ADK in this pull request. First of all, as Arduino IDE doesn't provide any way to set project-wide C++ conditional defines, I chose avrpins.h as a place for BOARD_MEGA_ADK #define. This file is included both by Usb.h and usbhost.h, where modifications should be made to make Mega ADK work.

The only modifications required are some pin differences and explicit reset line pull-up. I'm not sure that I did it in the most beautiful way, please correct me if nessesary.

Hope you'll find this work useful.

kibab added 3 commits Jan 23, 2012
- Create conditional define BOARD_MEGA_ADK and move it into avrpins.h…
…, which seems like a most suitable place for such things;

- Added pin define for Pj2;
- Use newly created BOARD_MEGA_ADK #define for separating Mega ADK-specific code from the common code.
@felis

This comment has been minimized.

Copy link
Owner

commented Jan 23, 2012

Thanks!

felis pushed a commit that referenced this pull request Jan 23, 2012
Oleg Mazurov
Merge pull request #3 from kibab/kibab
Arduino Mega ADK support in USB Host Shield 2.0 library

@felis felis merged commit 4dcef5e into felis:master Jan 23, 2012

@ghost

This comment has been minimized.

Copy link

commented Mar 16, 2012

Hi,
Doesn't "Pj2" need to be replaced by "Pe6"? As PJ2 is the reset pin and not the INT pin? See the schematic for more information: http://arduino.cc/en/uploads/Main/Arduino_ADK-Mega_2560-Rev3-reference-design.zip

Also wouldn't it be better to replace the following lines:

DDRJ |= 0x04;
PORTJ |= 0x04;

with:

DDRJ |= _BV(PJ2);
PORTJ |= _BV(PJ2);

As it's more readable?

Regards
Lauszus

@felis

This comment has been minimized.

Copy link
Owner

commented Mar 16, 2012

Hi,

This is not my code - I just accepted a pull request from some guy a
while ago.

Oleg.

On 3/16/2012 10:10 AM, TKJElectronics wrote:

Hi,
Doesn't "Pj2" need to be replaced by "Pe6"? As PJ2 is the reset pin and not the INT pin? See the schematic for more information: http://arduino.cc/en/uploads/Main/Arduino_ADK-Mega_2560-Rev3-reference-design.zip

Also would it be better to replace the following lines:
DDRJ |= 0x04;
PORTJ |= 0x04;
with:
DDRJ |= _BV(Pj2);
PORTJ |= _BV(Pj2);
As it's more readable?

Regards
Lauszus


Reply to this email directly or view it on GitHub:
#3 (comment)

@ghost

This comment has been minimized.

Copy link

commented Mar 16, 2012

Hi,
Yeah I know. My original though were to send him a email, but he hasn't provided one at his profile, so the only way to contact him where via this pull request.
I just bought an Arduino ADK, but it hasn't arrived yet, but I will let you know if I was right - and then make a new pull request if so.

Regards
Lauszus

@felis

This comment has been minimized.

Copy link
Owner

commented Mar 16, 2012

OK.

Have you seen my reply to your question about my shields?

On 3/16/2012 10:25 AM, TKJElectronics wrote:

Hi,
Yeah I know. My original though were to send him a email, but he hasn't provided one at his profile, so the only way to contact him where via this pull request.
I just bought an Arduino ADK, but it hasn't arrived yet, but I will let you know if I was right - and then make a new pull request if so.

Regards
Lauszus


Reply to this email directly or view it on GitHub:
#3 (comment)

@ghost

This comment has been minimized.

Copy link

commented Mar 16, 2012

No. I haven't received any email from you - I just checked my spam folder, but nothings there.

@felis

This comment has been minimized.

Copy link
Owner

commented Mar 16, 2012

If you need those shields for yourself, I can send you a couple for
free, just give me the address.

On 3/16/2012 10:33 AM, TKJElectronics wrote:

No. I haven't received any email from you - I just checked my spam folder, but nothings there.


Reply to this email directly or view it on GitHub:
#3 (comment)

@ghost

This comment has been minimized.

Copy link

commented Mar 16, 2012

Thank you - and yes it's only for personal use :)
I have sent an email to you with the information.

@kibab

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2012

Hi,
Pj2 is what stays in original code provided by Google. I also tried to use Pe6 with no result. Maybe I should try once again, but AFAIR it didn't work for me.
I fully agree with _BV() macro comment, though some people find it a sort of overkill.
I will create a new pull req as soon as I test Pj2 -> Pe6 transition.

@ghost

This comment has been minimized.

Copy link

commented Mar 20, 2012

Hi,
I have already made a new pull request (#6) :) So you can just download the library and see if it works.

Pj2 is the reset pin and Pe6 is the INT pin - see the schematic for more info: http://arduino.cc/en/uploads/Main/ADK_MEGA_2560-Rev2-sch.pdf also see the library at google's page: https://dl-ssl.google.com/android/adk/adk_release_0512.zip - see Max3421e.cpp line 39.

As I understand it, you used the reset pin (Pj2) as the INT pin? The reason why I think it worked anyways, is because most sketches doesn't used the INT pin, so it works even if you haven't selected the right one.

Oleg please correct me if I'm wrong?

@felis

This comment has been minimized.

Copy link
Owner

commented Mar 20, 2012

I don't know much about this board, nor do I care. As long as your mods don't touch the main code I'll accept anything.

@rolfarley

This comment has been minimized.

Copy link

commented Oct 1, 2012

Kibab, have you implemented anything using the USB shield and Arduino Mega ADK ?

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 1, 2012

Rolfarley if you are looking for an example, have a look at the following code: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino
You simply upload the code to your Arduino and then plug in your Android device it then ask you if you want to download the application.
It's a small app that lets you blink a LED I wrote a while back.

@rolfarley

This comment has been minimized.

Copy link

commented Oct 2, 2012

Thanks. Did you have the Android device plugged into the USB port from the USB shield for this ?

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 2, 2012

Yes of course. That's how they communicate.
If you want to use bluetooth instead have a look at the SPP library I also wrote here: http://blog.tkjelectronics.dk/2012/07/rfcommspp-library-for-arduino/ and http://www.circuitsathome.com/mcu/bluetooth-rfcommspp-service-support-for-usb-host-2-0-library-released.

@rolfarley

This comment has been minimized.

Copy link

commented Oct 2, 2012

Okay, thanks. I have a USB based sensor in my case and was using the Arduino Mega ADK. I need to pass the sensor data from the USB sensor to my Android handset and was intending to communicate between the Arduino and handset using the Mega ADK USB and communicate between the Arduino and sensor using the USB shield. (just wondering do I really need the USB shield in that case..can I connect a USB hub with the Arduino Mega ADK and plug the USB sensor and handset into the hub)

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 2, 2012

You simply add this line https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/hub_demo/hub_demo.pde#L12 to your code. You might need to add more of them as shown, as there can be more IC's in one usb hub.

@rolfarley

This comment has been minimized.

Copy link

commented Oct 2, 2012

Thanks very much, will try that out

@rolfarley

This comment has been minimized.

Copy link

commented Oct 3, 2012

Lauszus, when I try the ArduinoBlinkLED sketch (using the Arduino Mega ADK and the USB shield) I can't control the LED when I have my Android handset plugged into the USB Shield port (I've uncommented the #define BOARD_MEGA_ADK in the avrpins.h header file). (Only if I have it plugged into the USB port of the Arduino Mega ADK does it control the LED -- if I want to use the USB from the shield is there something I'm missing ?)

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 3, 2012

Rolfarley,
Why do you even want to use the USB Host shield AND the ADK USB Host functionality at the same time?

@rolfarley

This comment has been minimized.

Copy link

commented Oct 3, 2012

Lauszus,
I'm wondering about that myself, although I thought the pull documented in this thread added support for the shield on the Mega ADK. It's also that the USB shield is much more compact than a minihub I'd have to plug into the ADK usb port (for a usb sensor and an Android handset).

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 3, 2012

Rolfarley,
No this pull enabled support for the ADK it self. The shield was supported before this pull request.
But you can't use the onboard MAX3421 and the one on the USB Host shield at the same time without modifying the code.

@rolfarley

This comment has been minimized.

Copy link

commented Oct 3, 2012

Lauszus, thanks for clarifying, I've been using the USB Hub sketch examples you mentioned above on the ADK itself (without the shield) and they're working alright. I should be able to find a small enough two port mini hub to satisfy a quick prototype.

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 3, 2012

Rolfarley,
Okay. Yes I think that would differently be better. Or you could try to buy a USB Hub IC and then make your own tiny custom pcb, that would be a fun project :)

@rolfarley

This comment has been minimized.

Copy link

commented Oct 8, 2012

Lauszus, I'm struggling a bit on how to communicate with my USB sensor - I can extract data from it using a basic hyperterminal (115200, 8 bits no parity) and want to basically grab/read the same data from Arduino Mega ADK. I've used the USB Hub Sketch example when it is plugged into a mini HUB along with an Android phone and see the two ports enumerated. Can you point me to any sketch or example ?
Any help would be greatly appreciated.

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Oct 8, 2012

What type of USB sensor are we talking about. Is it just a basic FTDI device? If so have a look at this example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/ftdi/USBFTDILoopback/USBFTDILoopback.pde
Also have a look at the PL2303 examples: https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/pl2303

@rolfarley

This comment has been minimized.

Copy link

commented Oct 8, 2012

Thanks once again, modified that sketch and am getting the sensor data, on my way to completion

@rolfarley

This comment has been minimized.

Copy link

commented Nov 13, 2012

Hi once again, I'm having issues with my interface to the Android Handset - the first data sent goes through, but all subsequent data I send using adk.SndData gets a return code of hrNAK (4). The Android application on my phone appears to still be running fine (although I'm having trouble debugging or seeing what's going on - I thought I could use "adb wireless" but I can't have it running while I have my handset connected to the Arduino)
Would you have ay ideas or suggestions ?

void loop()
{
Usb.Task();

if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
{
    if(adk.isReady()) {

          yaw += 1;
          // Shift PM Value from long int to 4 byte msg, higher order byte in msg[1]
          msg[0] = 0x1;
          msg[1] = yaw >> 24;
          msg[2] = yaw >> 16;
          msg[3] = yaw >> 8;
          msg[4] = yaw & 0xff;

          Serial.print(msg[0], HEX);
          Serial.print(msg[1], HEX);
          Serial.print(msg[2], HEX);
          Serial.print(msg[3], HEX);
          Serial.print(msg[4], HEX);

          len = sizeof(msg);
          rcode = adk.SndData(len, msg);
          //signature:  SndData(uint16_t nbytes, uint8_t *dataptr);
          if(!rcode && rcode != hrNAK) {
             Serial.print("DEBUG Data send successful");
             Serial.println(rcode);
          }
          else  {
             Serial.println("DEBUG Failed to send data");
             Serial.println(rcode);
          }
    }
@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 13, 2012

Hi again,

try to change this line:
if(!rcode && rcode != hrNAK) {
To:
if(!rcode || rcode == hrNAK) {

But it will give more sense just to check if there is an error or not. Take a look at this line: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/adk/ArduinoBlinkLED/ArduinoBlinkLED.ino#L35-36

Try to post the rest of your code somewhere - for instance at gist: https://gist.github.com/, then I will have a look at it.

@rolfarley

This comment has been minimized.

Copy link

commented Nov 13, 2012

Here is the full Arduino sketch: https://gist.github.com/4067762

I'm sending just dummy data now (was sending from USB based sensor initially but had the same issue). I have an Android charting app running and I get the first value, but each subsequent one from the Arduino I get an rcode of 4 (hrNAK) from the adk.SndData function and the Android charting app doesn't receive.
I'm not able to debug using something like wireless ADB while connected to the Arduino.

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 13, 2012

The code looks alright. It might be related to your Android code. Take a look at this excellent guide: http://allaboutee.com/2011/12/31/arduino-adk-board-how-send-data-from-the-board-to-the-android-device/

@rolfarley

This comment has been minimized.

Copy link

commented Nov 13, 2012

Thanks, very much, appreciate it.

@bricol

This comment has been minimized.

Copy link

commented Nov 29, 2013

Hi all.
Thanks for all the work you have been doing on USB communication over Arduino. I have an arduino MEGA ADK and want to use its USB port to receive data from an RFID reader. First, I tried to implement the classic keyboard code whose sketch is presented below; so I downloaded and installed the USB_Host_Shield_2.0 from Felis and I modified the avrpins.h, usbhost.h and Usb.h to take of the MEGA ADK USB as suggested by Kibab.

//sketch

#include <avr/pgmspace.h>
#include <avrpins.h>
#include <max3421e.h>
#include <usbhost.h>
#include <usb_ch9.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <address.h>
#include <hidboot.h>
#include <printhex.h>
#include <message.h>
#include <hexdump.h>
#include <parsetools.h>
class KbdRptParser : public KeyboardReportParser
{
void PrintKey(uint8_t mod, uint8_t key);
protected:
virtual void OnKeyDown
(uint8_t mod, uint8_t key);
virtual void OnKeyUp
(uint8_t mod, uint8_t key);
virtual void OnKeyPressed(uint8_t key);
};
void KbdRptParser::PrintKey(uint8_t m, uint8_t key)
{
MODIFIERKEYS mod;
((uint8_t)&mod) = m;
Serial.print((mod.bmLeftCtrl == 1) ? "C" : " ");
Serial.print((mod.bmLeftShift == 1) ? "S" : " ");
Serial.print((mod.bmLeftAlt == 1) ? "A" : " ");
Serial.print((mod.bmLeftGUI == 1) ? "G" : " ");
Serial.print(" >");
PrintHex<uint8_t>(key);
Serial.print("< ");
Serial.print((mod.bmRightCtrl == 1) ? "C" : " ");
Serial.print((mod.bmRightShift == 1) ? "S" : " ");
Serial.print((mod.bmRightAlt == 1) ? "A" : " ");
Serial.println((mod.bmRightGUI == 1) ? "G" : " ");
};
void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)
{
Serial.print("DN ");
PrintKey(mod, key);
uint8_t c = OemToAscii(mod, key);
if (c)
OnKeyPressed(c);
}
void KbdRptParser::OnKeyUp(uint8_t mod, uint8_t key)
{
Serial.print("UP ");
PrintKey(mod, key);
}
void KbdRptParser::OnKeyPressed(uint8_t key)
{
Serial.print("ASCII: ");
Serial.println((char)key);
};
USB Usb;
//USBHub Hub(&Usb);
HIDBoot<HID_PROTOCOL_KEYBOARD>
Keyboard(&Usb);
uint32_t next_time;
KbdRptParser Prs;
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
if (Usb.Init() == -1)
Serial.println("OSC did not start.");
delay( 200 );
next_time = millis() + 5000;
Keyboard.SetReportParser(0, (HIDReportParser*)&Prs);
}
void loop()
{
Usb.Task();
}
///////////////////////////////////////////////

After I had compiled the sketch above and I had the folloiming errors. can someone please help?

//errors generated after compilation

In file included from USBcomarduionokeyboard.cpp:4:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/max3421e.h:18:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20/usbhost.h:22:0,
from USBcomarduionokeyboard.cpp:5:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/max3421e.h:18:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20/usbhost.h:23:0,
from USBcomarduionokeyboard.cpp:5:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/usb_ch9.h:19:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:6:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/usb_ch9.h:19:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:10:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/address.h:19:2: error: #error "Never include address.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:12:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/printhex.h:19:2: error: #error "Never include printhex.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:13:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/message.h:18:2: error: #error "Never include message.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:14:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/hexdump.h:18:2: error: #error "Never include hexdump.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:3:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20/avrpins.h:1:1: error: expected unqualified-id before numeric constant

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 29, 2013

There is no need to modify the code. Simply just set this value: https://github.com/felis/USB_Host_Shield_2.0/blob/master/settings.h#L32 to 1 instead ;)

@bricol

This comment has been minimized.

Copy link

commented Nov 29, 2013

oups! sorry I don't know why the libraries did not appear in the comment above but here there are in the same order
avr/pgmspace.h
avrpins.h
max3421e.h
usbhost.h
usb_ch9.h
Usb.h
usbhub.h
avr/pgmspace.h
address.h
hidboot.h
printhex.h
message.h
hexdump.h
parsetools.h

@xxxajk

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2013

Don't include all those includes, they are no longer needed. You only need
top include Usb.h

On Fri, Nov 29, 2013 at 2:14 PM, bricol notifications@github.com wrote:

oups! sorry I don't know why the libraries did not appear in the comment
above but here there are in the same order
avr/pgmspace.h
avrpins.h
max3421e.h
usbhost.h
usb_ch9.h
Usb.h
usbhub.h
avr/pgmspace.h
address.h
hidboot.h
printhex.h
message.h
hexdump.h
parsetools.h


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-29533126
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@xxxajk

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2013

Oh, also, include Arduino.h

On Fri, Nov 29, 2013 at 2:20 PM, Andrew Kroll xxxajk@gmail.com wrote:

Don't include all those includes, they are no longer needed. You only need
top include Usb.h

On Fri, Nov 29, 2013 at 2:14 PM, bricol notifications@github.com wrote:

oups! sorry I don't know why the libraries did not appear in the comment
above but here there are in the same order
avr/pgmspace.h
avrpins.h
max3421e.h
usbhost.h
usb_ch9.h
Usb.h
usbhub.h
avr/pgmspace.h
address.h
hidboot.h
printhex.h
message.h
hexdump.h
parsetools.h


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-29533126
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 29, 2013

@xxxajk it is not needed. It will be included if he includes Usb.h.

@bricol

This comment has been minimized.

Copy link

commented Nov 29, 2013

I have applied the changes you (Lauszus) suggested but to no avail I have the following errors. Am I to make changes suggested to Kibab ?

//errors
In file included from USBcomarduionokeyboard.cpp:4:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/max3421e.h:18:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usbhost.h:22:0,
from USBcomarduionokeyboard.cpp:5:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/max3421e.h:18:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usbhost.h:23:0,
from USBcomarduionokeyboard.cpp:5:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usb_ch9.h:19:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:6:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usb_ch9.h:19:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:10:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/address.h:19:2: error: #error "Never include address.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:12:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/printhex.h:19:2: error: #error "Never include printhex.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:13:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/message.h:18:2: error: #error "Never include message.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:14:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h:18:2: error: #error "Never include hexdump.h directly; include Usb.h instead"
In file included from USBcomarduionokeyboard.cpp:3:0:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/avrpins.h:1:1: error: expected unqualified-id before numeric constant

@bricol

This comment has been minimized.

Copy link

commented Nov 29, 2013

when I include just Usb.h I have the following errors :

In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usbhost.h:22:0,
from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:33,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/max3421e.h:18:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:34:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usb_ch9.h:19:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:31:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/avrpins.h:1:1: error: expected unqualified-id before numeric constant
In file included from /usr/lib/gcc/avr/4.7.0/../../../avr/include/avr/io.h:439:0,
from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/avrpins.h:28,
from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:31,
from USBcomarduionokeyboard.cpp:7:
/usr/lib/gcc/avr/4.7.0/../../../avr/include/avr/fuse.h:244:3: error: ‘__fuse_t’ does not name a type
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usbhost.h:21:0,
from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:33,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/avrpins.h:1:1: error: expected unqualified-id before numeric constant
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usbhost.h:23:0,
from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:33,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/usb_ch9.h:113:27: error: ‘USB_DEVICE_DESCRIPTOR’ does not name a type
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:35:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/address.h: In member function ‘virtual UsbDevice* AddressPoolImpl<MAX_DEVICES_ALLOWED>::GetUsbDevicePtr(uint8_t)’:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/address.h:180:34: error: ‘NULL’ was not declared in this scope
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:43:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/printhex.h: In function ‘void SerialPrintHex(T)’:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/printhex.h:52:17: error: ‘USB_HOST_SERIAL’ was not declared in this scope
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:44:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h: In member function ‘virtual void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(LEN_TYPE, const uint8_t*, const OFFSET_TYPE&)’:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h:48:58: error: there are no arguments to ‘E_Notify’ that depend on a template parameter, so a declaration of ‘E_Notify’ must be available [-fpermissive]
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h:48:58: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h:51:49: error: there are no arguments to ‘E_Notify’ that depend on a template parameter, so a declaration of ‘E_Notify’ must be available [-fpermissive]
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/hexdump.h:54:60: error: there are no arguments to ‘E_Notify’ that depend on a template parameter, so a declaration of ‘E_Notify’ must be available [-fpermissive]
USBcomarduionokeyboard.cpp: At global scope:
USBcomarduionokeyboard.cpp:20:1: error: expected class-name before ‘{’ token
USBcomarduionokeyboard.cpp: In member function ‘void KbdRptParser::PrintKey(uint8_t, uint8_t)’:
USBcomarduionokeyboard.cpp:31:1: error: ‘MODIFIERKEYS’ was not declared in this scope
USBcomarduionokeyboard.cpp:31:14: error: expected ‘;’ before ‘mod’
USBcomarduionokeyboard.cpp:32:14: error: ‘mod’ was not declared in this scope
USBcomarduionokeyboard.cpp:38:22: error: no matching function for call to ‘PrintHex(uint8_t&)’
USBcomarduionokeyboard.cpp:38:22: note: candidate is:
In file included from /home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/Usb.h:43:0,
from USBcomarduionokeyboard.cpp:7:
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/printhex.h:26:6: note: template void PrintHex(T, int)
/home/pifou/sketchbook/libraries/USB_Host_Shield_20_v1/printhex.h:26:6: note: template argument deduction/substitution failed:
USBcomarduionokeyboard.cpp:38:22: note: candidate expects 2 arguments, 1 provided
USBcomarduionokeyboard.cpp: In member function ‘virtual void KbdRptParser::OnKeyDown(uint8_t, uint8_t)’:
USBcomarduionokeyboard.cpp:49:32: error: ‘OemToAscii’ was not declared in this scope
USBcomarduionokeyboard.cpp: At global scope:
USBcomarduionokeyboard.cpp:65:1: error: ‘HIDBoot’ does not name a type
USBcomarduionokeyboard.cpp: In function ‘void setup()’:
USBcomarduionokeyboard.cpp:77:1: error: ‘Keyboard’ was not declared in this scope
USBcomarduionokeyboard.cpp:77:30: error: ‘HIDReportParser’ was not declared in this scope
USBcomarduionokeyboard.cpp:77:46: error: expected primary-expression before ‘)’ token

@bricol

This comment has been minimized.

Copy link

commented Nov 29, 2013

I am certain I have no problem with the libraries but if anyone has succesfully communicated between keyboard and arduino ADK over USB, may I have the sketch and the a link to the libraries. I later on adjust the sketch to fit the RFID reader.

@xxxajk

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2013

Do you include Arduino.h?
Do you include the driver header for HID?

On Fri, Nov 29, 2013 at 2:49 PM, bricol notifications@github.com wrote:

I am certain I have no problem with the libraries but if anyone has
succesfully communicated between keyboard and arduino ADK over USB, may I
have the sketch and the a link to the libraries. I later on adjust the
sketch to fit the RFID reader.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-29534934
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@xxxajk

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2013

Just do exactly as the error messages say...

DO NOT include the following in your sketch:

max3421e.h
usb_ch9.h
address.h
printhex.h
message.h
hexdump.h

Once you eliminate those includes in any of your files in your sketch
directory
(ino/pde/c/cpp/h files) everything will compile quite happily.

I don't understand what you do not understand about the message, it is
pretty clear.
The error message is telling you exactly why YOUR code does not compile.

On Fri, Nov 29, 2013 at 3:40 PM, Andrew Kroll xxxajk@gmail.com wrote:

Do you include Arduino.h?
Do you include the driver header for HID?

On Fri, Nov 29, 2013 at 2:49 PM, bricol notifications@github.com wrote:

I am certain I have no problem with the libraries but if anyone has
succesfully communicated between keyboard and arduino ADK over USB, may I
have the sketch and the a link to the libraries. I later on adjust the
sketch to fit the RFID reader.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-29534934
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@xxxajk

This comment has been minimized.

Copy link
Contributor

commented Nov 29, 2013

Looking closer at your error messages, you must remove the include lines
from USBcomarduionokeyboard.cpp
To be clear on the matter...This is still considered your code. It isn't
ours, for sure.

On Fri, Nov 29, 2013 at 3:48 PM, Andrew Kroll xxxajk@gmail.com wrote:

Just do exactly as the error messages say...

DO NOT include the following in your sketch:

max3421e.h
usb_ch9.h
address.h
printhex.h
message.h
hexdump.h

Once you eliminate those includes in any of your files in your sketch
directory
(ino/pde/c/cpp/h files) everything will compile quite happily.

I don't understand what you do not understand about the message, it is
pretty clear.
The error message is telling you exactly why YOUR code does not compile.

On Fri, Nov 29, 2013 at 3:40 PM, Andrew Kroll xxxajk@gmail.com wrote:

Do you include Arduino.h?
Do you include the driver header for HID?

On Fri, Nov 29, 2013 at 2:49 PM, bricol notifications@github.com wrote:

I am certain I have no problem with the libraries but if anyone has
succesfully communicated between keyboard and arduino ADK over USB, may I
have the sketch and the a link to the libraries. I later on adjust the
sketch to fit the RFID reader.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3#issuecomment-29534934
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

Visit my github for awesome Arduino code @ https://github.com/xxxajk

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 30, 2013

@bricol notice the status of this pull request: "Merged". This means that the changes done by Kibab is added to the code, so you should NOT modify the code in anyway. The only thing you change is setting the value USE_UHS_MEGA_ADK to 1. See: https://github.com/felis/USB_Host_Shield_2.0#boards.

Please do that and try one of the examples and report back if it is working or not :)

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Nov 30, 2013

Also note that if you are using the newest version of Arduino - which is 1.5.5. You do not have to modify anything, as it will automatically detect if an Arduino ADK is used :)

@bricol

This comment has been minimized.

Copy link

commented Dec 2, 2013

@Lauszus thanks once more for your collaboration. I have downloaded the library and changed the USE_UHS_MEGA_ADK to 1 as you suggested. when I try to compile the acm_terminal example it compiles but when I connect a keyboard to the arduino ADK USB port, I have no output on the serial monitor except "start". Is the aim of this example to print input characters from the keyboard?

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Dec 2, 2013

@bricol you should use the following example: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/HID/USBHIDBootKbd/USBHIDBootKbd.ino if you want to use a keyboard with the ADK.
Btw it might be a good idea to enable serial debugging: https://github.com/felis/USB_Host_Shield_2.0#enable-debugging until you get familiar with the code.

@bricol

This comment has been minimized.

Copy link

commented Dec 3, 2013

@Lauszus interesting !! I have compile the USBHIDBootKbd.ino and IT WORKS. Thanks. Super !! Now I have started thinking about proceeding with the USB RFID/barcode reader (can read both RFID and barcodes). I found the adk_barcode.ino amongst the examples and it seems logicial to me that I can use it to receive data from the reader. It compiles but on the serial monitor I can only see "ADK demo start" but no data from the scanner. Do you how I can access the data from the reader? Thanks

@Lauszus

This comment has been minimized.

Copy link
Collaborator

commented Dec 3, 2013

romerod pushed a commit to romerod/USB_Host_Shield_2.0 that referenced this pull request Jul 13, 2018
Merge pull request felis#3 from torarnv/move-to-lib
Move librespot into lib.rs and let main.rs be the test binary
romerod pushed a commit to romerod/USB_Host_Shield_2.0 that referenced this pull request Jul 13, 2018
Changed requirements see felis#3
I jumped the gun
romerod pushed a commit to romerod/USB_Host_Shield_2.0 that referenced this pull request Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.