mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Apr.11 updates
This commit is contained in:
parent
a23fa8720f
commit
aa6fc58bc4
5 changed files with 23 additions and 69 deletions
17
Usb.h
17
Usb.h
|
@ -134,12 +134,13 @@
|
||||||
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
|
#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2
|
||||||
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
|
#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3
|
||||||
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
|
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4
|
||||||
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD5
|
#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5
|
||||||
#define USB_ERROR_EPINFO_IS_NULL 0xD6
|
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6
|
||||||
#define USB_ERROR_INVALID_ARGUMENT 0xD7
|
#define USB_ERROR_EPINFO_IS_NULL 0xD7
|
||||||
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD8
|
#define USB_ERROR_INVALID_ARGUMENT 0xD8
|
||||||
#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xD9
|
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9
|
||||||
#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDA
|
#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA
|
||||||
|
#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB
|
||||||
|
|
||||||
class USBDeviceConfig
|
class USBDeviceConfig
|
||||||
{
|
{
|
||||||
|
@ -156,8 +157,8 @@ public:
|
||||||
#define USB_SETTLE_DELAY 200 //settle delay in milliseconds
|
#define USB_SETTLE_DELAY 200 //settle delay in milliseconds
|
||||||
#define USB_NAK_NOWAIT 1 //used in Richard's PS2/Wiimote code
|
#define USB_NAK_NOWAIT 1 //used in Richard's PS2/Wiimote code
|
||||||
|
|
||||||
#define USB_NUMDEVICES 64 //number of USB devices
|
#define USB_NUMDEVICES 16 //number of USB devices
|
||||||
#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller
|
#define HUB_MAX_HUBS 5 // maximum number of hubs that can be attached to the host controller
|
||||||
#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
|
#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms
|
||||||
|
|
||||||
/* USB state machine states */
|
/* USB state machine states */
|
||||||
|
|
|
@ -185,6 +185,9 @@ public:
|
||||||
if (parent > 127 || port > 7)
|
if (parent > 127 || port > 7)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (is_hub && hubCounter == 7)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// finds first empty address entry starting from one
|
// finds first empty address entry starting from one
|
||||||
uint8_t index = FindAddressIndex(0);
|
uint8_t index = FindAddressIndex(0);
|
||||||
|
|
||||||
|
|
1
diff.txt
1
diff.txt
|
@ -1 +0,0 @@
|
||||||
Comparing files usbhost.h and USBHOST.H2
|
|
59
newusb.pde
59
newusb.pde
|
@ -1,59 +0,0 @@
|
||||||
/* new USB library tests */
|
|
||||||
|
|
||||||
//nclude <digitalWriteFast.h>
|
|
||||||
#include "usbhost.h"
|
|
||||||
|
|
||||||
MAX3421e<P10, P9> Max;
|
|
||||||
uint8_t buf[10] = {0};
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// Max.regWr( rPINCTL,( bmFDUPSPI + bmINTLEVEL ));
|
|
||||||
// Max.regWr( rUSBCTL, bmCHIPRES ); //Chip reset. This stops the oscillator
|
|
||||||
// Max.regWr( rUSBCTL, 0x00 ); //Remove the reset
|
|
||||||
// delay( 100 );
|
|
||||||
Serial.begin( 115200 );
|
|
||||||
Serial.println("Start");
|
|
||||||
|
|
||||||
// pinModeFast2( 8, OUTPUT)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
// uint16_t i;
|
|
||||||
// Max.regWr( rUSBCTL, bmCHIPRES );
|
|
||||||
// Max.regWr( rUSBCTL, 0x00 );
|
|
||||||
// for( i = 0; i < 65535; i++ ) {
|
|
||||||
// if( ( Max.regRd( rUSBIRQ ) & bmOSCOKIRQ )) {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Serial.println( Max.reset(), DEC );
|
|
||||||
//Max.reset();
|
|
||||||
//delay( 100 );
|
|
||||||
//Max.regRd( rREVISION );
|
|
||||||
//Serial.println( Max.regRd( rREVISION ), HEX );
|
|
||||||
|
|
||||||
//Serial.println("tick");
|
|
||||||
// uint8_t tmp;
|
|
||||||
// for( uint16_t i = 0; i < 256; i++ ) {
|
|
||||||
// tmp = Max.SPIxfer( i );
|
|
||||||
// if( tmp != i ) {
|
|
||||||
// Serial.println("error");
|
|
||||||
// }
|
|
||||||
// if( SPSR & 0x40 ) {
|
|
||||||
// Serial.println("WCOL");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// static bool oldintval = 0;
|
|
||||||
// if( Max.intval() != oldintval ) {
|
|
||||||
// oldintval = Max.intval();
|
|
||||||
// Serial.println( oldintval, DEC );
|
|
||||||
// }
|
|
||||||
// Max.sstoggle();
|
|
||||||
|
|
||||||
//digitalWriteFast2( 8, 0 );
|
|
||||||
//digitalWriteFast2( 8, 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
12
usbhost.h
12
usbhost.h
|
@ -171,7 +171,17 @@ uint16_t MAX3421e< SS, INTR >::reset()
|
||||||
}
|
}
|
||||||
return( i );
|
return( i );
|
||||||
}
|
}
|
||||||
|
///* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
|
||||||
|
//template< typename SS, typename INTR >
|
||||||
|
//int8_t MAX3421e< SS, INTR >::Init()
|
||||||
|
//{
|
||||||
|
// if( reset() == 0 ) { //OSCOKIRQ hasn't asserted in time
|
||||||
|
// return ( -1 );
|
||||||
|
// }
|
||||||
|
// regWr( rMODE, bmDPPULLDN|bmDMPULLDN|bmHOST ); // set pull-downs, Host
|
||||||
|
//
|
||||||
|
// return( 0 );
|
||||||
|
//}
|
||||||
/* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
|
/* initialize MAX3421E. Set Host mode, pullups, and stuff. Returns 0 if success, -1 if not */
|
||||||
template< typename SS, typename INTR >
|
template< typename SS, typename INTR >
|
||||||
int8_t MAX3421e< SS, INTR >::Init()
|
int8_t MAX3421e< SS, INTR >::Init()
|
||||||
|
|
Loading…
Reference in a new issue