X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fspi.h;h=dfbb28ab4a20b117a590ae2c69b11bd5633c74b7;hp=e96bef3795180be369ccadf2577cb88e94ba0938;hb=5fb0341d348e101b30794945a6c91546e25e8e7b;hpb=15750ecb20e3f348c419f0666452534c8b6a0b8e diff --git a/firmware/include/spi.h b/firmware/include/spi.h index e96bef3..dfbb28a 100644 --- a/firmware/include/spi.h +++ b/firmware/include/spi.h @@ -3,22 +3,30 @@ \brief Definitions for the SPI application. */ +#ifndef SPI_H +#define SPI_H + +#include "app.h" + +#define SPI 0x01 //Pins and I/O -#define SS BIT0 +//#define SS BIT0 #define MOSI BIT1 #define MISO BIT2 #define SCK BIT3 -#define SETSS P5OUT|=SS -#define CLRSS P5OUT&=~SS - #define SETMOSI P5OUT|=MOSI #define CLRMOSI P5OUT&=~MOSI #define SETCLK P5OUT|=SCK #define CLRCLK P5OUT&=~SCK #define READMISO (P5IN&MISO?1:0) +#define SETTST P4OUT|=TST +#define CLRTST P4OUT&=~TST +#define SETRST P2OUT|=RST +#define CLRRST P2OUT&=~RST + //! Set up the pins for SPI mode. void spisetup(); @@ -46,3 +54,7 @@ unsigned char spitrans8(unsigned char byte); unsigned char spiflash_status(); //! Erase a sector. void spiflash_erasesector(unsigned long adr); + +extern app_t const spi_app; + +#endif