void SPIInit(void)
{
SPI_PxOUT |= SPI_CSRF;
SPI_PxDIR |= SPI_CSRF; // /CS disable
SPI_FLPxOUT |= SPI_CSFL;
SPI_FLPxDIR |= SPI_CSFL; // /CS disable
UCB0CTL1 |= UCSWRST; // **Disable USCI state machine**
UCB0CTL0 |= UCMST+UCCKPH+UCMSB+UCSYNC; // 3-pin, 8-bit SPI master
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 = 0x02; // UCLK/2
UCB0BR1 = 0;
SPI_PxSEL |= SPI_SIMO | SPI_SOMI | SPI_SCLK;
// SPI option select
SPI_PxDIR |= SPI_SIMO | SPI_SCLK;
// SPI TXD out direction
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
} |