2 \author Travis Goodspeed
3 \brief SPI Driver for MAX342x USB Controllers
19 #define MAXUSBAPPLICATION
24 // define for the app list.
25 app_t const maxusb_app = {
36 "\tThis allows you to write USB Host or USB Device drivers for\n"
37 "\t the MAX3421 and MAX3420 chips.\n"
40 //! Set up the pins for SPI mode.
43 SPIDIR|=MOSI+SCK+BIT0; //BIT0 might be SS
45 P4DIR&=~TST; //TST line becomes interrupt input.
46 P4DIR&=~BIT7; //GPX pin.
51 //Setup the configuration pins.
52 //This might need some delays.
53 CLRRST; //Put the chip into RESET.
54 SETSS; //Deselect the chip, end any existing transation.
55 SETRST; //Bring the chip out of RESET.
60 //! Handles a MAXUSB monitor command.
61 void maxusb_handle_fn( uint8_t const app,
66 //Raise !SS to end transaction, just in case we forgot.
72 CLRSS; //Drop !SS to begin transaction.
74 cmddata[i]=spitrans8(cmddata[i]);
75 SETSS; //Raise !SS to end transaction.
79 case PEEK://TODO peek a register.
80 debugstr("PEEK isn't implemented in MAXUSB");
84 case POKE://TODO poke a register.
85 debugstr("POKE isn't implemented in MAXUSB");
95 //Raise !SS to end transaction, in case we forgot.