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.
50 //Setup the configuration pins.
51 //This might need some delays.
52 CLRRST; //Put the chip into RESET.
53 SETSS; //Deselect the chip, end any existing transation.
54 SETRST; //Bring the chip out of RESET.
59 //! Handles a MAXUSB monitor command.
60 void maxusb_handle_fn( uint8_t const app,
65 //Raise !SS to end transaction, just in case we forgot.
71 CLRSS; //Drop !SS to begin transaction.
73 cmddata[i]=spitrans8(cmddata[i]);
74 SETSS; //Raise !SS to end transaction.
78 case PEEK://TODO peek a register.
79 debugstr("PEEK isn't implemented in MAXUSB");
83 case POKE://TODO poke a register.
84 debugstr("POKE isn't implemented in MAXUSB");
94 //Raise !SS to end transaction, in case we forgot.