X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fspi%2Fspi.c;h=93a41b9fd53bda2beeb666ad8b295a8892e888f0;hp=2ee2d2cf173e5d61653cce6cae3ef73051522ead;hb=92560226caf1a463eb144324978b0a390327e09e;hpb=9e13b1450d770a5645468221d0eacc1533d654a9 diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index 2ee2d2c..93a41b9 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -32,9 +32,9 @@ //! Set up the pins for SPI mode. void spisetup(){ + P5OUT|=SS; P5DIR|=MOSI+SCK+SS; P5DIR&=~MISO; - P5OUT|=SS; } //! Read and write an SPI bit. @@ -81,6 +81,27 @@ void spihandle(unsigned char app, P5OUT|=SS; //Raise !SS to end transaction. txdata(app,verb,len); break; + case SPI_JEDEC://Grab 3-byte JEDEC ID. + P5OUT&=~SS; //Drop !SS to begin transaction. + spitrans8(0x9f); + len=3; + for(i=0;i