Il y avait des problèmes dans la libraire...
Fork of ST_I2S by
Diff: targets/TARGET_STM/stm_i2s_api.c
- Revision:
- 4:21603d68bcf7
- Parent:
- 3:25de898f5354
- Child:
- 8:561d7ee70ef6
--- a/targets/TARGET_STM/stm_i2s_api.c Wed Dec 14 14:23:12 2016 +0100 +++ b/targets/TARGET_STM/stm_i2s_api.c Wed Dec 21 20:24:16 2016 +0100 @@ -328,8 +328,8 @@ /* Set default configuration. Default frequency is 44100Hz. */ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S; - PeriphClkInitStruct.PLLI2S.PLLI2SN = 213; //Davide: use values which are suggested in Table 91 of the - PeriphClkInitStruct.PLLI2S.PLLI2SR = 2; // reference manual for master clock enabled & 32000Hz. + PeriphClkInitStruct.PLLI2S.PLLI2SN = 271; // betzw: use values which are suggested in Table 91 of the + PeriphClkInitStruct.PLLI2S.PLLI2SR = 2; // reference manual for master clock enabled & 44100Hz. #ifdef NDEBUG HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); @@ -348,11 +348,11 @@ handle->Init.Mode = i2s_get_mode(mode, &dma_direction); handle->Init.Standard = I2S_STANDARD_PCM_SHORT; handle->Init.DataFormat = I2S_DATAFORMAT_16B; + handle->Init.AudioFreq = I2S_AUDIOFREQ_44K; handle->Init.CPOL = I2S_CPOL_LOW; - handle->Init.AudioFreq = I2S_AUDIOFREQ_32K; //Davide: Default frequency is 32000Hz. handle->Init.ClockSource = I2S_CLOCK_PLL; handle->Init.FullDuplexMode = (fdpx == NC ? I2S_FULLDUPLEXMODE_DISABLE : I2S_FULLDUPLEXMODE_ENABLE); - handle->Init.MCLKOutput = (mclk == NC ? I2S_MCLKOUTPUT_DISABLE : I2S_MCLKOUTPUT_ENABLE); //Davide: Microphones need master clock disabled, while sound terminal needs it enabled. + handle->Init.MCLKOutput = (mclk == NC ? I2S_MCLKOUTPUT_DISABLE : I2S_MCLKOUTPUT_ENABLE); // Davide: Microphones need master clock disabled, while sound terminal needs it enabled. DEBUG_PRINTF("--> %s\r\n", __FUNCTION__); DEBUG_PRINTF(" I2S%u: Mode: %u (%u)\r\n", obj->i2s.module + 1, @@ -361,10 +361,10 @@ (unsigned int)handle->Init.Standard); DEBUG_PRINTF(" I2S%u: DataFormat: %u\r\n", obj->i2s.module + 1, (unsigned int)handle->Init.DataFormat); + DEBUG_PRINTF(" I2S%u: AudioFreq: %u\r\n", obj->i2s.module + 1, + (unsigned int)handle->Init.AudioFreq); DEBUG_PRINTF(" I2S%u: CPOL: %u\r\n", obj->i2s.module + 1, (unsigned int)handle->Init.CPOL); - DEBUG_PRINTF(" I2S%u: AudioFreq: %u\r\n", obj->i2s.module + 1, - (unsigned int)handle->Init.AudioFreq); DEBUG_PRINTF(" I2S%u: ClockSource: %u\r\n", obj->i2s.module + 1, (unsigned int)handle->Init.ClockSource); DEBUG_PRINTF(" I2S%u: FullDuplexMode: %u\r\n", obj->i2s.module + 1, @@ -814,4 +814,9 @@ __HAL_I2S_ENABLE(i2s_handle); } +I2S_HandleTypeDef *i2s_get_handle(i2s_t *obj) +{ + return (I2S_HandleTypeDef *) &I2sHandle[obj->i2s.module]; +} + #endif