本文整理汇总了C++中SPI_I2S_DeInit函数的典型用法代码示例。如果您正苦于以下问题:C++ SPI_I2S_DeInit函数的具体用法?C++ SPI_I2S_DeInit怎么用?C++ SPI_I2S_DeInit使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SPI_I2S_DeInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hal_gdflash_SPI_Config
/*****************************************************************************
Prototype : hal_sRF_SPI_Config
Description : none
Input : void
Output : None
Return Value :
Date : 2014/3/15
Author : Barry
*****************************************************************************/
void hal_gdflash_SPI_Config(void)
{
SPI_InitTypeDef SPI_InitStructure;
/*!< Deselect the RF: Chip Select high */
DGFLASH_CS_HIGH();
/* Disable sRF_SPI */
SPI_Cmd(GDFLASH_SPI, DISABLE);
/*!< SPI configuration */
SPI_I2S_DeInit(GDFLASH_SPI);
/*!< sRF_SPI Periph clock enable */
RCC_APB2PeriphClockCmd(DGFLASH_SPI_SCK , ENABLE);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(GDFLASH_SPI, &SPI_InitStructure);
SPI_RxFIFOThresholdConfig(GDFLASH_SPI, SPI_RxFIFOThreshold_QF);
/*!< Enable the sRF_SPI */
SPI_Cmd(GDFLASH_SPI, ENABLE);
}
示例2: SPI1_Init
void SPI1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA ,ENABLE);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource5, GPIO_AF_SPI1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource6, GPIO_AF_SPI1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource7, GPIO_AF_SPI1);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
GPIO_Init(GPIOA, &GPIO_InitStructure);
SPI_I2S_DeInit(SPI1);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;//全双工
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;//8位数据模式
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;//空闲模式下SCK为1
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;//数据采样从第2个时间边沿开始
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;//NSS软件管理
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256;//波特率
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;//大端模式
SPI_InitStructure.SPI_CRCPolynomial = 7;//CRC多项式
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;//主机模式
SPI_Init(SPI1, &SPI_InitStructure);
SPI_Cmd(SPI1, ENABLE);
}
示例3: RCC_APB2PeriphClockCmd
void CMasterSPIHardware::init( SPI_TypeDef * hard_spi, const hard_SPI_config * config )
{
SPI_InitTypeDef SPI_InitStructure;
_spi = hard_spi;
if (hard_spi == SPI1)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE);
else if (hard_spi == SPI2)
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
SPI_I2S_DeInit(hard_spi);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_DataSize = (config->num_of_bit - 1) << 8;
SPI_InitStructure.SPI_CPOL = config->CPOL;
SPI_InitStructure.SPI_CPHA = config->CPHA;
SPI_InitStructure.SPI_NSS = SPI_NSS_Hard;
SPI_InitStructure.SPI_BaudRatePrescaler = config->prescaller;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_Init(hard_spi, &SPI_InitStructure);
SPI_SSOutputCmd(hard_spi, ENABLE);
SPI_NSSPulseModeCmd(hard_spi, ENABLE);
/* Initialize the FIFO threshold */
SPI_RxFIFOThresholdConfig(hard_spi, SPI_RxFIFOThreshold_QF);
/* Enable the SPI peripheral */
SPI_Cmd(hard_spi, ENABLE);
}
示例4: I2S_Config
/*******************************************************************************
* Function Name : I2S_Config
* Description : Configure the I2S Peripheral.
* Input : - Standard: I2S_Standard_Phillips, I2S_Standard_MSB or I2S_Standard_LSB
* - MCLKOutput: I2S_MCLKOutput_Enable or I2S_MCLKOutput_Disable
* - AudioFreq: I2S_AudioFreq_8K, I2S_AudioFreq_16K, I2S_AudioFreq_22K,
* I2S_AudioFreq_44K or I2S_AudioFreq_48K
* Output : None
* Return : None
*******************************************************************************/
static void I2S_Config(uint16_t Standard, uint16_t MCLKOutput, uint16_t AudioFreq)
{
I2S_InitTypeDef I2S_InitStructure;
/* Enable I2S2 APB1 clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
/* Deinitialize SPI2 peripheral */
SPI_I2S_DeInit(SPI2);
/* I2S2 peripheral configuration */
I2S_InitStructure.I2S_Mode = I2S_Mode_MasterTx;
I2S_InitStructure.I2S_Standard = Standard;
I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
I2S_InitStructure.I2S_MCLKOutput = MCLKOutput;
I2S_InitStructure.I2S_AudioFreq = AudioFreq;
I2S_InitStructure.I2S_CPOL = I2S_CPOL_High;
I2S_Init(SPI2, &I2S_InitStructure);
/* Disable the I2S2 TXE Interrupt */
SPI_I2S_ITConfig(SPI2, SPI_I2S_IT_TXE, DISABLE);
/* Enable the SPI2/I2S2 peripheral */
I2S_Cmd(SPI2, ENABLE);
printf("\n\r I2S peripheral Config finished");
}
示例5: LCD_DeInit
/**
* @brief DeInitializes the LCD.
* @param None
* @retval None
*/
void LCD_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*!< LCD Display Off */
LCD_DisplayOff();
/*!< LCD_SPI disable */
SPI_Cmd(LCD_SPI, DISABLE);
/*!< LCD_SPI DeInit */
SPI_I2S_DeInit(LCD_SPI);
/*!< Disable SPI clock */
RCC_APB1PeriphClockCmd(LCD_SPI_CLK, DISABLE);
/* Configure NCS in Output Push-Pull mode */
GPIO_InitStructure.GPIO_Pin = LCD_NCS_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(LCD_NCS_GPIO_PORT, &GPIO_InitStructure);
/* Configure SPI pins: SCK, MISO and MOSI */
GPIO_InitStructure.GPIO_Pin = LCD_SPI_SCK_PIN;
GPIO_Init(LCD_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = LCD_SPI_MISO_PIN;
GPIO_Init(LCD_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = LCD_SPI_MOSI_PIN;
GPIO_Init(LCD_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
}
示例6: sFLASH_LowLevel_DeInit
/**
* @brief DeInitializes the peripherals used by the SPI FLASH driver.
* @param None
* @retval None
*/
void sFLASH_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*!< Disable the sFLASH_SPI ************************************************/
SPI_Cmd(sFLASH_SPI, DISABLE);
/*!< DeInitializes the sFLASH_SPI *******************************************/
SPI_I2S_DeInit(sFLASH_SPI);
/*!< sFLASH_SPI Periph clock disable ****************************************/
sFLASH_SPI_CLK_INIT(sFLASH_SPI_CLK, DISABLE);
/*!< Configure all pins used by the SPI as input floating *******************/
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_SCK_PIN;
GPIO_Init(sFLASH_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MISO_PIN;
GPIO_Init(sFLASH_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MOSI_PIN;
GPIO_Init(sFLASH_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = sFLASH_CS_PIN;
GPIO_Init(sFLASH_CS_GPIO_PORT, &GPIO_InitStructure);
}
示例7: ADS1256_LowLevel_DeInit
/**
* @brief DeInitializes the peripherals used by the SPI driver.
* @param none
* @retval none
*/
static void ADS1256_LowLevel_DeInit(void) {
GPIO_InitTypeDef GPIO_InitStructure;
/* Disable the ADS1256_SPI */
SPI_Cmd(ADS1256_SPI, DISABLE);
/* DeInitializes the ADS1256_SPI */
SPI_I2S_DeInit(ADS1256_SPI);
/* ADS1256_SPI Periph clock disable */
ADS1256_SPI_CLK_INIT(ADS1256_SPI_CLK, DISABLE);
/* Configure all pins used by the SPI as input floating */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = ADS1256_SPI_SCK_PIN;
GPIO_Init(ADS1256_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADS1256_SPI_MISO_PIN;
GPIO_Init(ADS1256_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADS1256_SPI_MOSI_PIN;
GPIO_Init(ADS1256_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = ADS1256_CS_PIN;
GPIO_Init(ADS1256_CS_GPIO_PORT, &GPIO_InitStructure);
}
示例8: UiLcdHy28_SpiDeInit
//*----------------------------------------------------------------------------
//* Function Name : UiLcdHy28_SpiInit
//* Object :
//* Input Parameters :
//* Output Parameters :
//* Functions called :
//*----------------------------------------------------------------------------
void UiLcdHy28_SpiDeInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_Cmd(SPI2, DISABLE);
SPI_I2S_DeInit(SPI2);
// Set as inputs
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
// SPI SCK pin configuration
GPIO_InitStructure.GPIO_Pin = LCD_SCK;
GPIO_Init(LCD_SCK_PIO, &GPIO_InitStructure);
// SPI MOSI pins configuration
GPIO_InitStructure.GPIO_Pin = LCD_MOSI;
GPIO_Init(LCD_MOSI_PIO, &GPIO_InitStructure);
// SPI MISO pins configuration
GPIO_InitStructure.GPIO_Pin = LCD_MISO;
GPIO_Init(LCD_MISO_PIO, &GPIO_InitStructure);
// Configure GPIO PIN for Chip select
GPIO_InitStructure.GPIO_Pin = LCD_CS;
GPIO_Init(LCD_CS_PIO, &GPIO_InitStructure);
}
示例9: configureSPI
void configureSPI(void)
{
// NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStruct;
SPI_I2S_DeInit(SPI2);
// Init pins
GPIO_InitStructure.GPIO_Pin = PIN_SCK | PIN_MOSI; // SCK,MOSI
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = PIN_MISO; // MISO
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
SPI_StructInit(&SPI_InitStruct);
SPI_InitStruct.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStruct.SPI_Mode = SPI_Mode_Master;
SPI_InitStruct.SPI_NSS = SPI_NSS_Soft;
SPI_InitStruct.SPI_DataSize = SPI_DataSize_16b;
SPI_InitStruct.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8;
SPI_Init(SPI2, &SPI_InitStruct);
SPI_Cmd(SPI2, ENABLE);
}
示例10: sEE_SPI_LowLevel_DeInit
/**
* @brief DeInitializes the SPI interface.
* @param None
* @retval None
*/
void sEE_SPI_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_Cmd(sEE_SPI, DISABLE); /* sEE_SPI disable */
SPI_I2S_DeInit(sEE_SPI); /* DeInitializes the sEE_SPI */
/* sEE_SPI Periph clock disable */
RCC_APB1PeriphClockCmd(sEE_SPI_CLK, DISABLE);
/* Configure sEE_SPI pins: SCK */
GPIO_InitStructure.GPIO_Pin = sEE_SPI_SCK_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(sEE_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
/* Configure sEE pins: MISO */
GPIO_InitStructure.GPIO_Pin = sEE_SPI_MISO_PIN;
GPIO_Init(sEE_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
/* Configure sEE pins: MOSI */
GPIO_InitStructure.GPIO_Pin = sEE_SPI_MOSI_PIN;
GPIO_Init(sEE_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
/* Configure sEE_CS_PIN pin: sEE Card CS pin */
GPIO_InitStructure.GPIO_Pin = sEE_SPI_CS_PIN;
GPIO_Init(sEE_SPI_CS_GPIO_PORT, &GPIO_InitStructure);
}
示例11: sFLASH_LowLevel_DeInit
/**
* @brief DeInitializes the peripherals used by the SPI FLASH driver.
* @param None
* @retval None
*/
void sFLASH_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/*!< Disable the sFLASH_SPI */
SPI_Cmd(sFLASH_SPI, DISABLE);
/*!< DeInitializes the sFLASH_SPI */
SPI_I2S_DeInit(sFLASH_SPI);
/*!< sFLASH_SPI Periph clock disable */
RCC_APB2PeriphClockCmd(sFLASH_SPI_CLK, DISABLE);
/*!< Configure sFLASH_SPI pins: SCK */
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_SCK_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(sFLASH_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure sFLASH_SPI pins: MISO */
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MISO_PIN;
GPIO_Init(sFLASH_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure sFLASH_SPI pins: MOSI */
GPIO_InitStructure.GPIO_Pin = sFLASH_SPI_MOSI_PIN;
GPIO_Init(sFLASH_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure sFLASH_CS_PIN pin: sFLASH Card CS pin */
GPIO_InitStructure.GPIO_Pin = sFLASH_CS_PIN;
GPIO_Init(sFLASH_CS_GPIO_PORT, &GPIO_InitStructure);
}
示例12: SD_LowLevel_DeInit
/**
* @brief DeInitializes the SD/SD communication.
* @param None
* @retval None
*/
void SD_LowLevel_DeInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_Cmd(SD_SPI, DISABLE); /*!< SD_SPI disable */
SPI_I2S_DeInit(SD_SPI); /*!< DeInitializes the SD_SPI */
/*!< SD_SPI Periph clock disable */
RCC_APB1PeriphClockCmd(SD_SPI_CLK, DISABLE);
/*!< DeRemap SPI3 Pins */
GPIO_PinRemapConfig(GPIO_Remap_SPI3, DISABLE);
/*!< Configure SD_SPI pins: SCK */
GPIO_InitStructure.GPIO_Pin = SD_SPI_SCK_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(SD_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure SD_SPI pins: MISO */
GPIO_InitStructure.GPIO_Pin = SD_SPI_MISO_PIN;
GPIO_Init(SD_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure SD_SPI pins: MOSI */
GPIO_InitStructure.GPIO_Pin = SD_SPI_MOSI_PIN;
GPIO_Init(SD_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure SD_SPI_CS_PIN pin: SD Card CS pin */
GPIO_InitStructure.GPIO_Pin = SD_CS_PIN;
GPIO_Init(SD_CS_GPIO_PORT, &GPIO_InitStructure);
/*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);
}
示例13: Codec_AudioInterface_Init
/**
* @brief Initializes the Audio Codec audio interface (I2S)
* @note This function assumes that the I2S input clock (through PLL_R in
* Devices RevA/Z and through dedicated PLLI2S_R in Devices RevB/Y)
* is already configured and ready to be used.
* @param AudioFreq: Audio frequency to be configured for the I2S peripheral.
* @retval None.
*/
static void Codec_AudioInterface_Init(uint32_t AudioFreq)
{
/* Enable the CODEC_I2S peripheral clock */
RCC_APB1PeriphClockCmd(CODEC_I2S_CLK, ENABLE);
RCC->APB1ENR |= RCC_APB1Periph_SPI2 | RCC_APB1Periph_SPI3;
/* CODEC_I2S peripheral configuration */
SPI_I2S_DeInit(CODEC_I2S);
I2S_InitStructure.I2S_AudioFreq = AudioFreq;
I2S_InitStructure.I2S_Standard = I2S_STANDARD;
I2S_InitStructure.I2S_DataFormat = I2S_DataFormat_16b;
I2S_InitStructure.I2S_CPOL = I2S_CPOL_Low;
I2S_InitStructure.I2S_Mode = I2S_Mode_MasterTx;
#ifdef CODEC_MCLK_ENABLED
I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable;
#elif defined(CODEC_MCLK_DISABLED)
I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Disable;
#else
#error "No selection for the MCLK output has been defined !"
#endif /* CODEC_MCLK_ENABLED */
/* Initialize the I2S peripheral with the structure above */
I2S_Init(CODEC_I2S, &I2S_InitStructure);
/* Enable the I2S DMA TX request */
SPI_I2S_DMACmd(CODEC_I2S, SPI_I2S_DMAReq_Tx, ENABLE);
/* The I2S peripheral will be enabled only in the EVAL_AUDIO_Play() function
or by user functions if DMA mode not enabled */
}
示例14: setup_SPI
void setup_SPI(){
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
SPI_I2S_DeInit(SPI2);
SPI_InitTypeDef SPI_InitStructure;
SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Tx; //Two serial lines only
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; //8 bit transfers
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; //Idle high clock
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; //rising edge transfer
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; //Software SS
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8; //Use 10.5 MHz clock
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; //MSB first
SPI_InitStructure.SPI_CRCPolynomial = 7; //Some value?
/* Initializes the SPI communication */
SPI_InitStructure.SPI_Mode = SPI_Mode_Master; //master mode
SPI_Init(SPI2, &SPI_InitStructure); //init
SPI_Cmd(SPI2, ENABLE);
}
示例15: FRAM_sRF_SPI_Config
void FRAM_sRF_SPI_Config(void)
{
SPI_InitTypeDef SPI_InitStructure;
RCC_APB2PeriphClockCmd(FRAM_SPI_CLK, ENABLE);
FRAM_CS_HIGH();
/* Disable sRF_SPI */
SPI_Cmd(FRAM_SPI, DISABLE);
/*!< SPI configuration */
SPI_I2S_DeInit(FRAM_SPI);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(FRAM_SPI, &SPI_InitStructure);
/*!< Enable the sRF_SPI */
SPI_Cmd(FRAM_SPI, ENABLE);
}