{
GPIO_Config_T gpioConfig;
SPI_Config_T spiConfig;
/** Enable related clock*/
RCM_EnableAPB2PeriphClock(RCM_APB2_PERIPH_SPI1);
RCM_EnableAHBPeriphClock(RCM_AHB_PERIPH_GPIOA);
RCM_EnableAPB2PeriphClock(RCM_APB2_PERIPH_SYSCFG);
/*屏蔽MISO、SCLK的IO配置*/
// GPIO_ConfigPinAF(GPIOA, GPIO_PIN_SOURCE_5, GPIO_AF_PIN0);
// GPIO_ConfigPinAF(GPIOA, GPIO_PIN_SOURCE_6, GPIO_AF_PIN0);
GPIO_ConfigPinAF(GPIOA, GPIO_PIN_SOURCE_7, GPIO_AF_PIN0);
/** config PIN_5->SCK , PIN_7->MOSI*/
gpioConfig.pin = GPIO_PIN_7;
gpioConfig.mode = GPIO_MODE_AF;
gpioConfig.outtype = GPIO_OUT_TYPE_PP;
gpioConfig.speed = GPIO_SPEED_50MHz;
gpioConfig.pupd = GPIO_PUPD_PU;
GPIO_Config(GPIOA, &gpioConfig);
// /** config PIN_4->NSS*/
// gpioConfig.pin = GPIO_PIN_4;
// gpioConfig.outtype = GPIO_OUT_TYPE_PP;
// gpioConfig.speed = GPIO_SPEED_50MHz;
// gpioConfig.pupd = GPIO_PUPD_PU;
// gpioConfig.mode = GPIO_MODE_OUT;
// GPIO_Config(GPIOA, &gpioConfig);
// GPIO_SetBit(GPIOA, GPIO_PIN_4);
//
// /** config PIN_6 MISO*/
// gpioConfig.pin = GPIO_PIN_6;
// gpioConfig.mode = GPIO_MODE_AF;
// gpioConfig.pupd = GPIO_PUPD_PU;
// gpioConfig.speed = GPIO_SPEED_50MHz;
// GPIO_Config(GPIOA, &gpioConfig);
/** SPI RESET*/
SPI_Reset(SPI1);
SPI_ConfigStructInit(&spiConfig);
/** SPI configuration*/
spiConfig.polarity = SPI_CLKPOL_LOW;
spiConfig.direction = SPI_DIRECTION_1LINE_TX;/*单线 发送*/
spiConfig.mode = SPI_MODE_MASTER;/*主模式*/
spiConfig.phase = SPI_CLKPHA_1EDGE;
spiConfig.slaveSelect = SPI_SSC_ENABLE;
spiConfig.baudrateDiv = SPI_BAUDRATE_DIV_64;
spiConfig.length = SPI_DATA_LENGHT_8B;
SPI1->CTRL1_B.ISS = SET;
SPI_Config(SPI1, &spiConfig);
SPI_Enable(SPI1);/*SPI使能*/
}