void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct)
SPIx | 説明 |
SPI2 | SPI2を選択 |
SPI3 | SPI3を選択 |
typedef struct { uint16_t I2S_Mode; uint16_t I2S_Standard; uint16_t I2S_DataFormat; uint16_t I2S_MCLKOutput; uint16_t I2S_AudioFreq; uint16_t I2S_CPOL; } I2S_InitTypeDef;
I2S_Mode | 説明 |
I2S_Mode_SlaveTx | I2S peripheral is configured as Slave and Transmitter |
I2S_Mode_SlaveRx | I2S peripheral is configured as Slave and Receiver |
I2S_Mode_MasterTx | I2S peripheral is configured as Master and Transmitter |
I2S_Mode_MasterRx | I2S peripheral is configured as Master and Receiver |
I2S_Standard | 説明 |
I2S_Standardd_Phillips | Uses the Phillips I2S standard |
I2S_Standard_MSB Uses | the MSB standard |
I2S_Standard_LSB Uses | the LSB standard |
I2S_Standard_PCMShort | Uses PCM mode with short frame |
I2S_Standard_PCMLong | Uses PCM mode with long frame |
I2S_DataFormat | 説明 |
I2S_DataFormat_16b | Data are 16 bits long in 16 bits packet frame |
I2S_DataFormat_16bextended | Data are 16 bits long in 32 bits packet frame |
I2S_DataFormat_24b | Data are 24 bits long in 32 bits packet frame |
I2S_DataFormat_32b | Data are 32 bits long in 32 bits packet frame |
/* Initialize the SPI2 according to the I2S_InitStructure members */ I2S_InitTypeDef I2S_InitStructure; I2S_InitStructure.I2S_Mode = I2S_Mode_MasterTx; I2S_InitStructure.I2S_Standard = I2S_Standard_Phillips; I2S_InitStructure.I2S_DataFormat = I2S__DataFormat_16bextended; I2S_InitStructure.I2S_MCLKOutput = I2S_MCLKOutput_Enable; I2S_InitStructure.I2S_AudioFreq = I2S_AudioFreq_16K; I2S_InitStructure.I2S_CPOL = SPI_CPOL_Low; I2S_Init(SPI2, &I2S_InitStructure);