USB Host Shield Support Google Android ADK for Adrduino UNO MEGA 2560 Duemilanove

Description:

USB Host Shield Support Google For Uno For Android ADK & UNO 328 MEGA 2560 Duemilanove
support the for Google Android ADK, supporting Android phone: G1, Nexus One, Nexus S, Droid X
(Mobile systems need to upgrade to Android 2.3.4, tablet PCs need to upgrade to Android 3.1)

Provides APK package, and compiled source files ADK Compatible with for Uno following hardware:
For Uno 328
For Uno Diecimila / Duemilanove 328
For Uno Mega 2560 (recommended)
For Uno Mega 1280
to achieve with for Uno USB HOST function, you can communicate with other USB devices, and support USB HUB function

toachieve USB HSTfunction, you cancommunicatewith otherUSB devices, andsupportUSB HUBf










Features:

Max3421 library

Kit include:

1 PCS x USB Host Shield

Documents:


Mikroelectron Code:

//barcode_usb.ino

#include <usbhid.h>

#include <usbhub.h>

#include <hiduniversal.h>

#include <hidboot.h>

#include <SPI.h>


class MyParser : public HIDReportParser {

  public:

    MyParser();

    void Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);

  protected:

    uint8_t KeyToAscii(bool upper, uint8_t mod, uint8_t key);

    virtual void OnKeyScanned(bool upper, uint8_t mod, uint8_t key);

    virtual void OnScanFinished();

};


MyParser::MyParser() {}


void MyParser::Parse(USBHID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) {

  // If error or empty, return

  if (buf[2] == 1 || buf[2] == 0) return;


  for (uint8_t i = 7; i >= 2; i--) {

    // If empty, skip

    if (buf[i] == 0) continue;


    // If enter signal emitted, scan finished

    if (buf[i] == UHS_HID_BOOT_KEY_ENTER) {

      OnScanFinished();

    }


    // If not, continue normally

    else {

      // If bit position not in 2, it's uppercase words

      OnKeyScanned(i > 2, buf, buf[i]);

    }


    return;

  }

}


uint8_t MyParser::KeyToAscii(bool upper, uint8_t mod, uint8_t key) {

  // Letters

  if (VALUE_WITHIN(key, 0x04, 0x1d)) {

    if (upper) return (key - 4 + 'A');

    else return (key - 4 + 'a');

  }


  // Numbers

  else if (VALUE_WITHIN(key, 0x1e, 0x27)) {

    return ((key == UHS_HID_BOOT_KEY_ZERO) ? '0' : key - 0x1e + '1');

  }


  return 0;

}


void MyParser::OnKeyScanned(bool upper, uint8_t mod, uint8_t key) {

  uint8_t ascii = KeyToAscii(upper, mod, key);

  Serial.print((char)ascii);

}


void MyParser::OnScanFinished() {

  Serial.println(" - Finished");

}


USB          Usb;

USBHub       Hub(&Usb);

HIDUniversal Hid(&Usb);

MyParser     Parser;


void setup() {

  Serial.begin( 115200 );

  Serial.println("Start");


  if (Usb.Init() == -1) {

    Serial.println("OSC did not start.");

  }


  delay( 200 );


  Hid.SetReportParser(0, &Parser);

}


void loop() {

  Usb.Task();

}

19 JD
Quantity
3 in stock
19 JD 1+ units
21.85 JD 10+ units
20.7 JD 25+ units
19.55 JD 100+ units



Related Products

subscribe to our weekly newsletter

loading