X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Finclude%2Fspi.h;h=cede5c4c2424511dc7b270406e7fc50eaee974b0;hp=0f272daeabb6f0357083ea99b781a404efc39c58;hb=41777a0dda559dc2b2738720a39f3b5d57b5cee0;hpb=4318357fa86791beab25d8865cb9f1091b8e5646 diff --git a/firmware/include/spi.h b/firmware/include/spi.h index 0f272da..cede5c4 100644 --- a/firmware/include/spi.h +++ b/firmware/include/spi.h @@ -11,9 +11,18 @@ #define SPI 0x01 //Pins and I/O -#define MOSI BIT1 -#define MISO BIT2 -#define SCK BIT3 +#if (platform == donbfet) +# define MOSI (1 << PA2) +# define MISO (1 << PA1) +# define SCK (1 << PA0) +# define SS (1 << PA3) +# define TST (1 << PA4) +# define XRST (1 << PA5) +#else +# define MOSI BIT1 +# define MISO BIT2 +# define SCK BIT3 +#endif #define SETMOSI SPIOUT|=MOSI #define CLRMOSI SPIOUT&=~MOSI @@ -22,10 +31,17 @@ #define READMISO (SPIIN&MISO?1:0) //FIXME this should be defined by the platform. -#define SETTST P4OUT|=TST -#define CLRTST P4OUT&=~TST -#define SETRST P2OUT|=RST -#define CLRRST P2OUT&=~RST +#if (platform == donbfet) +# define SETTST PORTA|=(1 << PA4); +# define CLRTST PORTA&=~(1 << PA4); +# define SETRST PORTA|=(1 << PA5); +# define CLRRST PORTA&=~(1 << PA5); +#else +# define SETTST P4OUT|=TST +# define CLRTST P4OUT&=~TST +# define SETRST P2OUT|=RST +# define CLRRST P2OUT&=~RST +#endif //! Set up the pins for SPI mode. void spisetup();