mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge branch 'xxxajk' of github.com:felis/USB_Host_Shield_2.0 into xxxajk
This commit is contained in:
commit
58f6444a8b
36 changed files with 196 additions and 394 deletions
161
BTD.cpp
161
BTD.cpp
|
@ -34,45 +34,37 @@ qNextPollTime(0), // Reset NextPollTime
|
||||||
pollInterval(0),
|
pollInterval(0),
|
||||||
bPollEnable(false) // Don't start polling before dongle is connected
|
bPollEnable(false) // Don't start polling before dongle is connected
|
||||||
{
|
{
|
||||||
uint8_t i;
|
for (uint8_t i = 0; i < BTD_NUMSERVICES; i++)
|
||||||
for (i = 0; i < BTD_MAX_ENDPOINTS; i++) {
|
|
||||||
epInfo[i].epAddr = 0;
|
|
||||||
epInfo[i].maxPktSize = (i) ? 0 : 8;
|
|
||||||
epInfo[i].epAttribs = 0;
|
|
||||||
epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
|
|
||||||
}
|
|
||||||
for (i = 0; i < BTD_NUMSERVICES; i++)
|
|
||||||
btService[i] = NULL;
|
btService[i] = NULL;
|
||||||
|
|
||||||
if (pUsb) // register in USB subsystem
|
clearAllVariables(); // Set all variables, endpoint structs etc. to default values
|
||||||
pUsb->RegisterDeviceClass(this); //set devConfig[] entry
|
|
||||||
|
if (pUsb) // Register in USB subsystem
|
||||||
|
pUsb->RegisterDeviceClass(this); // Set devConfig[] entry
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
|
const uint8_t constBufSize = sizeof (USB_DEVICE_DESCRIPTOR);
|
||||||
|
uint8_t buf[constBufSize];
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
UsbDevice *p = NULL;
|
UsbDevice *p = NULL;
|
||||||
EpInfo *oldep_ptr = NULL;
|
EpInfo *oldep_ptr = NULL;
|
||||||
uint8_t num_of_conf; // number of configurations
|
|
||||||
uint16_t PID;
|
|
||||||
uint16_t VID;
|
|
||||||
|
|
||||||
// get memory address of USB device address pool
|
clearAllVariables(); // Set all variables, endpoint structs etc. to default values
|
||||||
AddressPool &addrPool = pUsb->GetAddressPool();
|
|
||||||
|
AddressPool &addrPool = pUsb->GetAddressPool(); // Get memory address of USB device address pool
|
||||||
#ifdef EXTRADEBUG
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("\r\nBTD Init"), 0x80);
|
Notify(PSTR("\r\nBTD ConfigureDevice"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
// check if address has already been assigned to an instance
|
|
||||||
if (bAddress) {
|
if (bAddress) { // Check if address has already been assigned to an instance
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nAddress in use"), 0x80);
|
Notify(PSTR("\r\nAddress in use"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
|
return USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get pointer to pseudo device with address 0 assigned
|
p = addrPool.GetUsbDevicePtr(0); // Get pointer to pseudo device with address 0 assigned
|
||||||
p = addrPool.GetUsbDevicePtr(0);
|
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nAddress not found"), 0x80);
|
Notify(PSTR("\r\nAddress not found"), 0x80);
|
||||||
|
@ -87,66 +79,94 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
return USB_ERROR_EPINFO_IS_NULL;
|
return USB_ERROR_EPINFO_IS_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save old pointer to EP_RECORD of address 0
|
oldep_ptr = p->epinfo; // Save old pointer to EP_RECORD of address 0
|
||||||
oldep_ptr = p->epinfo;
|
p->epinfo = epInfo; // Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
|
||||||
|
|
||||||
// Temporary assign new pointer to epInfo to p->epinfo in order to avoid toggle inconsistence
|
|
||||||
p->epinfo = epInfo;
|
|
||||||
|
|
||||||
p->lowspeed = lowspeed;
|
p->lowspeed = lowspeed;
|
||||||
|
rcode = pUsb->getDevDescr(0, 0, constBufSize, (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
|
||||||
|
|
||||||
// Get device descriptor
|
p->epinfo = oldep_ptr; // Restore p->epinfo
|
||||||
rcode = pUsb->getDevDescr(0, 0, sizeof (USB_DEVICE_DESCRIPTOR), (uint8_t*)buf); // Get device descriptor - addr, ep, nbytes, data
|
|
||||||
|
|
||||||
// Restore p->epinfo
|
|
||||||
p->epinfo = oldep_ptr;
|
|
||||||
|
|
||||||
if (rcode)
|
if (rcode)
|
||||||
goto FailGetDevDescr;
|
goto FailGetDevDescr;
|
||||||
|
|
||||||
// Allocate new address according to device class
|
bAddress = addrPool.AllocAddress(parent, false, port); // Allocate new address according to device class
|
||||||
bAddress = addrPool.AllocAddress(parent, false, port);
|
|
||||||
|
|
||||||
if (!bAddress)
|
if (!bAddress) {
|
||||||
|
#ifdef DEBUG_USB_HOST
|
||||||
|
Notify(PSTR("\r\nOut of address space"), 0x80);
|
||||||
|
#endif
|
||||||
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
|
return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract Max Packet Size from device descriptor
|
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
|
||||||
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0;
|
epInfo[1].epAddr = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations; // Steal and abuse from epInfo structure to save memory
|
||||||
|
|
||||||
// Assign new address to the device
|
VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
|
||||||
rcode = pUsb->setAddr(0, 0, bAddress);
|
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
|
||||||
|
|
||||||
|
return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET;
|
||||||
|
|
||||||
|
FailGetDevDescr:
|
||||||
|
#ifdef DEBUG_USB_HOST
|
||||||
|
NotifyFailGetDevDescr(rcode);
|
||||||
|
#endif
|
||||||
|
rcode = USB_ERROR_FailGetDevDescr;
|
||||||
|
Release();
|
||||||
|
return rcode;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
|
uint8_t rcode;
|
||||||
|
uint8_t num_of_conf = epInfo[1].epAddr; // Number of configurations
|
||||||
|
epInfo[1].epAddr = 0;
|
||||||
|
|
||||||
|
AddressPool &addrPool = pUsb->GetAddressPool();
|
||||||
|
#ifdef EXTRADEBUG
|
||||||
|
Notify(PSTR("\r\nBTD Init"), 0x80);
|
||||||
|
#endif
|
||||||
|
UsbDevice *p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
|
||||||
|
|
||||||
|
if (!p) {
|
||||||
|
#ifdef DEBUG_USB_HOST
|
||||||
|
Notify(PSTR("\r\nAddress not found"), 0x80);
|
||||||
|
#endif
|
||||||
|
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(300); // Assign new address to the device
|
||||||
|
|
||||||
|
rcode = pUsb->setAddr(0, 0, bAddress); // Assign new address to the device
|
||||||
if (rcode) {
|
if (rcode) {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nsetAddr: "), 0x80);
|
Notify(PSTR("\r\nsetAddr: "), 0x80);
|
||||||
D_PrintHex<uint8_t > (rcode, 0x80);
|
D_PrintHex<uint8_t > (rcode, 0x80);
|
||||||
#endif
|
#endif
|
||||||
|
p->lowspeed = false;
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
#ifdef EXTRADEBUG
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("\r\nAddr: "), 0x80);
|
Notify(PSTR("\r\nAddr: "), 0x80);
|
||||||
D_PrintHex<uint8_t > (bAddress, 0x80);
|
D_PrintHex<uint8_t > (bAddress, 0x80);
|
||||||
#endif
|
#endif
|
||||||
delay(300); // Spec says you should wait at least 200ms
|
|
||||||
|
|
||||||
p->lowspeed = false;
|
p->lowspeed = false;
|
||||||
|
|
||||||
//get pointer to assigned address record
|
p = addrPool.GetUsbDevicePtr(bAddress); // Get pointer to assigned address record
|
||||||
p = addrPool.GetUsbDevicePtr(bAddress);
|
if (!p) {
|
||||||
if (!p)
|
#ifdef DEBUG_USB_HOST
|
||||||
|
Notify(PSTR("\r\nAddress not found"), 0x80);
|
||||||
|
#endif
|
||||||
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
|
return USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL;
|
||||||
|
}
|
||||||
|
|
||||||
p->lowspeed = lowspeed;
|
p->lowspeed = lowspeed;
|
||||||
|
|
||||||
// Assign epInfo to epinfo pointer - only EP0 is known
|
rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo); // Assign epInfo to epinfo pointer - only EP0 is known
|
||||||
rcode = pUsb->setEpInfoEntry(bAddress, 1, epInfo);
|
|
||||||
if (rcode)
|
if (rcode)
|
||||||
goto FailSetDevTblEntry;
|
goto FailSetDevTblEntry;
|
||||||
VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
|
|
||||||
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
|
|
||||||
|
|
||||||
if (VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
|
if (VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
|
||||||
/* We only need the Control endpoint, so we don't have to initialize the other endpoints of device */
|
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device
|
||||||
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1);
|
|
||||||
if (rcode)
|
if (rcode)
|
||||||
goto FailSetConfDescr;
|
goto FailSetConfDescr;
|
||||||
|
|
||||||
|
@ -184,8 +204,6 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
Release(); // Release device
|
Release(); // Release device
|
||||||
return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; // Return
|
return USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED; // Return
|
||||||
} else {
|
} else {
|
||||||
num_of_conf = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations;
|
|
||||||
|
|
||||||
// Check if attached device is a Bluetooth dongle and fill endpoint data structure
|
// Check if attached device is a Bluetooth dongle and fill endpoint data structure
|
||||||
// First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
|
// First interface in the configuration must have Bluetooth assigned Class/Subclass/Protocol
|
||||||
// And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
|
// And 3 endpoints - interrupt-IN, bulk-IN, bulk-OUT, not necessarily in this order
|
||||||
|
@ -211,8 +229,6 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
if (rcode)
|
if (rcode)
|
||||||
goto FailSetDevTblEntry;
|
goto FailSetDevTblEntry;
|
||||||
|
|
||||||
delay(200); // Give time for address change
|
|
||||||
|
|
||||||
// Set Configuration Value
|
// Set Configuration Value
|
||||||
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
|
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, bConfNum);
|
||||||
if (rcode)
|
if (rcode)
|
||||||
|
@ -270,6 +286,28 @@ Fail:
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BTD::clearAllVariables() {
|
||||||
|
uint8_t i;
|
||||||
|
for (i = 0; i < BTD_MAX_ENDPOINTS; i++) {
|
||||||
|
epInfo[i].epAddr = 0;
|
||||||
|
epInfo[i].maxPktSize = (i) ? 0 : 8;
|
||||||
|
epInfo[i].epAttribs = 0;
|
||||||
|
epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
|
||||||
|
}
|
||||||
|
for (i = 0; i < BTD_NUMSERVICES; i++) {
|
||||||
|
if (btService[i])
|
||||||
|
btService[i]->Reset(); // Reset all Bluetooth services
|
||||||
|
}
|
||||||
|
|
||||||
|
connectToWii = false;
|
||||||
|
pairWithWii = false;
|
||||||
|
bAddress = 0; // Clear device address
|
||||||
|
bNumEP = 1; // Must have to be reset to 1
|
||||||
|
qNextPollTime = 0; // Reset next poll time
|
||||||
|
pollInterval = 0;
|
||||||
|
bPollEnable = false; // Don't start polling before dongle is connected
|
||||||
|
}
|
||||||
|
|
||||||
/* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
|
/* Extracts interrupt-IN, bulk-IN, bulk-OUT endpoint information from config descriptor */
|
||||||
void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
|
void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *pep) {
|
||||||
//ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
|
//ErrorMessage<uint8_t>(PSTR("Conf.Val"),conf);
|
||||||
|
@ -323,15 +361,8 @@ void BTD::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
|
||||||
|
|
||||||
/* Performs a cleanup after failed Init() attempt */
|
/* Performs a cleanup after failed Init() attempt */
|
||||||
uint8_t BTD::Release() {
|
uint8_t BTD::Release() {
|
||||||
for (uint8_t i = 0; i < BTD_NUMSERVICES; i++) {
|
clearAllVariables(); // Set all variables, endpoint structs etc. to default values
|
||||||
if (btService[i])
|
|
||||||
btService[i]->Reset(); // Reset all Bluetooth services
|
|
||||||
}
|
|
||||||
|
|
||||||
pUsb->GetAddressPool().FreeAddress(bAddress);
|
pUsb->GetAddressPool().FreeAddress(bAddress);
|
||||||
bAddress = 0;
|
|
||||||
bPollEnable = false;
|
|
||||||
bNumEP = 1; // must have to be reset to 1
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,6 +811,10 @@ void BTD::HCI_task() {
|
||||||
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
|
for (uint8_t i = 0; i < BULK_MAXPKTSIZE; i++)
|
||||||
l2capinbuf[i] = 0;
|
l2capinbuf[i] = 0;
|
||||||
|
|
||||||
|
connectToWii = false;
|
||||||
|
incomingWii = false;
|
||||||
|
pairWithWii = false;
|
||||||
|
|
||||||
hci_state = HCI_SCANNING_STATE;
|
hci_state = HCI_SCANNING_STATE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
11
BTD.h
11
BTD.h
|
@ -162,6 +162,14 @@ public:
|
||||||
BTD(USB *p);
|
BTD(USB *p);
|
||||||
|
|
||||||
/** @name USBDeviceConfig implementation */
|
/** @name USBDeviceConfig implementation */
|
||||||
|
/**
|
||||||
|
* Address assignment and basic initilization is done here.
|
||||||
|
* @param parent Hub number.
|
||||||
|
* @param port Port number on the hub.
|
||||||
|
* @param lowspeed Speed of the device.
|
||||||
|
* @return 0 on success.
|
||||||
|
*/
|
||||||
|
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed);
|
||||||
/**
|
/**
|
||||||
* Initialize the Bluetooth dongle.
|
* Initialize the Bluetooth dongle.
|
||||||
* @param parent Hub number.
|
* @param parent Hub number.
|
||||||
|
@ -455,8 +463,11 @@ protected:
|
||||||
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
|
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void clearAllVariables(); // Set all variables, endpoint structs etc. to default values
|
||||||
BluetoothService* btService[BTD_NUMSERVICES];
|
BluetoothService* btService[BTD_NUMSERVICES];
|
||||||
|
|
||||||
|
uint16_t PID, VID; // PID and VID of device connected
|
||||||
|
|
||||||
bool bPollEnable;
|
bool bPollEnable;
|
||||||
uint8_t pollInterval;
|
uint8_t pollInterval;
|
||||||
|
|
||||||
|
|
15
README.md
15
README.md
|
@ -63,9 +63,20 @@ By default serial debugging is disabled. To turn it on simply change ```ENABLE_U
|
||||||
|
|
||||||
### Boards
|
### Boards
|
||||||
|
|
||||||
Currently the following boards are supported by the library: All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.), Teensy (Teensy 1.0, Teensy 2.0 and Teensy++ 2.0), Balanduino, Sanguino and Black Widdow.
|
Currently the following boards are supported by the library:
|
||||||
|
|
||||||
The following boards need to be activated manually in [settings.h](settings.h): Arduino ADK, Sanguino, Teeny 2.0, and Black Widdow. Simply set the corresponding value to 1 instead of 0.
|
* All official Arduino AVR boards (Uno, Duemilanove, Mega, Mega 2560, Mega ADK, Leonardo etc.)
|
||||||
|
* Teensy (Teensy 1.0, Teensy 2.0 and Teensy++ 2.0)
|
||||||
|
* Balanduino
|
||||||
|
* Sanguino
|
||||||
|
* Black Widdow
|
||||||
|
|
||||||
|
The following boards need to be activated manually in [settings.h](settings.h):
|
||||||
|
|
||||||
|
* Arduino Mega ADK
|
||||||
|
* Black Widdow
|
||||||
|
|
||||||
|
Simply set the corresponding value to 1 instead of 0.
|
||||||
|
|
||||||
### [Bluetooth libraries](BTD.cpp)
|
### [Bluetooth libraries](BTD.cpp)
|
||||||
|
|
||||||
|
|
7
Usb.cpp
7
Usb.cpp
|
@ -581,7 +581,12 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
||||||
if(rcode) {
|
if (rcode == hrJERR) { // Some devices returns this when plugged in - trying to initialize the device again usually works
|
||||||
|
delay(100);
|
||||||
|
devConfig[driver]->ConfigureDevice(parent, port, lowspeed); // Just ignore the returned value
|
||||||
|
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
||||||
|
}
|
||||||
|
if (rcode) {
|
||||||
// Issue a bus reset, because the device may be in a limbo state
|
// Issue a bus reset, because the device may be in a limbo state
|
||||||
if (parent == 0) {
|
if (parent == 0) {
|
||||||
// Send a bus reset on the root interface.
|
// Send a bus reset on the root interface.
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
/* shield pins. First parameter - SS pin, second parameter - INT pin */
|
/* shield pins. First parameter - SS pin, second parameter - INT pin */
|
||||||
#ifdef BOARD_BLACK_WIDDOW
|
#ifdef BOARD_BLACK_WIDDOW
|
||||||
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
|
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
|
||||||
#elif defined(BOARD_TEENSY_PLUS_PLUS)
|
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
|
||||||
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
|
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
|
||||||
#elif defined(BOARD_MEGA_ADK)
|
#elif defined(BOARD_MEGA_ADK)
|
||||||
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
|
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
|
||||||
#elif defined(BOARD_BALANDUINO)
|
#elif defined(ARDUINO_AVR_BALANDUINO)
|
||||||
typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
|
typedef MAX3421e<P20, P19> MAX3421E; // Balanduino
|
||||||
#else
|
#else
|
||||||
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)
|
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)
|
||||||
|
|
|
@ -299,9 +299,11 @@ bool XBOXOLD::getButtonClick(Button b) {
|
||||||
uint8_t button;
|
uint8_t button;
|
||||||
if (b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) { // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
|
if (b == A || b == B || b == X || b == Y || b == BLACK || b == WHITE || b == L1 || b == R1) { // A, B, X, Y, BLACK, WHITE, L1, and R1 are analog buttons
|
||||||
button = pgm_read_byte(&XBOXOLDBUTTONS[(uint8_t)b]);
|
button = pgm_read_byte(&XBOXOLDBUTTONS[(uint8_t)b]);
|
||||||
if (buttonClicked[button])
|
if (buttonClicked[button]) {
|
||||||
buttonClicked[button] = false;
|
buttonClicked[button] = false;
|
||||||
return buttonClicked[button];
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
button = pgm_read_byte(&XBOXOLDBUTTONS[(uint8_t)b]); // Digital buttons
|
button = pgm_read_byte(&XBOXOLDBUTTONS[(uint8_t)b]); // Digital buttons
|
||||||
|
|
92
avrpins.h
92
avrpins.h
|
@ -25,16 +25,10 @@ e-mail : support@circuitsathome.com
|
||||||
// Support for these boards needs to be manually activated in settings.h or in a makefile
|
// Support for these boards needs to be manually activated in settings.h or in a makefile
|
||||||
#if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && USE_UHS_MEGA_ADK
|
#if !defined(BOARD_MEGA_ADK) && defined(__AVR_ATmega2560__) && USE_UHS_MEGA_ADK
|
||||||
#define BOARD_MEGA_ADK
|
#define BOARD_MEGA_ADK
|
||||||
#elif !defined(BOARD_TEENSY) && USE_UHS_TEENSY
|
|
||||||
#define BOARD_TEENSY
|
|
||||||
#elif !defined(BOARD_SANGUINO) && (USE_UHS_SANGUINO || defined(ARDUINO_AVR_SANGUINO))
|
|
||||||
#define BOARD_SANGUINO
|
|
||||||
#elif !defined(BOARD_BLACK_WIDDOW) && USE_UHS_BLACK_WIDDOW
|
#elif !defined(BOARD_BLACK_WIDDOW) && USE_UHS_BLACK_WIDDOW
|
||||||
#define BOARD_BLACK_WIDDOW
|
#define BOARD_BLACK_WIDDOW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <avr/io.h>
|
|
||||||
|
|
||||||
#ifdef PORTA
|
#ifdef PORTA
|
||||||
#define USE_PORTA
|
#define USE_PORTA
|
||||||
#endif
|
#endif
|
||||||
|
@ -451,8 +445,7 @@ public:
|
||||||
|
|
||||||
/* Arduino pin definitions */
|
/* Arduino pin definitions */
|
||||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
|
// "Mega" Arduino pin numbers
|
||||||
// "Mega" Arduino pin numbers
|
|
||||||
|
|
||||||
#define P0 Pe0
|
#define P0 Pe0
|
||||||
#define P1 Pe1
|
#define P1 Pe1
|
||||||
|
@ -517,7 +510,7 @@ public:
|
||||||
// "Mega" pin numbers
|
// "Mega" pin numbers
|
||||||
|
|
||||||
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
|
#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
|
||||||
//"Classic" Arduino pin numbers
|
// "Classic" Arduino pin numbers
|
||||||
|
|
||||||
#define P0 Pd0
|
#define P0 Pd0
|
||||||
#define P1 Pd1
|
#define P1 Pd1
|
||||||
|
@ -544,7 +537,7 @@ public:
|
||||||
|
|
||||||
// "Classic" Arduino pin numbers
|
// "Classic" Arduino pin numbers
|
||||||
|
|
||||||
#elif defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
|
#elif defined(CORE_TEENSY) && defined(__AVR_ATmega32U4__)
|
||||||
// Teensy 2.0 pin numbers
|
// Teensy 2.0 pin numbers
|
||||||
// http://www.pjrc.com/teensy/pinout.html
|
// http://www.pjrc.com/teensy/pinout.html
|
||||||
#define P0 Pb0
|
#define P0 Pb0
|
||||||
|
@ -614,7 +607,7 @@ public:
|
||||||
|
|
||||||
// Arduino Leonardo pin numbers
|
// Arduino Leonardo pin numbers
|
||||||
|
|
||||||
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
#elif defined(CORE_TEENSY) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
|
||||||
// Teensy++ 2.0 pin numbers
|
// Teensy++ 2.0 pin numbers
|
||||||
// http://www.pjrc.com/teensy/pinout.html
|
// http://www.pjrc.com/teensy/pinout.html
|
||||||
#define P0 Pd0
|
#define P0 Pd0
|
||||||
|
@ -665,7 +658,44 @@ public:
|
||||||
#define P45 Pf7
|
#define P45 Pf7
|
||||||
// Teensy++ 2.0
|
// Teensy++ 2.0
|
||||||
|
|
||||||
#elif defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__))
|
#elif defined(ARDUINO_AVR_BALANDUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__))
|
||||||
|
// Balanduino pin numbers
|
||||||
|
// http://balanduino.net/
|
||||||
|
#define P0 Pd0 /* 0 - PD0 */
|
||||||
|
#define P1 Pd1 /* 1 - PD1 */
|
||||||
|
#define P2 Pb2 /* 2 - PB2 */
|
||||||
|
#define P3 Pd6 /* 3 - PD6 */
|
||||||
|
#define P4 Pd7 /* 4 - PD7 */
|
||||||
|
#define P5 Pb3 /* 5 - PB3 */
|
||||||
|
#define P6 Pb4 /* 6 - PB4 */
|
||||||
|
#define P7 Pa0 /* 7 - PA0 */
|
||||||
|
#define P8 Pa1 /* 8 - PA1 */
|
||||||
|
#define P9 Pa2 /* 9 - PA2 */
|
||||||
|
#define P10 Pa3 /* 10 - PA3 */
|
||||||
|
#define P11 Pa4 /* 11 - PA4 */
|
||||||
|
#define P12 Pa5 /* 12 - PA5 */
|
||||||
|
#define P13 Pc1 /* 13 - PC1 */
|
||||||
|
#define P14 Pc0 /* 14 - PC0 */
|
||||||
|
#define P15 Pd2 /* 15 - PD2 */
|
||||||
|
#define P16 Pd3 /* 16 - PD3 */
|
||||||
|
#define P17 Pd4 /* 17 - PD4 */
|
||||||
|
#define P18 Pd5 /* 18 - PD5 */
|
||||||
|
#define P19 Pc2 /* 19 - PC2 */
|
||||||
|
#define P20 Pc3 /* 20 - PC3 */
|
||||||
|
#define P21 Pc4 /* 21 - PC4 */
|
||||||
|
#define P22 Pc5 /* 22 - PC5 */
|
||||||
|
#define P23 Pc6 /* 23 - PC6 */
|
||||||
|
#define P24 Pc7 /* 24 - PC7 */
|
||||||
|
#define P25 Pb0 /* 25 - PB0 */
|
||||||
|
#define P26 Pb1 /* 26 - PB1 */
|
||||||
|
#define P27 Pb5 /* 27 - PB5 */
|
||||||
|
#define P28 Pb6 /* 28 - PB6 */
|
||||||
|
#define P29 Pb7 /* 29 - PB7 */
|
||||||
|
#define P30 Pa6 /* 30 - PA6 */
|
||||||
|
#define P31 Pa7 /* 31 - PA7 */
|
||||||
|
// Balanduino
|
||||||
|
|
||||||
|
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
|
||||||
// Sanguino pin numbers
|
// Sanguino pin numbers
|
||||||
// Homepage: http://sanguino.cc/hardware
|
// Homepage: http://sanguino.cc/hardware
|
||||||
// Hardware add-on: https://github.com/Lauszus/Sanguino
|
// Hardware add-on: https://github.com/Lauszus/Sanguino
|
||||||
|
@ -703,44 +733,6 @@ public:
|
||||||
#define P31 Pa7
|
#define P31 Pa7
|
||||||
// Sanguino
|
// Sanguino
|
||||||
|
|
||||||
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega1284P__)
|
|
||||||
#define BOARD_BALANDUINO
|
|
||||||
// Balanduino pin numbers
|
|
||||||
// http://balanduino.net/
|
|
||||||
#define P0 Pd0 /* 0 - PD0 */
|
|
||||||
#define P1 Pd1 /* 1 - PD1 */
|
|
||||||
#define P2 Pb2 /* 2 - PB2 */
|
|
||||||
#define P3 Pd6 /* 3 - PD6 */
|
|
||||||
#define P4 Pd7 /* 4 - PD7 */
|
|
||||||
#define P5 Pb3 /* 5 - PB3 */
|
|
||||||
#define P6 Pb4 /* 6 - PB4 */
|
|
||||||
#define P7 Pa0 /* 7 - PA0 */
|
|
||||||
#define P8 Pa1 /* 8 - PA1 */
|
|
||||||
#define P9 Pa2 /* 9 - PA2 */
|
|
||||||
#define P10 Pa3 /* 10 - PA3 */
|
|
||||||
#define P11 Pa4 /* 11 - PA4 */
|
|
||||||
#define P12 Pa5 /* 12 - PA5 */
|
|
||||||
#define P13 Pc1 /* 13 - PC1 */
|
|
||||||
#define P14 Pc0 /* 14 - PC0 */
|
|
||||||
#define P15 Pd2 /* 15 - PD2 */
|
|
||||||
#define P16 Pd3 /* 16 - PD3 */
|
|
||||||
#define P17 Pd4 /* 17 - PD4 */
|
|
||||||
#define P18 Pd5 /* 18 - PD5 */
|
|
||||||
#define P19 Pc2 /* 19 - PC2 */
|
|
||||||
#define P20 Pc3 /* 20 - PC3 */
|
|
||||||
#define P21 Pc4 /* 21 - PC4 */
|
|
||||||
#define P22 Pc5 /* 22 - PC5 */
|
|
||||||
#define P23 Pc6 /* 23 - PC6 */
|
|
||||||
#define P24 Pc7 /* 24 - PC7 */
|
|
||||||
#define P25 Pb0 /* 25 - PB0 */
|
|
||||||
#define P26 Pb1 /* 26 - PB1 */
|
|
||||||
#define P27 Pb5 /* 27 - PB5 */
|
|
||||||
#define P28 Pb6 /* 28 - PB6 */
|
|
||||||
#define P29 Pb7 /* 29 - PB7 */
|
|
||||||
#define P30 Pa6 /* 30 - PA6 */
|
|
||||||
#define P31 Pa7 /* 31 - PA7 */
|
|
||||||
// Balanduino
|
|
||||||
|
|
||||||
#endif // Arduino pin definitions
|
#endif // Arduino pin definitions
|
||||||
|
|
||||||
#endif //_avrpins_h_
|
#endif //_avrpins_h_
|
|
@ -1,19 +1,5 @@
|
||||||
#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 <hidboot.h>
|
||||||
|
#include <usbhub.h>
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
class KbdRptParser : public KeyboardReportParser
|
class KbdRptParser : public KeyboardReportParser
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <usbhub.h>
|
|
||||||
#include <hidboot.h>
|
#include <hidboot.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
class MouseRptParser : public MouseReportParser
|
class MouseRptParser : public MouseReportParser
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#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 <hidboot.h>
|
||||||
#include <printhex.h>
|
#include <usbhub.h>
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
class MouseRptParser : public MouseReportParser
|
class MouseRptParser : public MouseReportParser
|
||||||
{
|
{
|
|
@ -1,11 +1,9 @@
|
||||||
|
|
||||||
#include <usbhub.h>
|
|
||||||
#include <hid.h>
|
#include <hid.h>
|
||||||
#include <hiduniversal.h>
|
#include <hiduniversal.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
#include "hidjoystickrptparser.h"
|
#include "hidjoystickrptparser.h"
|
||||||
|
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&Usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&Usb);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#if !defined(__HIDJOYSTICKRPTPARSER_H__)
|
#if !defined(__HIDJOYSTICKRPTPARSER_H__)
|
||||||
#define __HIDJOYSTICKRPTPARSER_H__
|
#define __HIDJOYSTICKRPTPARSER_H__
|
||||||
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <hid.h>
|
#include <hid.h>
|
||||||
|
|
||||||
struct GamePadEventData {
|
struct GamePadEventData {
|
||||||
|
|
|
@ -1,21 +1,7 @@
|
||||||
|
|
||||||
#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 <hid.h>
|
#include <hid.h>
|
||||||
#include <hiduniversal.h>
|
#include <hiduniversal.h>
|
||||||
#include <hidescriptorparser.h>
|
#include <hidescriptorparser.h>
|
||||||
#include <printhex.h>
|
#include <usbhub.h>
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
#include "pgmstrings.h"
|
#include "pgmstrings.h"
|
||||||
|
|
|
@ -1,25 +1,11 @@
|
||||||
/* Simplified Logitech Extreme 3D Pro Joystick Report Parser */
|
/* Simplified Logitech Extreme 3D Pro Joystick Report Parser */
|
||||||
|
|
||||||
#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 <hid.h>
|
#include <hid.h>
|
||||||
#include <hiduniversal.h>
|
#include <hiduniversal.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
#include "le3dp_rptparser.h"
|
#include "le3dp_rptparser.h"
|
||||||
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&Usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&Usb);
|
||||||
|
|
|
@ -1,25 +1,7 @@
|
||||||
#if !defined(__HIDJOYSTICKRPTPARSER_H__)
|
#if !defined(__HIDJOYSTICKRPTPARSER_H__)
|
||||||
#define __HIDJOYSTICKRPTPARSER_H__
|
#define __HIDJOYSTICKRPTPARSER_H__
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <hid.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include "avrpins.h"
|
|
||||||
#include "max3421e.h"
|
|
||||||
#include "usbhost.h"
|
|
||||||
#include "usb_ch9.h"
|
|
||||||
#include "Usb.h"
|
|
||||||
|
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
|
||||||
#include "Arduino.h"
|
|
||||||
#else
|
|
||||||
#include <WProgram.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "printhex.h"
|
|
||||||
#include "hexdump.h"
|
|
||||||
#include "message.h"
|
|
||||||
#include "confdescparser.h"
|
|
||||||
#include "hid.h"
|
|
||||||
|
|
||||||
struct GamePadEventData
|
struct GamePadEventData
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,26 +1,12 @@
|
||||||
/* Digital Scale Output. Written for Stamps.com Model 510 */
|
/* Digital Scale Output. Written for Stamps.com Model 510 */
|
||||||
/* 5lb Digital Scale; any HID scale with Usage page 0x8d should work */
|
/* 5lb Digital Scale; any HID scale with Usage page 0x8d should work */
|
||||||
|
|
||||||
#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 <hid.h>
|
#include <hid.h>
|
||||||
#include <hiduniversal.h>
|
#include <hiduniversal.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
#include "scale_rptparser.h"
|
#include "scale_rptparser.h"
|
||||||
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
USBHub Hub(&Usb);
|
USBHub Hub(&Usb);
|
||||||
HIDUniversal Hid(&Usb);
|
HIDUniversal Hid(&Usb);
|
||||||
|
|
|
@ -1,26 +1,8 @@
|
||||||
#if !defined(__SCALERPTPARSER_H__)
|
#if !defined(__SCALERPTPARSER_H__)
|
||||||
#define __SCALERPTPARSER_H__
|
#define __SCALERPTPARSER_H__
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <Max_LCD.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <hid.h>
|
||||||
#include "avrpins.h"
|
|
||||||
#include "max3421e.h"
|
|
||||||
#include "usbhost.h"
|
|
||||||
#include "usb_ch9.h"
|
|
||||||
#include "Usb.h"
|
|
||||||
#include "Max_LCD.h"
|
|
||||||
|
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
|
||||||
#include "Arduino.h"
|
|
||||||
#else
|
|
||||||
#include <WProgram.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "printhex.h"
|
|
||||||
#include "hexdump.h"
|
|
||||||
#include "message.h"
|
|
||||||
#include "confdescparser.h"
|
|
||||||
#include "hid.h"
|
|
||||||
|
|
||||||
/* Scale status constants */
|
/* Scale status constants */
|
||||||
#define REPORT_FAULT 0x01
|
#define REPORT_FAULT 0x01
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <PS3USB.h>
|
#include <PS3USB.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
/* You can create the instance of the class in two ways */
|
/* You can create the instance of the class in two ways */
|
||||||
PS3USB PS3(&Usb); // This will just create the instance
|
PS3USB PS3(&Usb); // This will just create the instance
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
|
|
||||||
#include "pgmstrings.h"
|
#include "pgmstrings.h"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <XBOXRECV.h>
|
#include <XBOXRECV.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
XBOXRECV Xbox(&Usb);
|
XBOXRECV Xbox(&Usb);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <XBOXUSB.h>
|
#include <XBOXUSB.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
XBOXUSB Xbox(&Usb);
|
XBOXUSB Xbox(&Usb);
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
#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 <cdcacm.h>
|
#include <cdcacm.h>
|
||||||
|
#include <usbhub.h>
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
#include "pgmstrings.h"
|
#include "pgmstrings.h"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
// The source for the Android application can be found at the following link: https://github.com/Lauszus/ArduinoBlinkLED
|
// The source for the Android application can be found at the following link: https://github.com/Lauszus/ArduinoBlinkLED
|
||||||
// The code for the Android application is heavily based on this guide: http://allaboutee.com/2011/12/31/arduino-adk-board-blink-an-led-with-your-phone-code-and-explanation/ by Miguel
|
// The code for the Android application is heavily based on this guide: http://allaboutee.com/2011/12/31/arduino-adk-board-blink-an-led-with-your-phone-code-and-explanation/ by Miguel
|
||||||
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <adk.h>
|
#include <adk.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
|
|
|
@ -1,18 +1,9 @@
|
||||||
/**/
|
/**/
|
||||||
/* A sketch demonstrating data exchange between two USB devices - a HID barcode scanner and ADK-compatible Android phone */
|
/* A sketch demonstrating data exchange between two USB devices - a HID barcode scanner and ADK-compatible Android phone */
|
||||||
/**/
|
/**/
|
||||||
#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 <adk.h>
|
#include <adk.h>
|
||||||
|
|
||||||
#include <hidboot.h>
|
#include <hidboot.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
USBHub Hub1(&Usb);
|
USBHub Hub1(&Usb);
|
|
@ -1,18 +1,5 @@
|
||||||
#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 <adk.h>
|
#include <adk.h>
|
||||||
|
#include <usbhub.h>
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
USBHub hub0(&Usb);
|
USBHub hub0(&Usb);
|
|
@ -1,13 +1,5 @@
|
||||||
#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 <adk.h>
|
#include <adk.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
//USBHub Hub(&Usb);
|
//USBHub Hub(&Usb);
|
|
@ -1,13 +1,5 @@
|
||||||
#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 <adk.h>
|
#include <adk.h>
|
||||||
|
#include <usbhub.h>
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
|
|
|
@ -3,19 +3,7 @@
|
||||||
/* for GPIO test to pass you need to connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, etc. */
|
/* for GPIO test to pass you need to connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, etc. */
|
||||||
/* otherwise press any key after getting GPIO error to complete the test */
|
/* otherwise press any key after getting GPIO error to complete the test */
|
||||||
/**/
|
/**/
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
#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 <cdcftdi.h>
|
#include <cdcftdi.h>
|
||||||
|
#include <usbhub.h>
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
#include "pgmstrings.h"
|
#include "pgmstrings.h"
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
#include "pgmstrings.h"
|
#include "pgmstrings.h"
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
|
@ -1,21 +1,9 @@
|
||||||
/* Arduino terminal for PL2303 USB to serial converter and DealeXtreme GPRS modem. */
|
/* Arduino terminal for PL2303 USB to serial converter and DealeXtreme GPRS modem. */
|
||||||
/* USB support */
|
/* USB support */
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
/* CDC support */
|
/* CDC support */
|
||||||
#include <cdcacm.h>
|
#include <cdcacm.h>
|
||||||
#include <cdcprolific.h>
|
#include <cdcprolific.h>
|
||||||
/* Debug support */
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
class PLAsyncOper : public CDCAsyncOper
|
class PLAsyncOper : public CDCAsyncOper
|
||||||
{
|
{
|
|
@ -1,22 +1,10 @@
|
||||||
/* USB Host to PL2303-based USB GPS unit interface */
|
/* USB Host to PL2303-based USB GPS unit interface */
|
||||||
/* Navibee GM720 receiver - Sirf Star III */
|
/* Navibee GM720 receiver - Sirf Star III */
|
||||||
/* USB support */
|
/* USB support */
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
/* CDC support */
|
/* CDC support */
|
||||||
#include <cdcacm.h>
|
#include <cdcacm.h>
|
||||||
#include <cdcprolific.h>
|
#include <cdcprolific.h>
|
||||||
/* Debug support */
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
class PLAsyncOper : public CDCAsyncOper
|
class PLAsyncOper : public CDCAsyncOper
|
||||||
{
|
{
|
|
@ -4,25 +4,12 @@
|
||||||
/* test_with_gps_device library example modified for PL2302 access */
|
/* test_with_gps_device library example modified for PL2302 access */
|
||||||
|
|
||||||
/* USB support */
|
/* USB support */
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
|
|
||||||
/* CDC support */
|
/* CDC support */
|
||||||
#include <cdcacm.h>
|
#include <cdcacm.h>
|
||||||
#include <cdcprolific.h>
|
#include <cdcprolific.h>
|
||||||
|
|
||||||
/* Debug support */
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
#include <TinyGPS.h>
|
#include <TinyGPS.h>
|
||||||
|
|
||||||
/* This sample code demonstrates the normal use of a TinyGPS object.
|
/* This sample code demonstrates the normal use of a TinyGPS object.
|
|
@ -1,22 +1,10 @@
|
||||||
/* Arduino terminal for PL2303 USB to serial converter and XBee radio. */
|
/* Arduino terminal for PL2303 USB to serial converter and XBee radio. */
|
||||||
/* Inserts linefeed after carriage return in data sent to and received from Xbee */
|
/* Inserts linefeed after carriage return in data sent to and received from Xbee */
|
||||||
/* USB support */
|
/* USB support */
|
||||||
#include <avrpins.h>
|
|
||||||
#include <max3421e.h>
|
|
||||||
#include <usbhost.h>
|
|
||||||
#include <usb_ch9.h>
|
|
||||||
#include <Usb.h>
|
|
||||||
#include <usbhub.h>
|
#include <usbhub.h>
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#include <address.h>
|
|
||||||
/* CDC support */
|
/* CDC support */
|
||||||
#include <cdcacm.h>
|
#include <cdcacm.h>
|
||||||
#include <cdcprolific.h>
|
#include <cdcprolific.h>
|
||||||
/* Debug support */
|
|
||||||
#include <printhex.h>
|
|
||||||
#include <message.h>
|
|
||||||
#include <hexdump.h>
|
|
||||||
#include <parsetools.h>
|
|
||||||
|
|
||||||
class PLAsyncOper : public CDCAsyncOper
|
class PLAsyncOper : public CDCAsyncOper
|
||||||
{
|
{
|
0
examples/testusbhostFAT/testusbhostFAT.ino
Executable file → Normal file
0
examples/testusbhostFAT/testusbhostFAT.ino
Executable file → Normal file
11
settings.h
11
settings.h
|
@ -31,12 +31,6 @@
|
||||||
/* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
|
/* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
|
||||||
#define USE_UHS_MEGA_ADK 0
|
#define USE_UHS_MEGA_ADK 0
|
||||||
|
|
||||||
/* Set this to 1 if you are using a Teensy 1.0 or 2.0 */
|
|
||||||
#define USE_UHS_TEENSY 0
|
|
||||||
|
|
||||||
/* Set this to 1 if you are using a Sanguino */
|
|
||||||
#define USE_UHS_SANGUINO 0
|
|
||||||
|
|
||||||
/* Set this to 1 if you are using a Black Widdow */
|
/* Set this to 1 if you are using a Black Widdow */
|
||||||
#define USE_UHS_BLACK_WIDDOW 0
|
#define USE_UHS_BLACK_WIDDOW 0
|
||||||
|
|
||||||
|
@ -64,16 +58,13 @@
|
||||||
#define DEBUG_USB_HOST
|
#define DEBUG_USB_HOST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(BOARD_TEENSY_PLUS_PLUS) && (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
|
|
||||||
#define BOARD_TEENSY_PLUS_PLUS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// When will we drop support for the older bug-ridden stuff?
|
// When will we drop support for the older bug-ridden stuff?
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
#if defined(ARDUINO) && ARDUINO >=100
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#else
|
#else
|
||||||
#include <WProgram.h>
|
#include <WProgram.h>
|
||||||
// I am not sure what WProgram.h does not include, so these are here. --xxxajk
|
// I am not sure what WProgram.h does not include, so these are here. --xxxajk
|
||||||
|
#include <pins_arduino.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue