mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
regression
This commit is contained in:
parent
702897bd5b
commit
c86e258916
6 changed files with 46 additions and 8 deletions
10
Usb.h
10
Usb.h
|
@ -47,8 +47,16 @@ e-mail : support@circuitsathome.com
|
|||
|
||||
/* shield pins. First parameter - SS pin, second parameter - INT pin */
|
||||
|
||||
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
||||
#define BOARD_TEENSY_PLUS_PLUS
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_BLACK_WIDDOW
|
||||
typedef MAX3421e<P6, P3> MAX3421E; // Black Widow
|
||||
#elif defined(BOARD_TEENSY_PLUS_PLUS)
|
||||
typedef MAX3421e<P9, P8> MAX3421E; // Teensy++ 2.0 & 1.0
|
||||
#elif defined(BOARD_MEGA_ADK)
|
||||
typedef MAX3421e<P53, P54> MAX3421E; // Arduino Mega ADK
|
||||
#else
|
||||
typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560
|
||||
#endif
|
||||
|
@ -272,4 +280,4 @@ inline uint8_t USB::setConf( uint8_t addr, uint8_t ep, uint8_t conf_value )
|
|||
|
||||
#endif // defined(USB_METHODS_INLINE)
|
||||
|
||||
#endif //_usb_h_
|
||||
#endif //_usb_h_
|
||||
|
|
26
adk.cpp
26
adk.cpp
|
@ -48,12 +48,10 @@ ADK::ADK(USB *p, const char* manufacturer,
|
|||
for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++) {
|
||||
epInfo[i].epAddr = 0;
|
||||
epInfo[i].maxPktSize = (i) ? 0 : 8;
|
||||
epInfo[i].epAttribs = ( 0xfc & ( USB_NAK_MAX_POWER<<2 ));
|
||||
epInfo[i].epAttribs = 0;
|
||||
epInfo[i].bmNakPower = (i) ? USB_NAK_NOWAIT : USB_NAK_MAX_POWER;
|
||||
}//for(uint8_t i=0; i<ADK_MAX_ENDPOINTS; i++...
|
||||
|
||||
//set bulk-IN EP naklimit to 1
|
||||
epInfo[epDataInIndex].epAttribs = ( 0xfc & ( USB_NAK_NOWAIT<<2 ));
|
||||
|
||||
|
||||
// register in USB subsystem
|
||||
if (pUsb) {
|
||||
pUsb->RegisterDeviceClass(this); //set devConfig[] entry
|
||||
|
@ -157,7 +155,16 @@ uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed)
|
|||
|
||||
for (uint8_t i=0; i<num_of_conf; i++) {
|
||||
ConfigDescParser<0, 0, 0, 0> confDescrParser(this);
|
||||
delay(1);
|
||||
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
|
||||
#if defined(XOOM)
|
||||
//added by Jaylen Scott Vanorden
|
||||
if( rcode ) {
|
||||
USBTRACE2("\r\nGot 1st bad code for config: ", rcode);
|
||||
// Try once more
|
||||
rcode = pUsb->getConfDescr(bAddress, 0, i, &confDescrParser);
|
||||
}
|
||||
#endif
|
||||
if( rcode ) {
|
||||
goto FailGetConfDescr;
|
||||
}
|
||||
|
@ -204,7 +211,16 @@ uint8_t ADK::Init(uint8_t parent, uint8_t port, bool lowspeed)
|
|||
//probe device - get accessory protocol revision
|
||||
{
|
||||
uint16_t adkproto = -1;
|
||||
delay(1);
|
||||
rcode = getProto((uint8_t*)&adkproto );
|
||||
#if defined(XOOM)
|
||||
//added by Jaylen Scott Vanorden
|
||||
if( rcode ) {
|
||||
USBTRACE2("\r\nGot 1st bad code for proto: ", rcode);
|
||||
// Try once more
|
||||
rcode = getProto((uint8_t*)&adkproto );
|
||||
}
|
||||
#endif
|
||||
if( rcode ){
|
||||
goto FailGetProto; //init fails
|
||||
}
|
||||
|
|
6
adk.h
6
adk.h
|
@ -44,6 +44,10 @@ e-mail : support@circuitsathome.com
|
|||
#define ADK_PID 0x2D00
|
||||
#define ADB_PID 0x2D01
|
||||
|
||||
#define XOOM //enables repeating getProto() and getConf() attempts
|
||||
//necessary for slow devices such as Motorola XOOM
|
||||
//defined by default, can be commented out to save memory
|
||||
|
||||
/* requests */
|
||||
|
||||
#define ADK_GETPROTO 51 //check USB accessory protocol version
|
||||
|
@ -105,7 +109,7 @@ public:
|
|||
const char* uri,
|
||||
const char* serial);
|
||||
|
||||
// Methods for recieving and sending data
|
||||
// Methods for receiving and sending data
|
||||
uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr);
|
||||
uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ e-mail : support@circuitsathome.com
|
|||
#ifndef _avrpins_h_
|
||||
#define _avrpins_h_
|
||||
|
||||
/* Uncomment the following if you have Arduino Mega ADK board with MAX3421e built-in */
|
||||
//#define BOARD_MEGA_ADK
|
||||
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
#ifdef PORTA
|
||||
|
@ -465,6 +469,7 @@ template<typename Tp_pin, typename Tc_bit>
|
|||
#define P51 Pb2
|
||||
#define P52 Pb1
|
||||
#define P53 Pb0
|
||||
#define P54 Pj2
|
||||
|
||||
#endif //"Mega" pin numbers
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
|
|||
dscrType = *((uint8_t*)theBuffer.pValue + 1);
|
||||
stateParseDescr = 2;
|
||||
case 2:
|
||||
// This is a sort of hack. Assuming that two bytes are allready in the buffer
|
||||
// This is a sort of hack. Assuming that two bytes are already in the buffer
|
||||
// the pointer is positioned two bytes ahead in order for the rest of descriptor
|
||||
// to be read right after the size and the type fields.
|
||||
// This should be used carefuly. varBuffer should be used directly to handle data
|
||||
|
|
|
@ -86,6 +86,11 @@ MAX3421e< SS, INTR >::MAX3421e()
|
|||
SS::Set();
|
||||
spi::init();
|
||||
INTR::SetDirRead();
|
||||
#ifdef BOARD_MEGA_ADK
|
||||
/* For Mega ADK, which has Max3421e on-board, set MAX_RESET to Output mode, and pull Reset to HIGH */
|
||||
DDRJ |= 0x04;
|
||||
PORTJ |= 0x04;
|
||||
#endif
|
||||
|
||||
/* MAX3421E - full-duplex SPI, level interrupt */
|
||||
regWr( rPINCTL,( bmFDUPSPI + bmINTLEVEL ));
|
||||
|
|
Loading…
Reference in a new issue