components/driver/i2s.c
/**
 * @brief   Set TX PDM mode up-sample rate
 * @note    If you have set PDM mode while calling 'i2s_driver_install',
 *          default PDM TX upsample parameters have already been set,
 *          no need to call this function again if you don't have to change the default configuration
 *
 * @param   i2s_num         I2S device number
 * @param   upsample_cfg    Set I2S PDM up-sample rate configuration
 * @return
 *     - ESP_OK              Success
 *     - ESP_ERR_INVALID_ARG Parameter error
 *     - ESP_ERR_NO_MEM      Out of memory
 */
@brief   Set TX PDM mode up-sample rate
@note    If you have set PDM mode while calling 'i2s_driver_install',
default PDM TX upsample parameters have already been set,
no need to call this function again if you don't have to change the default configuration

@param   i2s_num         I2S device number
@param   upsample_cfg    Set I2S PDM up-sample rate configuration
@return
- ESP_OK              Success
- ESP_ERR_INVALID_ARG Parameter error
- ESP_ERR_NO_MEM      Out of memory
@brief Set TX PDM mode up - sample rate @note If you have set PDM mode while calling ' i2s_driver_install ' default PDM TX upsample parameters have already been set no need to call this function again if you don ' t have to change the default configuration @param i2s_num I2S device number @param upsample_cfg Set I2S PDM up - sample rate configuration @return - ESP_OK Success - ESP_ERR_INVALID_ARG Parameter error - ESP_ERR_NO_MEM Out of memory
esp_err_t i2s_set_pdm_tx_up_sample(i2s_port_t i2s_num, const i2s_pdm_tx_upsample_cfg_t *upsample_cfg)
{
    ESP_RETURN_ON_FALSE(p_i2s[i2s_num], ESP_FAIL, TAG, "i2s has not installed yet");
    ESP_RETURN_ON_FALSE((p_i2s[i2s_num]->hal_cfg.mode & I2S_MODE_PDM), ESP_ERR_INVALID_ARG, TAG, "i2s mode is not PDM mode");
    i2s_stop(i2s_num);
    i2s_hal_set_tx_pdm_fpfs(&(p_i2s[i2s_num]->hal), upsample_cfg->fp, upsample_cfg->fs);
    return i2s_set_clk(i2s_num, upsample_cfg->sample_rate, p_i2s[i2s_num]->hal_cfg.sample_bits, p_i2s[i2s_num]->hal_cfg.active_chan);
}
esp_err_t i2s_set_pdm_tx_up_sample ( i2s_port_t i2s_num , const i2s_pdm_tx_upsample_cfg_t * upsample_cfg ) { ESP_RETURN_ON_FALSE ( p_i2s [ i2s_num ] , ESP_FAIL , TAG , " " ) ; ESP_RETURN_ON_FALSE ( ( p_i2s [ i2s_num ] -> hal_cfg . mode & I2S_MODE_PDM ) , ESP_ERR_INVALID_ARG , TAG , " " ) ; i2s_stop ( i2s_num ) ; i2s_hal_set_tx_pdm_fpfs ( & ( p_i2s [ i2s_num ] -> hal ) , upsample_cfg -> fp , upsample_cfg -> fs ) ; return i2s_set_clk ( i2s_num , upsample_cfg -> sample_rate , p_i2s [ i2s_num ] -> hal_cfg . sample_bits , p_i2s [ i2s_num ] -> hal_cfg . active_chan ) ; }
@brief   Set TX PDM mode up-sample rate
 @note    If you have set PDM mode while calling 'i2s_driver_install',
          default PDM TX upsample parameters have already been set,
          no need to call this function again if you don't have to change the default configuration
@brief Set TX PDM mode up - sample rate @note If you have set PDM mode while calling ' i2s_driver_install ' default PDM TX upsample parameters have already been set no need to call this function again if you don ' t have to change the default configuration
// i2s will start in 'i2s_set_clk'