X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fspi%2Fspi.c;h=594e04fdabbf016583bccb90ef4525e45c23578d;hp=f4c6560477548099466f38ca0cc083b7a4499262;hb=a28d1a252666fe5077057b8598d638fc8504e29a;hpb=6ee7ff03148c7af2a50695337910e7fd6906d476;ds=sidebyside diff --git a/firmware/apps/spi/spi.c b/firmware/apps/spi/spi.c index f4c6560..594e04f 100644 --- a/firmware/apps/spi/spi.c +++ b/firmware/apps/spi/spi.c @@ -43,7 +43,7 @@ void spisetup(){ } -//! Read and write an SPI bit. +//! Read and write an SPI byte. unsigned char spitrans8(unsigned char byte){ unsigned int bit; //This function came from the SPI Wikipedia article. @@ -187,6 +187,7 @@ void spihandle(unsigned char app, spitrans8(cmddata[i]); P5OUT|=SS; //Raise !SS to end transaction. + while(spiflash_status()&0x01)//while busy P1OUT^=1; P1OUT&=~1; @@ -200,10 +201,15 @@ void spihandle(unsigned char app, P5OUT&=~SS; //Drop !SS to begin transaction. spitrans8(0xC7);//Chip Erase P5OUT|=SS; //Raise !SS to end transaction. + + + while(spiflash_status()&0x01)//while busy + P1OUT^=1; + P1OUT&=~1; + txdata(app,verb,0); break; - case SETUP: spisetup(); txdata(app,verb,0);