- P5OUT&=~SS; //Drop !SS to begin transaction.
- spitrans8(0x04);//Write Disable
- P5OUT|=SS; //Raise !SS to end transaction.
- P5OUT&=~SS; //Drop !SS to begin transaction.
- spitrans8(0x06);//Write Enable
- P5OUT|=SS; //Raise !SS to end transaction.
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ spitrans8(0x04);//Write Disable
+ P5OUT|=SS; //Raise !SS to end transaction.
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ spitrans8(0x06);//Write Enable
+ P5OUT|=SS; //Raise !SS to end transaction.
+}
+
+//! Grab the SPI flash status byte.
+unsigned char spiflash_status(){
+ unsigned char c;
+ P5OUT|=SS; //Raise !SS to end transaction.
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ spitrans8(0x05);//GET STATUS
+ c=spitrans8(0xFF);
+ P5OUT|=SS; //Raise !SS to end transaction.
+ return c;
+}
+//! Grab the SPI flash status byte.
+void spiflash_setstatus(unsigned char c){
+ P5OUT&=~SS; //Drop !SS to begin transaction.
+ spitrans8(0x01);//SET STATUS
+ spitrans8(c);
+ P5OUT|=SS; //Raise !SS to end transaction.
+ return c;