bool USCI_B_SPI_masterInit(uint16_t baseAddress, uint8_t selectClockSource, uint32_t clockSourceFrequency, uint32_t desiredSpiClock, uint8_t msbFirst, uint8_t clockPhase, uint8_t clockPolarity) { USCI_B_SPI_initMasterParam param = {0}; param.selectClockSource = selectClockSource; param.clockSourceFrequency = clockSourceFrequency; param.desiredSpiClock = desiredSpiClock; param.msbFirst = msbFirst; param.clockPhase = clockPhase; param.clockPolarity = clockPolarity; return(USCI_B_SPI_initMaster(baseAddress, ¶m)); }
//***************************************************************************** // //! \brief Initializes USCI_B1 with SPI mode. //! //! CLK: 1MHZ. //! ClockPhase: USCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT. //! ClockPolarity: USCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW //! MSB_first //! //! The Seeting is specified to Sharp96 communication. // //***************************************************************************** void msp430_spi_b1_init() { // Configure SPI PORT GPIO_setAsPeripheralModuleFunctionOutputPin(LCD_SPI_PORT, LCD_SPI_SI_PIN + LCD_SPI_SO_PIN + LCD_SPI_CLK_PIN); // Configure LCD_SPI_CS_PIN as output pin GPIO_setAsOutputPin(LCD_SPI_CS_PORT, LCD_SPI_CS_PIN); msp430_spi_b1_clearCS(); USCI_B_SPI_initMasterParam spiMasterParams= { USCI_B_SPI_CLOCKSOURCE_SMCLK, UCS_getSMCLK(), 8000000, USCI_B_SPI_MSB_FIRST, USCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, USCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW }; USCI_B_SPI_initMaster(LCD_USCI_BASE, &spiMasterParams); USCI_B_SPI_enable(LCD_USCI_BASE); }