Пример #1
0
void CodecController::init(ApplicationSettings& settings){
// void CodecController::init(uint32_t frequency, I2SProtocol protocol, I2SFormat format, bool master){
//   setPin(GPIOA, GPIO_Pin_6); // DEBUG

  // settings.audio_samplingrate = frequency;
  // settings.audio_protocol = protocol;
  // settings.audio_format = format;
  // settings.audio_codec_master = master;

  /* configure codec */
  setCodecMaster(settings.audio_codec_master);
  setCodecProtocol(settings.audio_codec_protocol);
  setCodecFormat(settings.audio_codec_format);

  /* Configure the I2S peripheral */
  if(Codec_AudioInterface_Init(settings.audio_samplingrate, settings.audio_codec_master, 
			       settings.audio_codec_protocol, settings.audio_codec_format) != 0)
    assert_param(false);

  setInputGainLeft(settings.inputGainLeft);
  setInputGainRight(settings.inputGainRight);
  setOutputGainLeft(settings.outputGainLeft);
  setOutputGainRight(settings.outputGainRight);

  I2S_Block_Init();

//   clearPin(GPIOA, GPIO_Pin_6); // DEBUG
}
Пример #2
0
void CodecController::init(ApplicationSettings& settings){
//   setPin(GPIOA, GPIO_Pin_6); // DEBUG

  /* configure codec */
  setCodecMaster(settings.audio_codec_master);
  setCodecProtocol(settings.audio_codec_protocol);
  setCodecFormat(settings.audio_codec_format);

  /* Configure the I2S peripheral */
  if(Codec_AudioInterface_Init(settings.audio_samplingrate, settings.audio_codec_master, 
			       settings.audio_codec_protocol, settings.audio_codec_format) != 0)
    assert_param(false);

  setInputGainLeft(settings.inputGainLeft);
  setInputGainRight(settings.inputGainRight);
  setOutputGainLeft(settings.outputGainLeft);
  setOutputGainRight(settings.outputGainRight);

  I2S_Block_Init(tx_buffer, rx_buffer, settings.audio_blocksize);
  setBlocksize(settings.audio_blocksize);

//   clearPin(GPIOA, GPIO_Pin_6); // DEBUG
}