mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Update hub_demo.ino
This commit is contained in:
parent
4be94d11c5
commit
5feb32601c
1 changed files with 6 additions and 7 deletions
|
@ -74,7 +74,7 @@ void PrintDescriptors(uint8_t addr)
|
||||||
}
|
}
|
||||||
Serial.print("\r\n");
|
Serial.print("\r\n");
|
||||||
|
|
||||||
for (int i = 0; i < num_conf; i++) {
|
for (uint8_t i = 0; i < num_conf; i++) {
|
||||||
rcode = getconfdescr( addr, i ); // get configuration descriptor
|
rcode = getconfdescr( addr, i ); // get configuration descriptor
|
||||||
if ( rcode ) {
|
if ( rcode ) {
|
||||||
printProgStr(Gen_Error_str);
|
printProgStr(Gen_Error_str);
|
||||||
|
@ -201,7 +201,7 @@ uint8_t getconfdescr( uint8_t addr, uint8_t conf )
|
||||||
uint8_t rcode;
|
uint8_t rcode;
|
||||||
uint8_t descr_length;
|
uint8_t descr_length;
|
||||||
uint8_t descr_type;
|
uint8_t descr_type;
|
||||||
unsigned int total_length;
|
uint16_t total_length;
|
||||||
rcode = Usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length
|
rcode = Usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length
|
||||||
LOBYTE( total_length ) = buf[ 2 ];
|
LOBYTE( total_length ) = buf[ 2 ];
|
||||||
HIBYTE( total_length ) = buf[ 3 ];
|
HIBYTE( total_length ) = buf[ 3 ];
|
||||||
|
@ -275,13 +275,13 @@ uint8_t getallstrdescr(uint8_t addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// function to get single string description
|
// function to get single string description
|
||||||
unsigned int getstrdescr( unsigned int addr, uint8_t idx )
|
uint8_t getstrdescr( uint8_t addr, uint8_t idx )
|
||||||
{
|
{
|
||||||
uint8_t buf[ 256 ];
|
uint8_t buf[ 256 ];
|
||||||
unsigned int rcode;
|
uint8_t rcode;
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
unsigned short langid;
|
uint16_t langid;
|
||||||
rcode = Usb.getStrDescr( addr, 0, 1, 0, 0, buf ); //get language table length
|
rcode = Usb.getStrDescr( addr, 0, 1, 0, 0, buf ); //get language table length
|
||||||
if ( rcode ) {
|
if ( rcode ) {
|
||||||
Serial.println("Error retrieving LangID table length");
|
Serial.println("Error retrieving LangID table length");
|
||||||
|
@ -293,7 +293,7 @@ unsigned int getstrdescr( unsigned int addr, uint8_t idx )
|
||||||
Serial.print("Error retrieving LangID table ");
|
Serial.print("Error retrieving LangID table ");
|
||||||
return ( rcode );
|
return ( rcode );
|
||||||
}
|
}
|
||||||
langid = word(buf[3], buf[2]);
|
langid = (buf[3] << 8) | buf[2];
|
||||||
rcode = Usb.getStrDescr( addr, 0, 1, idx, langid, buf );
|
rcode = Usb.getStrDescr( addr, 0, 1, idx, langid, buf );
|
||||||
if ( rcode ) {
|
if ( rcode ) {
|
||||||
Serial.print("Error retrieving string length ");
|
Serial.print("Error retrieving string length ");
|
||||||
|
@ -411,7 +411,6 @@ void printunkdescr( uint8_t* descr_ptr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Print a string from Program Memory directly to save RAM */
|
/* Print a string from Program Memory directly to save RAM */
|
||||||
void printProgStr(const char* str)
|
void printProgStr(const char* str)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue