初始化:
CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, ENABLE);
SPI_Init(SPI_FIRSTBIT_MSB, SPI_BAUDRATEPRESCALER_64, SPI_MODE_MASTER,
SPI_CLOCKPOLARITY_HIGH, SPI_CLOCKPHASE_2EDGE, SPI_DATADIRECTION_1LINE_TX,
SPI_NSS_SOFT, 0x07);
SPI_Cmd(ENABLE);
传送:
SSD_CS_0();
SSD_SDIN_0();
SSD_SCK_0();
SSD_SCK_1();
SPI->DR = _ucCmd;
while ((SPI->SR & SPI_SR_TXE) == 0);
SSD_CS_1();
|