Pages: [1]   Go Down
Author Topic: Using PIN's of MAX3421e USB HOST SHIELD  (Read 1027 times)
0 Members and 1 Guest are viewing this topic.
ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1593
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi i wanted to utilise the GPIN GPOUT pins on the SparkFun's USB HOST SHIELD , is there any code snippet to access the same given im using the USB HOST 2.0 library?

Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You want to use those 16 pins for some purpose, is that it?

This snippet from board_qc.pde might illustrate the general idea:

Code:
  /* GPIO test */
  /* in order to simplify board layout, GPIN pins on text fixture are connected to GPOUT */
  /* in reverse order, i.e, GPIN0 is connected to GPOUT7, GPIN1 to GPOUT6, etc. */
  {
    uint8_t tmpbyte;
    Notify(PSTR("\r\nGPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on"));
    for( uint8_t sample_gpio = 0; sample_gpio < 255; sample_gpio++ ) {
      Usb.gpioWr( sample_gpio );
      tmpbyte = Usb.gpioRd();
      /* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */
      tmpbyte  = ((tmpbyte * 0x0802LU & 0x22110LU) | (tmpbyte * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16;
      if( sample_gpio != tmpbyte ) {
        Notify(PSTR("\r\nTest failed. Value written: "));
        print_hex( sample_gpio, 8 );
        Notify(PSTR(" Value read: "));
        print_hex( tmpbyte , 8 );
        Notify(PSTR(" "));
        press_any_key();
        break;
      }//if( sample_gpio != tmpbyte...
    }//for( uint8_t sample_gpio...
    Notify(PSTR("\r\nGPIO test passed."));           
  }//GPIO test


Judging by that you want Usb.gpioWr(x)  to write and x = Usb.gpioRd() to read.
Logged

ਪੰਜਾਬ
Offline Offline
Edison Member
*
Karma: 12
Posts: 1593
Another year! Alone! :(
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You want to use those 16 pins for some purpose, is that it?

Yes sir and i got it, Thanks!
Logged

"Real Men can Accomplish  Anything"
-  Website  
- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੂਂ !

Cairo
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Hello Arduino world
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Sirs
what is the use of Notify() syntax, and where does it output the data?

also i want to ask how does the program Board_qc output the test result?

than you for help
Logged

Pages: [1]   Go Up
Jump to: