diff --git a/docs/html/_audio_board_8h_source.html b/docs/html/_audio_board_8h_source.html index ba60363..63a83c7 100644 --- a/docs/html/_audio_board_8h_source.html +++ b/docs/html/_audio_board_8h_source.html @@ -170,8 +170,8 @@
audio_driver::AudioDriver
Abstract Driver API for codec chips.
Definition: Driver.h:169
audio_driver::AudioDriver::setMute
virtual bool setMute(bool enable)=0
audio_driver::AudioDriver::end
virtual bool end(void)
Definition: Driver.h:207
-
audio_driver::AudioDriver::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:212
-
audio_driver::AudioDriver::setPAPower
bool setPAPower(bool enable)
Sets the PA Power pin to active or inactive.
Definition: Driver.h:219
+
audio_driver::AudioDriver::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:218
+
audio_driver::AudioDriver::setPAPower
bool setPAPower(bool enable)
Sets the PA Power pin to active or inactive.
Definition: Driver.h:225
audio_driver::AudioDriver::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:171
audio_driver::AudioDriver::setVolume
virtual bool setVolume(int volume)=0
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
audio_driver::AudioDriver::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:183
@@ -184,22 +184,22 @@
audio_driver::DriverPins::setSPIActiveForSD
void setSPIActiveForSD(bool active)
Defines if SPI for SD should be started (by default true)
Definition: DriverPins.h:388
audio_driver::PinsLyratMini
static PinsLyratMiniClass PinsLyratMini
Definition: DriverPins.h:696
audio_driver::LyratV43
static AudioBoard LyratV43
Definition: AudioBoard.h:80
-
audio_driver::AudioDriverLyratMini
static AudioDriverLyratMiniClass AudioDriverLyratMini
Definition: Driver.h:1165
+
audio_driver::AudioDriverLyratMini
static AudioDriverLyratMiniClass AudioDriverLyratMini
Definition: Driver.h:1171
audio_driver::AudioKitEs8388V2
static AudioBoard AudioKitEs8388V2
Definition: AudioBoard.h:76
-
audio_driver::NoDriver
static NoDriverClass NoDriver
Definition: Driver.h:1167
+
audio_driver::NoDriver
static NoDriverClass NoDriver
Definition: Driver.h:1173
audio_driver::GenericCS43l22
static AudioBoard GenericCS43l22
Definition: AudioBoard.h:90
audio_driver::PinsLyrat42
static PinsLyrat42Class PinsLyrat42
Definition: DriverPins.h:694
audio_driver::PinsAudioKitAC101
static PinsAudioKitAC101Class PinsAudioKitAC101
Definition: DriverPins.h:702
audio_driver::GenericWM8960
static AudioBoard GenericWM8960
Definition: AudioBoard.h:88
audio_driver::PinsLyrat43
static PinsLyrat43Class PinsLyrat43
Definition: DriverPins.h:692
-
audio_driver::AudioDriverAC101
static AudioDriverAC101Class AudioDriverAC101
Definition: Driver.h:1143
+
audio_driver::AudioDriverAC101
static AudioDriverAC101Class AudioDriverAC101
Definition: Driver.h:1149
audio_driver::AudioKitEs8388V1
static AudioBoard AudioKitEs8388V1
Definition: AudioBoard.h:74
-
audio_driver::AudioDriverCS43l22
static AudioDriverCS43l22Class AudioDriverCS43l22
Definition: Driver.h:1145
+
audio_driver::AudioDriverCS43l22
static AudioDriverCS43l22Class AudioDriverCS43l22
Definition: Driver.h:1151
audio_driver::LyratV42
static AudioBoard LyratV42
Definition: AudioBoard.h:82
-
audio_driver::AudioDriverWM8960
static AudioDriverWM8960Class AudioDriverWM8960
Definition: Driver.h:1161
+
audio_driver::AudioDriverWM8960
static AudioDriverWM8960Class AudioDriverWM8960
Definition: Driver.h:1167
audio_driver::PinsAudioKitEs8388v1
static PinsAudioKitEs8388v1Class PinsAudioKitEs8388v1
Definition: DriverPins.h:698
audio_driver::LyratMini
static AudioBoard LyratMini
Definition: AudioBoard.h:84
-
audio_driver::AudioDriverES8388
static AudioDriverES8388Class AudioDriverES8388
Definition: Driver.h:1159
+
audio_driver::AudioDriverES8388
static AudioDriverES8388Class AudioDriverES8388
Definition: Driver.h:1165
audio_driver::NoPins
static DriverPins NoPins
Pins need to be set up in the sketch.
Definition: DriverPins.h:690
audio_driver::AudioKitAC101
static AudioBoard AudioKitAC101
Definition: AudioBoard.h:78
audio_driver::PinsAudioKitEs8388v2
static PinsAudioKitEs8388v2Class PinsAudioKitEs8388v2
Definition: DriverPins.h:700
diff --git a/docs/html/_driver_8h_source.html b/docs/html/_driver_8h_source.html index 9292cc8..47681e7 100644 --- a/docs/html/_driver_8h_source.html +++ b/docs/html/_driver_8h_source.html @@ -258,860 +258,865 @@
206  }
207  virtual bool end(void) { return deinit(); }
208  virtual bool setMute(bool enable) = 0;
-
210  virtual bool setVolume(int volume) = 0;
-
211  virtual int getVolume() = 0;
-
212  virtual bool setInputVolume(int volume) { return false; }
-
213  virtual bool isVolumeSupported() { return true; }
-
214  virtual bool isInputVolumeSupported() { return false; }
-
215 
-
216  DriverPins &pins() { return *p_pins; }
-
217 
-
219  bool setPAPower(bool enable) {
-
220  GpioPin pin = pins().getPinID(PinFunction::PA);
-
221  if (pin == -1) {
-
222  return false;
-
223  }
-
224  AD_LOGI("setPAPower pin %d -> %d", pin, enable);
-
225  digitalWrite(pin, enable ? HIGH : LOW);
-
226  return true;
-
227  }
-
228 
-
229  protected:
-
230  CodecConfig codec_cfg;
-
231  DriverPins *p_pins = nullptr;
-
232 
-
234  TwoWire *getI2C() {
-
235  if (p_pins == nullptr) return &Wire;
-
236  auto i2c = pins().getI2CPins(PinFunction::CODEC);
-
237  if (!i2c) {
-
238  return &Wire;
-
239  }
-
240  return i2c.value().p_wire;
-
241  }
-
242 
-
243  int getI2CAddress() {
-
244  if (p_pins == nullptr) return -1;
-
245  auto i2c = pins().getI2CPins(PinFunction::CODEC);
-
246  if (i2c) {
-
247  return i2c.value().port;
-
248  }
-
249  return -1;
-
250  }
-
251 
-
252  virtual bool init(codec_config_t codec_cfg) { return false; }
-
253  virtual bool deinit() { return false; }
-
254  virtual bool controlState(codec_mode_t mode) { return false; };
-
255  virtual bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
256  return false;
-
257  };
-
258 
-
262  int limitValue(int volume, int min = 0, int max = 100) {
-
263  if (volume > max) volume = max;
-
264  if (volume < min) volume = min;
-
265  return volume;
-
266  }
-
267 };
-
268 
-
275 class NoDriverClass : public AudioDriver {
-
276  public:
-
277  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
-
278  codec_cfg = codecCfg;
-
279  p_pins = &pins;
-
280  return true;
-
281  }
-
282  virtual bool end(void) { return true; }
-
283  virtual bool setMute(bool enable) { return false; }
-
284  virtual bool setVolume(int volume) { return false; }
-
285  virtual int getVolume() { return 100; }
-
286  virtual bool setInputVolume(int volume) { return false; }
-
287  virtual bool isVolumeSupported() {
-
288  { return false; }
-
289  }
-
290  virtual bool isInputVolumeSupported() { return false; }
-
291 };
-
292 
-
298 class AudioDriverAC101Class : public AudioDriver {
-
299  public:
-
300  bool setMute(bool mute) { return ac101_set_voice_mute(mute); }
-
301  bool setVolume(int volume) {
-
302  return ac101_set_voice_volume(limitValue(volume));
-
303  };
-
304  int getVolume() {
-
305  int vol;
-
306  ac101_get_voice_volume(&vol);
-
307  return vol;
-
308  };
-
309 
-
310  protected:
-
311  bool init(codec_config_t codec_cfg) {
-
312  return ac101_init(&codec_cfg, getI2C(), getI2CAddress()) == RESULT_OK;
-
313  }
-
314  bool deinit() { return ac101_deinit() == RESULT_OK; }
-
315  bool controlState(codec_mode_t mode) {
-
316  return ac101_ctrl_state_active(mode, true) == RESULT_OK;
-
317  }
-
318  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
319  return ac101_config_i2s(mode, &iface) == RESULT_OK;
-
320  }
-
321 };
-
322 
-
328 class AudioDriverAD1938Class : public AudioDriver {
-
329  public:
-
330  bool begin(CodecConfig codecCfg, DriverPins &pins) override {
-
331  int clatch = pins.getPinID(PinFunction::LATCH);
-
332  if (clatch < 0) return false;
-
333  int reset = pins.getPinID(PinFunction::RESET);
-
334  if (reset < 0) return false;
-
335  auto spi_opt = pins.getSPIPins(PinFunction::CODEC);
-
336  SPIClass *p_spi = nullptr;
-
337  if (spi_opt) {
-
338  p_spi = spi_opt.value().p_spi;
-
339  } else {
-
340  p_spi = &SPI;
-
341  p_spi->begin();
-
342  }
-
343  // setup pins
-
344  pins.begin();
-
345  // setup ad1938
-
346  ad1938.begin(codecCfg, clatch, reset, *p_spi);
-
347  ad1938.enable();
-
348  ad1938.setMute(false);
-
349  return true;
-
350  }
-
351  virtual bool setConfig(CodecConfig codecCfg) {
-
352  bool result = begin(codecCfg, *p_pins);
-
353  return result;
-
354  }
-
355  bool end(void) override { return ad1938.end(); }
-
356  bool setMute(bool mute) override { return ad1938.setMute(mute); }
-
357  // mutes an individual DAC
-
358  bool setMute(bool mute, int line) {
-
359  if (line > 7) return false;
-
360  return ad1938.setVolumeDAC(line, mute ? 0.0 : (static_cast<float>(volumes[line]) / 100.0f));
-
361  }
-
362 
-
364  bool setVolume(int volume) override {
-
365  this->volume = volume;
-
366  for (int j=0;j<8;j++){
-
367  volumes[j] = volume;
-
368  }
-
369  return ad1938.setVolume(static_cast<float>(volume) / 100.0f);
-
370  }
-
372  bool setVolume(int volume, int line) {
-
373  if (line > 7) return false;
-
374  volumes[line] = volume;
-
375  return ad1938.setVolumeDAC(static_cast<float>(volume) / 100.0f, line);
+
210  virtual bool setMute(bool mute, int line) {
+
211  AD_LOGE("setMute not supported on line level");
+
212  return false;
+
213  }
+
214 
+
216  virtual bool setVolume(int volume) = 0;
+
217  virtual int getVolume() = 0;
+
218  virtual bool setInputVolume(int volume) { return false; }
+
219  virtual bool isVolumeSupported() { return true; }
+
220  virtual bool isInputVolumeSupported() { return false; }
+
221 
+
222  DriverPins &pins() { return *p_pins; }
+
223 
+
225  bool setPAPower(bool enable) {
+
226  GpioPin pin = pins().getPinID(PinFunction::PA);
+
227  if (pin == -1) {
+
228  return false;
+
229  }
+
230  AD_LOGI("setPAPower pin %d -> %d", pin, enable);
+
231  digitalWrite(pin, enable ? HIGH : LOW);
+
232  return true;
+
233  }
+
234 
+
235  protected:
+
236  CodecConfig codec_cfg;
+
237  DriverPins *p_pins = nullptr;
+
238 
+
240  TwoWire *getI2C() {
+
241  if (p_pins == nullptr) return &Wire;
+
242  auto i2c = pins().getI2CPins(PinFunction::CODEC);
+
243  if (!i2c) {
+
244  return &Wire;
+
245  }
+
246  return i2c.value().p_wire;
+
247  }
+
248 
+
249  int getI2CAddress() {
+
250  if (p_pins == nullptr) return -1;
+
251  auto i2c = pins().getI2CPins(PinFunction::CODEC);
+
252  if (i2c) {
+
253  return i2c.value().port;
+
254  }
+
255  return -1;
+
256  }
+
257 
+
258  virtual bool init(codec_config_t codec_cfg) { return false; }
+
259  virtual bool deinit() { return false; }
+
260  virtual bool controlState(codec_mode_t mode) { return false; };
+
261  virtual bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
262  return false;
+
263  };
+
264 
+
268  int limitValue(int volume, int min = 0, int max = 100) {
+
269  if (volume > max) volume = max;
+
270  if (volume < min) volume = min;
+
271  return volume;
+
272  }
+
273 };
+
274 
+
281 class NoDriverClass : public AudioDriver {
+
282  public:
+
283  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
+
284  codec_cfg = codecCfg;
+
285  p_pins = &pins;
+
286  return true;
+
287  }
+
288  virtual bool end(void) { return true; }
+
289  virtual bool setMute(bool enable) { return false; }
+
290  virtual bool setVolume(int volume) { return false; }
+
291  virtual int getVolume() { return 100; }
+
292  virtual bool setInputVolume(int volume) { return false; }
+
293  virtual bool isVolumeSupported() {
+
294  { return false; }
+
295  }
+
296  virtual bool isInputVolumeSupported() { return false; }
+
297 };
+
298 
+
304 class AudioDriverAC101Class : public AudioDriver {
+
305  public:
+
306  bool setMute(bool mute) { return ac101_set_voice_mute(mute); }
+
307  bool setVolume(int volume) {
+
308  return ac101_set_voice_volume(limitValue(volume));
+
309  };
+
310  int getVolume() {
+
311  int vol;
+
312  ac101_get_voice_volume(&vol);
+
313  return vol;
+
314  };
+
315 
+
316  protected:
+
317  bool init(codec_config_t codec_cfg) {
+
318  return ac101_init(&codec_cfg, getI2C(), getI2CAddress()) == RESULT_OK;
+
319  }
+
320  bool deinit() { return ac101_deinit() == RESULT_OK; }
+
321  bool controlState(codec_mode_t mode) {
+
322  return ac101_ctrl_state_active(mode, true) == RESULT_OK;
+
323  }
+
324  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
325  return ac101_config_i2s(mode, &iface) == RESULT_OK;
+
326  }
+
327 };
+
328 
+
334 class AudioDriverAD1938Class : public AudioDriver {
+
335  public:
+
336  bool begin(CodecConfig codecCfg, DriverPins &pins) override {
+
337  int clatch = pins.getPinID(PinFunction::LATCH);
+
338  if (clatch < 0) return false;
+
339  int reset = pins.getPinID(PinFunction::RESET);
+
340  if (reset < 0) return false;
+
341  auto spi_opt = pins.getSPIPins(PinFunction::CODEC);
+
342  SPIClass *p_spi = nullptr;
+
343  if (spi_opt) {
+
344  p_spi = spi_opt.value().p_spi;
+
345  } else {
+
346  p_spi = &SPI;
+
347  p_spi->begin();
+
348  }
+
349  // setup pins
+
350  pins.begin();
+
351  // setup ad1938
+
352  ad1938.begin(codecCfg, clatch, reset, *p_spi);
+
353  ad1938.enable();
+
354  ad1938.setMute(false);
+
355  return true;
+
356  }
+
357  virtual bool setConfig(CodecConfig codecCfg) {
+
358  bool result = begin(codecCfg, *p_pins);
+
359  return result;
+
360  }
+
361  bool end(void) override { return ad1938.end(); }
+
362  bool setMute(bool mute) override { return ad1938.setMute(mute); }
+
363  // mutes an individual DAC
+
364  bool setMute(bool mute, int line) {
+
365  if (line > 7) return false;
+
366  return ad1938.setVolumeDAC(line, mute ? 0.0 : (static_cast<float>(volumes[line]) / 100.0f));
+
367  }
+
368 
+
370  bool setVolume(int volume) override {
+
371  this->volume = volume;
+
372  for (int j=0;j<8;j++){
+
373  volumes[j] = volume;
+
374  }
+
375  return ad1938.setVolume(static_cast<float>(volume) / 100.0f);
376  }
-
377 
-
378  int getVolume() override { return volume; }
-
379  bool setInputVolume(int volume) override { return false; }
-
380  bool isVolumeSupported() override { return true; }
-
381  bool isInputVolumeSupported() override { return false; }
-
382 
-
383  DriverPins &pins() { return *p_pins; }
-
384  AD1938 &driver() { return ad1938; }
-
385 
-
386  protected:
-
387  AD1938 ad1938;
-
388  DriverPins *p_pins = nullptr;
-
389  int volume = 100;
-
390  int volumes[8] = {100};
-
391 };
-
392 
-
398 class AudioDriverCS43l22Class : public AudioDriver {
-
399  public:
-
400  AudioDriverCS43l22Class(uint16_t deviceAddr = 0x4A) {
-
401  this->deviceAddr = deviceAddr;
-
402  }
-
403 
-
404  void setI2CAddress(uint16_t adr) { deviceAddr = adr; }
-
405 
-
406  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
-
407  AD_LOGD("AudioDriverCS43l22Class::begin");
-
408  p_pins = &pins;
-
409  codec_cfg = codecCfg;
-
410  // manage reset pin -> acive high
-
411  setPAPower(true);
-
412  // Setup enable pin for codec
-
413  delay(100);
-
414  uint32_t freq = getFrequency(codec_cfg.i2s.rate);
-
415  uint16_t outputDevice = getOutput(codec_cfg.output_device);
-
416  AD_LOGD("cs43l22_Init");
-
417  bool result =
-
418  cs43l22_Init(deviceAddr, outputDevice, volume, freq, getI2C()) == 0;
-
419  if (!result) {
-
420  AD_LOGE("error: cs43l22_Init");
-
421  }
-
422  cs43l22_Play(deviceAddr, nullptr, 0);
-
423  return result;
-
424  }
-
425 
-
426  virtual bool setConfig(CodecConfig codecCfg) {
-
427  codec_cfg = codecCfg;
-
428  uint32_t freq = getFrequency(codec_cfg.i2s.rate);
-
429  uint16_t outputDevice = getOutput(codec_cfg.output_device);
-
430  return cs43l22_Init(deviceAddr, outputDevice, this->volume, freq,
-
431  getI2C()) == 0;
-
432  }
-
433 
-
434  bool setMute(bool mute) {
-
435  uint32_t rc = mute ? cs43l22_Pause(deviceAddr) : cs43l22_Resume(deviceAddr);
-
436  return rc == 0;
-
437  }
-
438 
-
439  bool setVolume(int volume) {
-
440  this->volume = volume;
-
441  return cs43l22_SetVolume(deviceAddr, volume) == 0;
-
442  }
-
443  int getVolume() { return volume; }
+
378  bool setVolume(int volume, int line) {
+
379  if (line > 7) return false;
+
380  volumes[line] = volume;
+
381  return ad1938.setVolumeDAC(static_cast<float>(volume) / 100.0f, line);
+
382  }
+
383 
+
384  int getVolume() override { return volume; }
+
385  bool setInputVolume(int volume) override { return false; }
+
386  bool isVolumeSupported() override { return true; }
+
387  bool isInputVolumeSupported() override { return false; }
+
388 
+
389  DriverPins &pins() { return *p_pins; }
+
390  AD1938 &driver() { return ad1938; }
+
391 
+
392  protected:
+
393  AD1938 ad1938;
+
394  DriverPins *p_pins = nullptr;
+
395  int volume = 100;
+
396  int volumes[8] = {100};
+
397 };
+
398 
+
404 class AudioDriverCS43l22Class : public AudioDriver {
+
405  public:
+
406  AudioDriverCS43l22Class(uint16_t deviceAddr = 0x4A) {
+
407  this->deviceAddr = deviceAddr;
+
408  }
+
409 
+
410  void setI2CAddress(uint16_t adr) { deviceAddr = adr; }
+
411 
+
412  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
+
413  AD_LOGD("AudioDriverCS43l22Class::begin");
+
414  p_pins = &pins;
+
415  codec_cfg = codecCfg;
+
416  // manage reset pin -> acive high
+
417  setPAPower(true);
+
418  // Setup enable pin for codec
+
419  delay(100);
+
420  uint32_t freq = getFrequency(codec_cfg.i2s.rate);
+
421  uint16_t outputDevice = getOutput(codec_cfg.output_device);
+
422  AD_LOGD("cs43l22_Init");
+
423  bool result =
+
424  cs43l22_Init(deviceAddr, outputDevice, volume, freq, getI2C()) == 0;
+
425  if (!result) {
+
426  AD_LOGE("error: cs43l22_Init");
+
427  }
+
428  cs43l22_Play(deviceAddr, nullptr, 0);
+
429  return result;
+
430  }
+
431 
+
432  virtual bool setConfig(CodecConfig codecCfg) {
+
433  codec_cfg = codecCfg;
+
434  uint32_t freq = getFrequency(codec_cfg.i2s.rate);
+
435  uint16_t outputDevice = getOutput(codec_cfg.output_device);
+
436  return cs43l22_Init(deviceAddr, outputDevice, this->volume, freq,
+
437  getI2C()) == 0;
+
438  }
+
439 
+
440  bool setMute(bool mute) {
+
441  uint32_t rc = mute ? cs43l22_Pause(deviceAddr) : cs43l22_Resume(deviceAddr);
+
442  return rc == 0;
+
443  }
444 
-
445  protected:
-
446  uint16_t deviceAddr;
-
447  int volume = 100;
-
448 
-
449  bool deinit() {
-
450  int cnt = cs43l22_Stop(deviceAddr, AUDIO_MUTE_ON);
-
451  cnt += cs43l22_Reset(deviceAddr);
-
452  setPAPower(false);
-
453  return cnt == 0;
-
454  }
-
455 
-
456  uint32_t getFrequency(samplerate_t rateNum) {
-
457  switch (rateNum) {
-
458  case RATE_8K:
-
459  return 8000;
-
460  case RATE_11K:
-
461  return 11024;
-
462  case RATE_16K:
-
463  return 16000;
-
464  case RATE_22K:
-
465  return 22050;
-
466  case RATE_24K:
-
467  return 24000;
-
468  case RATE_32K:
-
469  return 32000;
-
470  case RATE_44K:
-
471  return 44100;
-
472  case RATE_48K:
-
473  return 48000;
-
474  }
-
475  return 44100;
-
476  }
-
477 
-
478  uint16_t getOutput(output_device_t output_device) {
-
479  switch (output_device) {
-
480  case DAC_OUTPUT_NONE:
-
481  return 0;
-
482  case DAC_OUTPUT_LINE1:
-
483  return OUTPUT_DEVICE_SPEAKER;
-
484  case DAC_OUTPUT_LINE2:
-
485  return OUTPUT_DEVICE_HEADPHONE;
-
486  case DAC_OUTPUT_ALL:
-
487  return OUTPUT_DEVICE_BOTH;
-
488  }
-
489  return OUTPUT_DEVICE_BOTH;
-
490  }
-
491 };
-
492 
-
498 class AudioDriverCS42448Class : public AudioDriver {
-
499  public:
-
500  bool begin(CodecConfig codecCfg, DriverPins &pins) override {
-
501  cfg = codecCfg;
-
502  // setup pins
-
503  pins.begin();
-
504  // setup cs42448
-
505  cs42448.begin(cfg, getI2C(), getI2CAddress());
-
506  cs42448.setMute(false);
-
507  return true;
-
508  }
-
509  virtual bool setConfig(CodecConfig codecCfg) {
-
510  bool result = true;
-
511  if (codecCfg.equalsExRate(cfg)) {
-
512  // just update the rate
-
513  if (cfg.i2s.rate != cfg.i2s.rate) {
-
514  cs42448.setMute(true);
-
515  cs42448.setSampleRate(codecCfg.getRateNumeric());
-
516  cs42448.setMute(false);
-
517  }
-
518  } else {
-
519  result = begin(codecCfg, *p_pins);
-
520  }
-
521  return result;
-
522  }
-
523  bool end(void) override { return cs42448.end(); }
-
524  bool setMute(bool enable) override { return cs42448.setMute(enable); }
-
525  bool setMute(bool enable, int line) {
-
526  return cs42448.setMuteDAC(line, enable);
-
527  }
-
529  bool setVolume(int volume) override {
-
530  this->volume = volume;
-
531  return cs42448.setVolumeDAC(2.55f * volume);
-
532  }
-
533  bool setVolume(int dac, int volume) {
-
534  return cs42448.setVolumeDAC(dac, 2.55f * volume);
-
535  }
-
536 
-
537  int getVolume() override { return volume; }
-
538  bool setInputVolume(int volume) override {
-
539  int vol = map(volume, 0, 100, -128, 127);
-
540  return cs42448.setVolumeADC(vol);
+
445  bool setVolume(int volume) {
+
446  this->volume = volume;
+
447  return cs43l22_SetVolume(deviceAddr, volume) == 0;
+
448  }
+
449  int getVolume() { return volume; }
+
450 
+
451  protected:
+
452  uint16_t deviceAddr;
+
453  int volume = 100;
+
454 
+
455  bool deinit() {
+
456  int cnt = cs43l22_Stop(deviceAddr, AUDIO_MUTE_ON);
+
457  cnt += cs43l22_Reset(deviceAddr);
+
458  setPAPower(false);
+
459  return cnt == 0;
+
460  }
+
461 
+
462  uint32_t getFrequency(samplerate_t rateNum) {
+
463  switch (rateNum) {
+
464  case RATE_8K:
+
465  return 8000;
+
466  case RATE_11K:
+
467  return 11024;
+
468  case RATE_16K:
+
469  return 16000;
+
470  case RATE_22K:
+
471  return 22050;
+
472  case RATE_24K:
+
473  return 24000;
+
474  case RATE_32K:
+
475  return 32000;
+
476  case RATE_44K:
+
477  return 44100;
+
478  case RATE_48K:
+
479  return 48000;
+
480  }
+
481  return 44100;
+
482  }
+
483 
+
484  uint16_t getOutput(output_device_t output_device) {
+
485  switch (output_device) {
+
486  case DAC_OUTPUT_NONE:
+
487  return 0;
+
488  case DAC_OUTPUT_LINE1:
+
489  return OUTPUT_DEVICE_SPEAKER;
+
490  case DAC_OUTPUT_LINE2:
+
491  return OUTPUT_DEVICE_HEADPHONE;
+
492  case DAC_OUTPUT_ALL:
+
493  return OUTPUT_DEVICE_BOTH;
+
494  }
+
495  return OUTPUT_DEVICE_BOTH;
+
496  }
+
497 };
+
498 
+
504 class AudioDriverCS42448Class : public AudioDriver {
+
505  public:
+
506  bool begin(CodecConfig codecCfg, DriverPins &pins) override {
+
507  cfg = codecCfg;
+
508  // setup pins
+
509  pins.begin();
+
510  // setup cs42448
+
511  cs42448.begin(cfg, getI2C(), getI2CAddress());
+
512  cs42448.setMute(false);
+
513  return true;
+
514  }
+
515  virtual bool setConfig(CodecConfig codecCfg) {
+
516  bool result = true;
+
517  if (codecCfg.equalsExRate(cfg)) {
+
518  // just update the rate
+
519  if (cfg.i2s.rate != cfg.i2s.rate) {
+
520  cs42448.setMute(true);
+
521  cs42448.setSampleRate(codecCfg.getRateNumeric());
+
522  cs42448.setMute(false);
+
523  }
+
524  } else {
+
525  result = begin(codecCfg, *p_pins);
+
526  }
+
527  return result;
+
528  }
+
529  bool end(void) override { return cs42448.end(); }
+
530  bool setMute(bool enable) override { return cs42448.setMute(enable); }
+
531  bool setMute(bool enable, int line) {
+
532  return cs42448.setMuteDAC(line, enable);
+
533  }
+
535  bool setVolume(int volume) override {
+
536  this->volume = volume;
+
537  return cs42448.setVolumeDAC(2.55f * volume);
+
538  }
+
539  bool setVolume(int dac, int volume) {
+
540  return cs42448.setVolumeDAC(dac, 2.55f * volume);
541  }
-
542  bool isVolumeSupported() override { return true; }
-
543  bool isInputVolumeSupported() override { return true; }
-
544 
-
545  DriverPins &pins() { return *p_pins; }
-
546  CS42448 &driver() { return cs42448; }
-
547 
-
548  protected:
-
549  CS42448 cs42448;
-
550  DriverPins *p_pins = nullptr;
-
551  int volume = 100;
-
552  CodecConfig cfg;
-
553 };
-
554 
-
560 class AudioDriverES7210Class : public AudioDriver {
-
561  public:
-
562  bool setMute(bool mute) { return es7210_set_mute(mute) == RESULT_OK; }
-
563  bool setVolume(int volume) {
-
564  this->volume = volume;
-
565  return es7210_adc_set_volume(limitValue(volume)) == RESULT_OK;
-
566  }
-
567  int getVolume() { return volume; }
-
568 
-
569  protected:
-
570  int volume;
-
571 
-
572  bool init(codec_config_t codec_cfg) {
-
573  return es7210_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
-
574  }
-
575  bool deinit() { return es7210_adc_deinit() == RESULT_OK; }
-
576 
-
577  bool controlState(codec_mode_t mode) {
-
578  return es7210_adc_ctrl_state_active(mode, true) == RESULT_OK;
-
579  }
-
580  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
581  return es7210_adc_config_i2s(mode, &iface) == RESULT_OK;
-
582  }
-
583 };
-
584 
-
590 class AudioDriverES7243Class : public AudioDriver {
-
591  public:
-
592  bool setMute(bool mute) {
-
593  return es7243_adc_set_voice_mute(mute) == RESULT_OK;
-
594  }
-
595  bool setVolume(int volume) {
-
596  return es7243_adc_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
597  }
-
598  int getVolume() {
-
599  int vol;
-
600  es7243_adc_get_voice_volume(&vol);
-
601  return vol;
-
602  }
-
603 
-
604  protected:
-
605  bool init(codec_config_t codec_cfg) {
-
606  return es7243_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
-
607  }
-
608  bool deinit() { return es7243_adc_deinit() == RESULT_OK; }
+
542 
+
543  int getVolume() override { return volume; }
+
544  bool setInputVolume(int volume) override {
+
545  int vol = map(volume, 0, 100, -128, 127);
+
546  return cs42448.setVolumeADC(vol);
+
547  }
+
548  bool isVolumeSupported() override { return true; }
+
549  bool isInputVolumeSupported() override { return true; }
+
550 
+
551  DriverPins &pins() { return *p_pins; }
+
552  CS42448 &driver() { return cs42448; }
+
553 
+
554  protected:
+
555  CS42448 cs42448;
+
556  DriverPins *p_pins = nullptr;
+
557  int volume = 100;
+
558  CodecConfig cfg;
+
559 };
+
560 
+
566 class AudioDriverES7210Class : public AudioDriver {
+
567  public:
+
568  bool setMute(bool mute) { return es7210_set_mute(mute) == RESULT_OK; }
+
569  bool setVolume(int volume) {
+
570  this->volume = volume;
+
571  return es7210_adc_set_volume(limitValue(volume)) == RESULT_OK;
+
572  }
+
573  int getVolume() { return volume; }
+
574 
+
575  protected:
+
576  int volume;
+
577 
+
578  bool init(codec_config_t codec_cfg) {
+
579  return es7210_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
+
580  }
+
581  bool deinit() { return es7210_adc_deinit() == RESULT_OK; }
+
582 
+
583  bool controlState(codec_mode_t mode) {
+
584  return es7210_adc_ctrl_state_active(mode, true) == RESULT_OK;
+
585  }
+
586  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
587  return es7210_adc_config_i2s(mode, &iface) == RESULT_OK;
+
588  }
+
589 };
+
590 
+
596 class AudioDriverES7243Class : public AudioDriver {
+
597  public:
+
598  bool setMute(bool mute) {
+
599  return es7243_adc_set_voice_mute(mute) == RESULT_OK;
+
600  }
+
601  bool setVolume(int volume) {
+
602  return es7243_adc_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
603  }
+
604  int getVolume() {
+
605  int vol;
+
606  es7243_adc_get_voice_volume(&vol);
+
607  return vol;
+
608  }
609 
-
610  bool controlState(codec_mode_t mode) {
-
611  return es7243_adc_ctrl_state_active(mode, true) == RESULT_OK;
-
612  }
-
613  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
614  return es7243_adc_config_i2s(mode, &iface) == RESULT_OK;
-
615  }
-
616 };
-
617 
-
624 class AudioDriverES7243eClass : public AudioDriver {
-
625  public:
-
626  bool setMute(bool mute) {
-
627  return mute ? setVolume(0) == RESULT_OK : setVolume(volume) == RESULT_OK;
-
628  }
-
629  bool setVolume(int volume) {
-
630  this->volume = volume;
-
631  return es7243e_adc_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
632  }
-
633  int getVolume() {
-
634  int vol;
-
635  es7243e_adc_get_voice_volume(&vol);
-
636  return vol;
-
637  }
-
638 
-
639  protected:
-
640  int volume = 0;
-
641 
-
642  bool init(codec_config_t codec_cfg) {
-
643  return es7243e_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
-
644  }
-
645  bool deinit() { return es7243e_adc_deinit() == RESULT_OK; }
-
646 
-
647  bool controlState(codec_mode_t mode) {
-
648  return es7243e_adc_ctrl_state_active(mode, true) == RESULT_OK;
-
649  }
-
650  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
651  return es7243e_adc_config_i2s(mode, &iface) == RESULT_OK;
-
652  }
-
653 };
-
654 
-
660 class AudioDriverES8156Class : public AudioDriver {
-
661  public:
-
662  bool setMute(bool mute) {
-
663  return es8156_codec_set_voice_mute(mute) == RESULT_OK;
-
664  }
-
665  bool setVolume(int volume) {
-
666  AD_LOGD("volume %d", volume);
-
667  return es8156_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
668  }
-
669  int getVolume() {
-
670  int vol;
-
671  es8156_codec_get_voice_volume(&vol);
-
672  return vol;
-
673  }
-
674 
-
675  protected:
-
676  bool init(codec_config_t codec_cfg) {
-
677  return es8156_codec_init(&codec_cfg, getI2C()) == RESULT_OK;
-
678  }
-
679  bool deinit() { return es8156_codec_deinit() == RESULT_OK; }
+
610  protected:
+
611  bool init(codec_config_t codec_cfg) {
+
612  return es7243_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
+
613  }
+
614  bool deinit() { return es7243_adc_deinit() == RESULT_OK; }
+
615 
+
616  bool controlState(codec_mode_t mode) {
+
617  return es7243_adc_ctrl_state_active(mode, true) == RESULT_OK;
+
618  }
+
619  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
620  return es7243_adc_config_i2s(mode, &iface) == RESULT_OK;
+
621  }
+
622 };
+
623 
+
630 class AudioDriverES7243eClass : public AudioDriver {
+
631  public:
+
632  bool setMute(bool mute) {
+
633  return mute ? setVolume(0) == RESULT_OK : setVolume(volume) == RESULT_OK;
+
634  }
+
635  bool setVolume(int volume) {
+
636  this->volume = volume;
+
637  return es7243e_adc_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
638  }
+
639  int getVolume() {
+
640  int vol;
+
641  es7243e_adc_get_voice_volume(&vol);
+
642  return vol;
+
643  }
+
644 
+
645  protected:
+
646  int volume = 0;
+
647 
+
648  bool init(codec_config_t codec_cfg) {
+
649  return es7243e_adc_init(&codec_cfg, getI2C()) == RESULT_OK;
+
650  }
+
651  bool deinit() { return es7243e_adc_deinit() == RESULT_OK; }
+
652 
+
653  bool controlState(codec_mode_t mode) {
+
654  return es7243e_adc_ctrl_state_active(mode, true) == RESULT_OK;
+
655  }
+
656  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
657  return es7243e_adc_config_i2s(mode, &iface) == RESULT_OK;
+
658  }
+
659 };
+
660 
+
666 class AudioDriverES8156Class : public AudioDriver {
+
667  public:
+
668  bool setMute(bool mute) {
+
669  return es8156_codec_set_voice_mute(mute) == RESULT_OK;
+
670  }
+
671  bool setVolume(int volume) {
+
672  AD_LOGD("volume %d", volume);
+
673  return es8156_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
674  }
+
675  int getVolume() {
+
676  int vol;
+
677  es8156_codec_get_voice_volume(&vol);
+
678  return vol;
+
679  }
680 
-
681  bool controlState(codec_mode_t mode) {
-
682  return es8156_codec_ctrl_state_active(mode, true) == RESULT_OK;
-
683  }
-
684  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
685  return es8156_codec_config_i2s(mode, &iface) == RESULT_OK;
-
686  }
-
687 };
-
688 
-
694 class AudioDriverES8311Class : public AudioDriver {
-
695  public:
-
696  AudioDriverES8311Class(int i2cAddr = 0) { i2c_address = i2cAddr; }
-
697  bool setMute(bool mute) { return es8311_set_voice_mute(mute) == RESULT_OK; }
-
698  bool setVolume(int volume) {
-
699  return es8311_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
700  }
-
701  int getVolume() {
-
702  int vol;
-
703  es8311_codec_get_voice_volume(&vol);
-
704  return vol;
-
705  }
-
706 
-
707  protected:
-
708  int i2c_address;
-
709 
-
710  bool init(codec_config_t codec_cfg) {
-
711  int mclk_src = pins().getPinID(PinFunction::MCLK_SOURCE);
-
712  if (mclk_src == -1) return false;
-
713 
-
714  // determine address from data
-
715  if (i2c_address <= 0) i2c_address = getI2CAddress();
-
716 
-
717  return es8311_codec_init(&codec_cfg, getI2C(), mclk_src, i2c_address) ==
-
718  RESULT_OK;
-
719  }
-
720  bool deinit() { return es8311_codec_deinit() == RESULT_OK; }
-
721 
-
722  bool controlState(codec_mode_t mode) {
-
723  return es8311_codec_ctrl_state_active(mode, true) == RESULT_OK;
-
724  }
-
725  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
726  return es8311_codec_config_i2s(mode, &iface) == RESULT_OK;
-
727  }
-
728 };
-
729 
-
735 class AudioDriverES8374Class : public AudioDriver {
-
736  public:
-
737  AudioDriverES8374Class(int i2cAddr = 0) { i2c_address = i2cAddr; }
-
738  bool setMute(bool mute) { return es8374_set_voice_mute(mute) == RESULT_OK; }
-
739  bool setVolume(int volume) {
-
740  AD_LOGD("volume %d", volume);
-
741  return es8374_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
742  }
-
743  int getVolume() {
-
744  int vol;
-
745  es8374_codec_get_voice_volume(&vol);
-
746  return vol;
-
747  }
-
748 
-
749  protected:
-
750  int i2c_address;
-
751 
-
752  bool init(codec_config_t codec_cfg) {
-
753  auto codec_mode = this->codec_cfg.get_mode();
-
754  if (i2c_address <= 0) {
-
755  i2c_address = getI2CAddress();
-
756  }
-
757  return es8374_codec_init(&codec_cfg, codec_mode, getI2C(), i2c_address) ==
-
758  RESULT_OK;
-
759  }
-
760  bool deinit() { return es8374_codec_deinit() == RESULT_OK; }
-
761 
-
762  bool controlState(codec_mode_t mode) {
-
763  return es8374_codec_ctrl_state_active(mode, true) == RESULT_OK;
-
764  }
-
765  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
766  return es8374_codec_config_i2s(mode, &iface) == RESULT_OK;
-
767  }
-
768 };
-
769 
-
775 class AudioDriverES8388Class : public AudioDriver {
-
776  public:
-
777  bool setMute(bool mute) {
-
778  line_active[0] = !mute;
-
779  line_active[1] = !mute;
-
780  return es8388_set_voice_mute(mute) == RESULT_OK;
-
781  }
-
782  // mute individual line: lines start at 0 (valid range 0:1)
-
783  bool setMute(bool mute, int line) {
-
784  if (line > 1) {
-
785  AD_LOGD("invalid line %d", line);
-
786  return false;
-
787  }
-
788  line_active[line] = !mute;
-
789  // mute is managed on line level, so deactivate global mute
-
790  setMute(false);
-
791  if (line_active[0] && line_active[1]) {
-
792  return es8388_config_output_device(DAC_OUTPUT_ALL) == RESULT_OK;
-
793  } else if (!line_active[0] && !line_active[1]) {
-
794  return es8388_config_output_device(DAC_OUTPUT_NONE) == RESULT_OK;
-
795  } else if (line_active[0]) {
-
796  return es8388_config_output_device(DAC_OUTPUT_LINE1) == RESULT_OK;
-
797  } else if (line_active[1]) {
-
798  return es8388_config_output_device(DAC_OUTPUT_LINE2) == RESULT_OK;
-
799  }
-
800  return false;
-
801  }
-
802  bool setVolume(int volume) {
-
803  AD_LOGD("volume %d", volume);
-
804  return es8388_set_voice_volume(limitValue(volume)) == RESULT_OK;
-
805  }
-
806  int getVolume() {
-
807  int vol;
-
808  es8388_get_voice_volume(&vol);
-
809  return vol;
-
810  }
-
811 
-
812  bool setInputVolume(int volume) {
-
813  // map values from 0 - 100 to 0 to 10
-
814  es_mic_gain_t gain = (es_mic_gain_t)(limitValue(volume) / 10);
-
815  AD_LOGD("input volume: %d -> gain %d", volume, gain);
-
816  return setMicrophoneGain(gain);
-
817  }
-
818 
-
819  bool setMicrophoneGain(es_mic_gain_t gain) {
-
820  return es8388_set_mic_gain(gain) == RESULT_OK;
-
821  }
-
822 
-
823  bool isInputVolumeSupported() { return true; }
+
681  protected:
+
682  bool init(codec_config_t codec_cfg) {
+
683  return es8156_codec_init(&codec_cfg, getI2C()) == RESULT_OK;
+
684  }
+
685  bool deinit() { return es8156_codec_deinit() == RESULT_OK; }
+
686 
+
687  bool controlState(codec_mode_t mode) {
+
688  return es8156_codec_ctrl_state_active(mode, true) == RESULT_OK;
+
689  }
+
690  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
691  return es8156_codec_config_i2s(mode, &iface) == RESULT_OK;
+
692  }
+
693 };
+
694 
+
700 class AudioDriverES8311Class : public AudioDriver {
+
701  public:
+
702  AudioDriverES8311Class(int i2cAddr = 0) { i2c_address = i2cAddr; }
+
703  bool setMute(bool mute) { return es8311_set_voice_mute(mute) == RESULT_OK; }
+
704  bool setVolume(int volume) {
+
705  return es8311_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
706  }
+
707  int getVolume() {
+
708  int vol;
+
709  es8311_codec_get_voice_volume(&vol);
+
710  return vol;
+
711  }
+
712 
+
713  protected:
+
714  int i2c_address;
+
715 
+
716  bool init(codec_config_t codec_cfg) {
+
717  int mclk_src = pins().getPinID(PinFunction::MCLK_SOURCE);
+
718  if (mclk_src == -1) return false;
+
719 
+
720  // determine address from data
+
721  if (i2c_address <= 0) i2c_address = getI2CAddress();
+
722 
+
723  return es8311_codec_init(&codec_cfg, getI2C(), mclk_src, i2c_address) ==
+
724  RESULT_OK;
+
725  }
+
726  bool deinit() { return es8311_codec_deinit() == RESULT_OK; }
+
727 
+
728  bool controlState(codec_mode_t mode) {
+
729  return es8311_codec_ctrl_state_active(mode, true) == RESULT_OK;
+
730  }
+
731  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
732  return es8311_codec_config_i2s(mode, &iface) == RESULT_OK;
+
733  }
+
734 };
+
735 
+
741 class AudioDriverES8374Class : public AudioDriver {
+
742  public:
+
743  AudioDriverES8374Class(int i2cAddr = 0) { i2c_address = i2cAddr; }
+
744  bool setMute(bool mute) { return es8374_set_voice_mute(mute) == RESULT_OK; }
+
745  bool setVolume(int volume) {
+
746  AD_LOGD("volume %d", volume);
+
747  return es8374_codec_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
748  }
+
749  int getVolume() {
+
750  int vol;
+
751  es8374_codec_get_voice_volume(&vol);
+
752  return vol;
+
753  }
+
754 
+
755  protected:
+
756  int i2c_address;
+
757 
+
758  bool init(codec_config_t codec_cfg) {
+
759  auto codec_mode = this->codec_cfg.get_mode();
+
760  if (i2c_address <= 0) {
+
761  i2c_address = getI2CAddress();
+
762  }
+
763  return es8374_codec_init(&codec_cfg, codec_mode, getI2C(), i2c_address) ==
+
764  RESULT_OK;
+
765  }
+
766  bool deinit() { return es8374_codec_deinit() == RESULT_OK; }
+
767 
+
768  bool controlState(codec_mode_t mode) {
+
769  return es8374_codec_ctrl_state_active(mode, true) == RESULT_OK;
+
770  }
+
771  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
772  return es8374_codec_config_i2s(mode, &iface) == RESULT_OK;
+
773  }
+
774 };
+
775 
+
781 class AudioDriverES8388Class : public AudioDriver {
+
782  public:
+
783  bool setMute(bool mute) {
+
784  line_active[0] = !mute;
+
785  line_active[1] = !mute;
+
786  return es8388_set_voice_mute(mute) == RESULT_OK;
+
787  }
+
788  // mute individual line: lines start at 0 (valid range 0:1)
+
789  bool setMute(bool mute, int line) {
+
790  if (line > 1) {
+
791  AD_LOGD("invalid line %d", line);
+
792  return false;
+
793  }
+
794  line_active[line] = !mute;
+
795  // mute is managed on line level, so deactivate global mute
+
796  setMute(false);
+
797  if (line_active[0] && line_active[1]) {
+
798  return es8388_config_output_device(DAC_OUTPUT_ALL) == RESULT_OK;
+
799  } else if (!line_active[0] && !line_active[1]) {
+
800  return es8388_config_output_device(DAC_OUTPUT_NONE) == RESULT_OK;
+
801  } else if (line_active[0]) {
+
802  return es8388_config_output_device(DAC_OUTPUT_LINE1) == RESULT_OK;
+
803  } else if (line_active[1]) {
+
804  return es8388_config_output_device(DAC_OUTPUT_LINE2) == RESULT_OK;
+
805  }
+
806  return false;
+
807  }
+
808  bool setVolume(int volume) {
+
809  AD_LOGD("volume %d", volume);
+
810  return es8388_set_voice_volume(limitValue(volume)) == RESULT_OK;
+
811  }
+
812  int getVolume() {
+
813  int vol;
+
814  es8388_get_voice_volume(&vol);
+
815  return vol;
+
816  }
+
817 
+
818  bool setInputVolume(int volume) {
+
819  // map values from 0 - 100 to 0 to 10
+
820  es_mic_gain_t gain = (es_mic_gain_t)(limitValue(volume) / 10);
+
821  AD_LOGD("input volume: %d -> gain %d", volume, gain);
+
822  return setMicrophoneGain(gain);
+
823  }
824 
-
825  protected:
-
826  bool line_active[2] = {true};
-
827 
-
828  bool init(codec_config_t codec_cfg) {
-
829  return es8388_init(&codec_cfg, getI2C()) == RESULT_OK;
-
830  }
-
831  bool deinit() { return es8388_deinit() == RESULT_OK; }
-
832 
-
833  bool controlState(codec_mode_t mode) {
-
834  return es8388_ctrl_state_active(mode, true) == RESULT_OK;
-
835  }
-
836  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
-
837  return es8388_config_i2s(mode, &iface) == RESULT_OK;
-
838  }
-
839 };
-
840 
-
846 class AudioDriverTAS5805MClass : public AudioDriver {
-
847  public:
-
848  bool setMute(bool mute) { return tas5805m_set_mute(mute) == RESULT_OK; }
-
849  bool setVolume(int volume) {
-
850  AD_LOGD("volume %d", volume);
-
851  return tas5805m_set_volume(limitValue(volume)) == RESULT_OK;
-
852  }
-
853  int getVolume() {
-
854  int vol;
-
855  tas5805m_get_volume(&vol);
-
856  return vol;
-
857  }
-
858 
-
859  protected:
-
860  bool init(codec_config_t codec_cfg) {
-
861  return tas5805m_init(&codec_cfg, getI2C()) == RESULT_OK;
-
862  }
-
863  bool deinit() { return tas5805m_deinit() == RESULT_OK; }
-
864 };
-
865 
-
871 class AudioDriverWM8960Class : public AudioDriver {
-
872  public:
-
873  bool begin(CodecConfig codecCfg, DriverPins &pins) {
-
874  codec_cfg = codecCfg;
-
875 
-
876  // define wire object
-
877  mtb_wm8960_set_wire(getI2C());
-
878  mtb_wm8960_set_write_retry_count(i2c_retry_count);
-
879 
-
880  // setup wm8960
-
881  int features = getFeatures(codecCfg);
-
882  if (!mtb_wm8960_init(features)) {
-
883  AD_LOGE("mtb_wm8960_init");
-
884  return false;
-
885  }
-
886  setVolume(DRIVER_DEFAULT_VOLUME);
-
887  if (!mtb_wm8960_activate()) {
-
888  AD_LOGE("mtb_wm8960_activate");
-
889  return false;
-
890  }
-
891  if (!configure_clocking()) {
-
892  AD_LOGE("configure_clocking");
-
893  return false;
-
894  }
-
895  return true;
-
896  }
-
897  bool end(void) {
-
898  mtb_wm8960_deactivate();
-
899  mtb_wm8960_free();
-
900  return true;
-
901  }
-
902  virtual bool setConfig(CodecConfig codecCfg) {
-
903  codec_cfg = codecCfg;
-
904  return configure_clocking();
-
905  }
-
906 
-
907  bool setMute(bool enable) { return setVolume(enable ? 0 : volume_out); }
-
908 
-
910  bool setVolume(int volume) {
-
911  volume_out = limitValue(volume, 0, 100);
-
912  int vol_int = volume_out == 0.0 ? 0 : map(volume_out, 0, 100, 30, 0x7F);
-
913  return mtb_wm8960_set_output_volume(vol_int);
-
914  }
-
915 
-
916  int getVolume() { return volume_out; }
-
917 
-
918  bool setInputVolume(int volume) {
-
919  volume_in = limitValue(volume, 0, 100);
-
920  int vol_int = map(volume_in, 0, 100, 0, 30);
-
921  return mtb_wm8960_adjust_input_volume(vol_int);
-
922  }
-
923  bool isVolumeSupported() { return true; }
-
924 
-
925  bool isInputVolumeSupported() { return true; }
-
926 
-
928  void setI2CRetryCount(int cnt) { i2c_retry_count = cnt; }
-
929 
-
931  void setEnablePLL(bool active) { vs1053_enable_pll = active; }
+
825  bool setMicrophoneGain(es_mic_gain_t gain) {
+
826  return es8388_set_mic_gain(gain) == RESULT_OK;
+
827  }
+
828 
+
829  bool isInputVolumeSupported() { return true; }
+
830 
+
831  protected:
+
832  bool line_active[2] = {true};
+
833 
+
834  bool init(codec_config_t codec_cfg) {
+
835  return es8388_init(&codec_cfg, getI2C()) == RESULT_OK;
+
836  }
+
837  bool deinit() { return es8388_deinit() == RESULT_OK; }
+
838 
+
839  bool controlState(codec_mode_t mode) {
+
840  return es8388_ctrl_state_active(mode, true) == RESULT_OK;
+
841  }
+
842  bool configInterface(codec_mode_t mode, I2SDefinition iface) {
+
843  return es8388_config_i2s(mode, &iface) == RESULT_OK;
+
844  }
+
845 };
+
846 
+
852 class AudioDriverTAS5805MClass : public AudioDriver {
+
853  public:
+
854  bool setMute(bool mute) { return tas5805m_set_mute(mute) == RESULT_OK; }
+
855  bool setVolume(int volume) {
+
856  AD_LOGD("volume %d", volume);
+
857  return tas5805m_set_volume(limitValue(volume)) == RESULT_OK;
+
858  }
+
859  int getVolume() {
+
860  int vol;
+
861  tas5805m_get_volume(&vol);
+
862  return vol;
+
863  }
+
864 
+
865  protected:
+
866  bool init(codec_config_t codec_cfg) {
+
867  return tas5805m_init(&codec_cfg, getI2C()) == RESULT_OK;
+
868  }
+
869  bool deinit() { return tas5805m_deinit() == RESULT_OK; }
+
870 };
+
871 
+
877 class AudioDriverWM8960Class : public AudioDriver {
+
878  public:
+
879  bool begin(CodecConfig codecCfg, DriverPins &pins) {
+
880  codec_cfg = codecCfg;
+
881 
+
882  // define wire object
+
883  mtb_wm8960_set_wire(getI2C());
+
884  mtb_wm8960_set_write_retry_count(i2c_retry_count);
+
885 
+
886  // setup wm8960
+
887  int features = getFeatures(codecCfg);
+
888  if (!mtb_wm8960_init(features)) {
+
889  AD_LOGE("mtb_wm8960_init");
+
890  return false;
+
891  }
+
892  setVolume(DRIVER_DEFAULT_VOLUME);
+
893  if (!mtb_wm8960_activate()) {
+
894  AD_LOGE("mtb_wm8960_activate");
+
895  return false;
+
896  }
+
897  if (!configure_clocking()) {
+
898  AD_LOGE("configure_clocking");
+
899  return false;
+
900  }
+
901  return true;
+
902  }
+
903  bool end(void) {
+
904  mtb_wm8960_deactivate();
+
905  mtb_wm8960_free();
+
906  return true;
+
907  }
+
908  virtual bool setConfig(CodecConfig codecCfg) {
+
909  codec_cfg = codecCfg;
+
910  return configure_clocking();
+
911  }
+
912 
+
913  bool setMute(bool enable) { return setVolume(enable ? 0 : volume_out); }
+
914 
+
916  bool setVolume(int volume) {
+
917  volume_out = limitValue(volume, 0, 100);
+
918  int vol_int = volume_out == 0.0 ? 0 : map(volume_out, 0, 100, 30, 0x7F);
+
919  return mtb_wm8960_set_output_volume(vol_int);
+
920  }
+
921 
+
922  int getVolume() { return volume_out; }
+
923 
+
924  bool setInputVolume(int volume) {
+
925  volume_in = limitValue(volume, 0, 100);
+
926  int vol_int = map(volume_in, 0, 100, 0, 30);
+
927  return mtb_wm8960_adjust_input_volume(vol_int);
+
928  }
+
929  bool isVolumeSupported() { return true; }
+
930 
+
931  bool isInputVolumeSupported() { return true; }
932 
-
934  void setMclkHz(uint32_t hz) { vs1053_mclk_hz = hz; }
+
934  void setI2CRetryCount(int cnt) { i2c_retry_count = cnt; }
935 
-
936  void dumpRegisters() { mtb_wm8960_dump(); }
-
937 
-
938  protected:
-
939  int volume_in = 100;
-
940  int volume_out = 100;
-
941  int i2c_retry_count = 0;
-
942  uint32_t vs1053_mclk_hz = 0;
-
943  bool vs1053_enable_pll = true;
-
944 
-
945  int getFeatures(CodecConfig cfg) {
-
946  int features = 0;
-
947  switch (cfg.output_device) {
-
948  case DAC_OUTPUT_LINE1:
-
949  features = features | WM8960_FEATURE_SPEAKER;
-
950  break;
-
951  case DAC_OUTPUT_LINE2:
-
952  features = features | WM8960_FEATURE_HEADPHONE;
-
953  break;
-
954  case DAC_OUTPUT_ALL:
-
955  features = features | WM8960_FEATURE_SPEAKER | WM8960_FEATURE_HEADPHONE;
+
937  void setEnablePLL(bool active) { vs1053_enable_pll = active; }
+
938 
+
940  void setMclkHz(uint32_t hz) { vs1053_mclk_hz = hz; }
+
941 
+
942  void dumpRegisters() { mtb_wm8960_dump(); }
+
943 
+
944  protected:
+
945  int volume_in = 100;
+
946  int volume_out = 100;
+
947  int i2c_retry_count = 0;
+
948  uint32_t vs1053_mclk_hz = 0;
+
949  bool vs1053_enable_pll = true;
+
950 
+
951  int getFeatures(CodecConfig cfg) {
+
952  int features = 0;
+
953  switch (cfg.output_device) {
+
954  case DAC_OUTPUT_LINE1:
+
955  features = features | WM8960_FEATURE_SPEAKER;
956  break;
-
957  default:
-
958  break;
-
959  }
-
960  switch (cfg.input_device) {
-
961  case ADC_INPUT_LINE1:
-
962  features = features | WM8960_FEATURE_MICROPHONE1;
-
963  break;
-
964  case ADC_INPUT_LINE2:
-
965  features = features | WM8960_FEATURE_MICROPHONE2;
-
966  break;
-
967  case ADC_INPUT_ALL:
-
968  features = features | WM8960_FEATURE_MICROPHONE1 |
-
969  WM8960_FEATURE_MICROPHONE2 | WM8960_FEATURE_MICROPHONE3;
-
970  break;
-
971  default:
+
957  case DAC_OUTPUT_LINE2:
+
958  features = features | WM8960_FEATURE_HEADPHONE;
+
959  break;
+
960  case DAC_OUTPUT_ALL:
+
961  features = features | WM8960_FEATURE_SPEAKER | WM8960_FEATURE_HEADPHONE;
+
962  break;
+
963  default:
+
964  break;
+
965  }
+
966  switch (cfg.input_device) {
+
967  case ADC_INPUT_LINE1:
+
968  features = features | WM8960_FEATURE_MICROPHONE1;
+
969  break;
+
970  case ADC_INPUT_LINE2:
+
971  features = features | WM8960_FEATURE_MICROPHONE2;
972  break;
-
973  }
-
974  AD_LOGI("features: %d", features);
-
975  return features;
-
976  }
-
977 
-
978  bool configure_clocking() {
-
979  if (vs1053_mclk_hz == 0) {
-
980  // just pick a multiple of the sample rate
-
981  vs1053_mclk_hz = 512 * codec_cfg.getRateNumeric();
-
982  }
-
983  if (!mtb_wm8960_configure_clocking(
-
984  vs1053_mclk_hz, vs1053_enable_pll,
-
985  sampleRate(codec_cfg.getRateNumeric()),
-
986  wordLength(codec_cfg.getBitsNumeric()),
-
987  modeMasterSlave(codec_cfg.i2s.mode == MODE_MASTER))) {
-
988  AD_LOGE("mtb_wm8960_configure_clocking");
-
989  return false;
-
990  }
-
991  return true;
-
992  }
-
993 
-
994  mtb_wm8960_adc_dac_sample_rate_t sampleRate(int rate) {
-
995  switch (rate) {
-
996  case 48000:
-
997  return WM8960_ADC_DAC_SAMPLE_RATE_48_KHZ;
-
998  case 44100:
-
999  return WM8960_ADC_DAC_SAMPLE_RATE_44_1_KHZ;
-
1000  case 32000:
-
1001  return WM8960_ADC_DAC_SAMPLE_RATE_32_KHZ;
-
1002  case 24000:
-
1003  return WM8960_ADC_DAC_SAMPLE_RATE_24_KHZ;
-
1004  case 22050:
-
1005  return WM8960_ADC_DAC_SAMPLE_RATE_22_05_KHZ;
-
1006  case 16000:
-
1007  return WM8960_ADC_DAC_SAMPLE_RATE_16_KHZ;
-
1008  case 12000:
-
1009  return WM8960_ADC_DAC_SAMPLE_RATE_12_KHZ;
-
1010  case 11025:
-
1011  return WM8960_ADC_DAC_SAMPLE_RATE_11_025_KHZ;
-
1012  case 8018:
-
1013  return WM8960_ADC_DAC_SAMPLE_RATE_8_018_KHZ;
-
1014  case 8000:
-
1015  return WM8960_ADC_DAC_SAMPLE_RATE_8_KHZ;
-
1016  default:
-
1017  AD_LOGE("Unsupported rate: %d", rate);
-
1018  return WM8960_ADC_DAC_SAMPLE_RATE_44_1_KHZ;
-
1019  }
-
1020  }
-
1021 
-
1022  mtb_wm8960_word_length_t wordLength(int bits) {
-
1023  switch (bits) {
-
1024  case 16:
-
1025  return WM8960_WL_16BITS;
-
1026  case 20:
-
1027  return WM8960_WL_20BITS;
-
1028  case 24:
-
1029  return WM8960_WL_24BITS;
-
1030  case 32:
-
1031  return WM8960_WL_32BITS;
-
1032  default:
-
1033  AD_LOGE("Unsupported bits: %d", bits);
-
1034  return WM8960_WL_16BITS;
-
1035  }
-
1036  }
-
1037 
-
1039  mtb_wm8960_mode_t modeMasterSlave(bool is_master) {
-
1040  return is_master ? WM8960_MODE_MASTER : WM8960_MODE_SLAVE;
-
1041  }
-
1042 };
+
973  case ADC_INPUT_ALL:
+
974  features = features | WM8960_FEATURE_MICROPHONE1 |
+
975  WM8960_FEATURE_MICROPHONE2 | WM8960_FEATURE_MICROPHONE3;
+
976  break;
+
977  default:
+
978  break;
+
979  }
+
980  AD_LOGI("features: %d", features);
+
981  return features;
+
982  }
+
983 
+
984  bool configure_clocking() {
+
985  if (vs1053_mclk_hz == 0) {
+
986  // just pick a multiple of the sample rate
+
987  vs1053_mclk_hz = 512 * codec_cfg.getRateNumeric();
+
988  }
+
989  if (!mtb_wm8960_configure_clocking(
+
990  vs1053_mclk_hz, vs1053_enable_pll,
+
991  sampleRate(codec_cfg.getRateNumeric()),
+
992  wordLength(codec_cfg.getBitsNumeric()),
+
993  modeMasterSlave(codec_cfg.i2s.mode == MODE_MASTER))) {
+
994  AD_LOGE("mtb_wm8960_configure_clocking");
+
995  return false;
+
996  }
+
997  return true;
+
998  }
+
999 
+
1000  mtb_wm8960_adc_dac_sample_rate_t sampleRate(int rate) {
+
1001  switch (rate) {
+
1002  case 48000:
+
1003  return WM8960_ADC_DAC_SAMPLE_RATE_48_KHZ;
+
1004  case 44100:
+
1005  return WM8960_ADC_DAC_SAMPLE_RATE_44_1_KHZ;
+
1006  case 32000:
+
1007  return WM8960_ADC_DAC_SAMPLE_RATE_32_KHZ;
+
1008  case 24000:
+
1009  return WM8960_ADC_DAC_SAMPLE_RATE_24_KHZ;
+
1010  case 22050:
+
1011  return WM8960_ADC_DAC_SAMPLE_RATE_22_05_KHZ;
+
1012  case 16000:
+
1013  return WM8960_ADC_DAC_SAMPLE_RATE_16_KHZ;
+
1014  case 12000:
+
1015  return WM8960_ADC_DAC_SAMPLE_RATE_12_KHZ;
+
1016  case 11025:
+
1017  return WM8960_ADC_DAC_SAMPLE_RATE_11_025_KHZ;
+
1018  case 8018:
+
1019  return WM8960_ADC_DAC_SAMPLE_RATE_8_018_KHZ;
+
1020  case 8000:
+
1021  return WM8960_ADC_DAC_SAMPLE_RATE_8_KHZ;
+
1022  default:
+
1023  AD_LOGE("Unsupported rate: %d", rate);
+
1024  return WM8960_ADC_DAC_SAMPLE_RATE_44_1_KHZ;
+
1025  }
+
1026  }
+
1027 
+
1028  mtb_wm8960_word_length_t wordLength(int bits) {
+
1029  switch (bits) {
+
1030  case 16:
+
1031  return WM8960_WL_16BITS;
+
1032  case 20:
+
1033  return WM8960_WL_20BITS;
+
1034  case 24:
+
1035  return WM8960_WL_24BITS;
+
1036  case 32:
+
1037  return WM8960_WL_32BITS;
+
1038  default:
+
1039  AD_LOGE("Unsupported bits: %d", bits);
+
1040  return WM8960_WL_16BITS;
+
1041  }
+
1042  }
1043 
-
1049 class AudioDriverWM8994Class : public AudioDriver {
-
1050  public:
-
1051  AudioDriverWM8994Class(uint16_t deviceAddr = 0x1A) {
-
1052  this->deviceAddr = deviceAddr;
-
1053  }
-
1054 
-
1055  void setI2CAddress(uint16_t adr) { deviceAddr = adr; }
-
1056 
-
1057  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
-
1058  codec_cfg = codecCfg;
-
1059  // manage reset pin -> active high
-
1060  setPAPower(true);
-
1061  delay(10);
-
1062  p_pins = &pins;
-
1063  int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
-
1064  uint32_t freq = codecCfg.getRateNumeric();
-
1065  uint16_t outputDevice = getOutput(codec_cfg.output_device);
-
1066 
-
1067  return wm8994_Init(deviceAddr, outputDevice, vol, freq, getI2C()) == 0;
-
1068  }
-
1069 
-
1070  bool setMute(bool mute) {
-
1071  uint32_t rc = mute ? wm8994_Pause(deviceAddr) : wm8994_Resume(deviceAddr);
-
1072  return rc == 0;
-
1073  }
-
1074 
-
1075  bool setVolume(int volume) {
-
1076  this->volume = volume;
-
1077  int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
-
1078  return wm8994_SetVolume(deviceAddr, vol) == 0;
+
1045  mtb_wm8960_mode_t modeMasterSlave(bool is_master) {
+
1046  return is_master ? WM8960_MODE_MASTER : WM8960_MODE_SLAVE;
+
1047  }
+
1048 };
+
1049 
+
1055 class AudioDriverWM8994Class : public AudioDriver {
+
1056  public:
+
1057  AudioDriverWM8994Class(uint16_t deviceAddr = 0x1A) {
+
1058  this->deviceAddr = deviceAddr;
+
1059  }
+
1060 
+
1061  void setI2CAddress(uint16_t adr) { deviceAddr = adr; }
+
1062 
+
1063  virtual bool begin(CodecConfig codecCfg, DriverPins &pins) {
+
1064  codec_cfg = codecCfg;
+
1065  // manage reset pin -> active high
+
1066  setPAPower(true);
+
1067  delay(10);
+
1068  p_pins = &pins;
+
1069  int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
+
1070  uint32_t freq = codecCfg.getRateNumeric();
+
1071  uint16_t outputDevice = getOutput(codec_cfg.output_device);
+
1072 
+
1073  return wm8994_Init(deviceAddr, outputDevice, vol, freq, getI2C()) == 0;
+
1074  }
+
1075 
+
1076  bool setMute(bool mute) {
+
1077  uint32_t rc = mute ? wm8994_Pause(deviceAddr) : wm8994_Resume(deviceAddr);
+
1078  return rc == 0;
1079  }
-
1080  int getVolume() { return volume; }
-
1081 
-
1082  protected:
-
1083  uint16_t deviceAddr;
-
1084  int volume = 100;
-
1085 
-
1086  bool deinit() {
-
1087  int cnt = wm8994_Stop(deviceAddr, AUDIO_MUTE_ON);
-
1088  cnt += wm8994_Reset(deviceAddr);
-
1089  setPAPower(false);
-
1090  return cnt == 0;
-
1091  }
-
1092 
-
1093  uint16_t getOutput(output_device_t output_device) {
-
1094  switch (output_device) {
-
1095  case DAC_OUTPUT_NONE:
-
1096  return 0;
-
1097  case DAC_OUTPUT_LINE1:
-
1098  return OUTPUT_DEVICE_SPEAKER;
-
1099  case DAC_OUTPUT_LINE2:
-
1100  return OUTPUT_DEVICE_HEADPHONE;
-
1101  case DAC_OUTPUT_ALL:
-
1102  return OUTPUT_DEVICE_BOTH;
-
1103  }
-
1104  return OUTPUT_DEVICE_BOTH;
-
1105  }
-
1106 };
-
1107 
-
1113 class AudioDriverLyratMiniClass : public AudioDriver {
-
1114  public:
-
1115  bool begin(CodecConfig codecCfg, DriverPins &pins) {
-
1116  int rc = 0;
-
1117  if (codecCfg.output_device != DAC_OUTPUT_NONE)
-
1118  rc += !dac.begin(codecCfg, pins);
-
1119  if (codecCfg.input_device != ADC_INPUT_NONE)
-
1120  rc += !adc.begin(codecCfg, pins);
-
1121  return rc == 0;
-
1122  }
-
1123  bool end(void) {
-
1124  int rc = 0;
-
1125  rc += dac.end();
-
1126  rc += adc.end();
+
1080 
+
1081  bool setVolume(int volume) {
+
1082  this->volume = volume;
+
1083  int vol = map(volume, 0, 100, DEFAULT_VOLMIN, DEFAULT_VOLMAX);
+
1084  return wm8994_SetVolume(deviceAddr, vol) == 0;
+
1085  }
+
1086  int getVolume() { return volume; }
+
1087 
+
1088  protected:
+
1089  uint16_t deviceAddr;
+
1090  int volume = 100;
+
1091 
+
1092  bool deinit() {
+
1093  int cnt = wm8994_Stop(deviceAddr, AUDIO_MUTE_ON);
+
1094  cnt += wm8994_Reset(deviceAddr);
+
1095  setPAPower(false);
+
1096  return cnt == 0;
+
1097  }
+
1098 
+
1099  uint16_t getOutput(output_device_t output_device) {
+
1100  switch (output_device) {
+
1101  case DAC_OUTPUT_NONE:
+
1102  return 0;
+
1103  case DAC_OUTPUT_LINE1:
+
1104  return OUTPUT_DEVICE_SPEAKER;
+
1105  case DAC_OUTPUT_LINE2:
+
1106  return OUTPUT_DEVICE_HEADPHONE;
+
1107  case DAC_OUTPUT_ALL:
+
1108  return OUTPUT_DEVICE_BOTH;
+
1109  }
+
1110  return OUTPUT_DEVICE_BOTH;
+
1111  }
+
1112 };
+
1113 
+
1119 class AudioDriverLyratMiniClass : public AudioDriver {
+
1120  public:
+
1121  bool begin(CodecConfig codecCfg, DriverPins &pins) {
+
1122  int rc = 0;
+
1123  if (codecCfg.output_device != DAC_OUTPUT_NONE)
+
1124  rc += !dac.begin(codecCfg, pins);
+
1125  if (codecCfg.input_device != ADC_INPUT_NONE)
+
1126  rc += !adc.begin(codecCfg, pins);
1127  return rc == 0;
1128  }
-
1129  bool setMute(bool enable) { return dac.setMute(enable); }
-
1130  bool setVolume(int volume) { return dac.setVolume(volume); }
-
1131  int getVolume() { return dac.getVolume(); }
-
1132  bool setInputVolume(int volume) { return adc.setVolume(volume); }
-
1133  int getInputVolume() { return adc.getVolume(); }
-
1134  bool isInputVolumeSupported() { return true; }
-
1135 
-
1136  protected:
-
1137  AudioDriverES8311Class dac;
-
1138  AudioDriverES7243Class adc;
-
1139 };
-
1140 
-
1141 // -- Drivers
-
1143 static AudioDriverAC101Class AudioDriverAC101;
-
1145 static AudioDriverCS43l22Class AudioDriverCS43l22;
-
1147 static AudioDriverES7210Class AudioDriverES7210;
-
1149 static AudioDriverES7243Class AudioDriverES7243;
-
1151 static AudioDriverES7243eClass AudioDriverES7243e;
-
1153 static AudioDriverES8156Class AudioDriverES8156;
-
1155 static AudioDriverES8311Class AudioDriverES8311;
-
1157 static AudioDriverES8374Class AudioDriverES8374;
-
1159 static AudioDriverES8388Class AudioDriverES8388;
-
1161 static AudioDriverWM8960Class AudioDriverWM8960;
-
1163 static AudioDriverWM8994Class AudioDriverWM8994;
-
1165 static AudioDriverLyratMiniClass AudioDriverLyratMini;
-
1167 static NoDriverClass NoDriver;
-
1169 static AudioDriverAD1938Class AudioDriverAD1938;
-
1171 static AudioDriverCS42448Class AudioDriverCS42448;
-
1172 
-
1173 } // namespace audio_driver
+
1129  bool end(void) {
+
1130  int rc = 0;
+
1131  rc += dac.end();
+
1132  rc += adc.end();
+
1133  return rc == 0;
+
1134  }
+
1135  bool setMute(bool enable) { return dac.setMute(enable); }
+
1136  bool setVolume(int volume) { return dac.setVolume(volume); }
+
1137  int getVolume() { return dac.getVolume(); }
+
1138  bool setInputVolume(int volume) { return adc.setVolume(volume); }
+
1139  int getInputVolume() { return adc.getVolume(); }
+
1140  bool isInputVolumeSupported() { return true; }
+
1141 
+
1142  protected:
+
1143  AudioDriverES8311Class dac;
+
1144  AudioDriverES7243Class adc;
+
1145 };
+
1146 
+
1147 // -- Drivers
+
1149 static AudioDriverAC101Class AudioDriverAC101;
+
1151 static AudioDriverCS43l22Class AudioDriverCS43l22;
+
1153 static AudioDriverES7210Class AudioDriverES7210;
+
1155 static AudioDriverES7243Class AudioDriverES7243;
+
1157 static AudioDriverES7243eClass AudioDriverES7243e;
+
1159 static AudioDriverES8156Class AudioDriverES8156;
+
1161 static AudioDriverES8311Class AudioDriverES8311;
+
1163 static AudioDriverES8374Class AudioDriverES8374;
+
1165 static AudioDriverES8388Class AudioDriverES8388;
+
1167 static AudioDriverWM8960Class AudioDriverWM8960;
+
1169 static AudioDriverWM8994Class AudioDriverWM8994;
+
1171 static AudioDriverLyratMiniClass AudioDriverLyratMini;
+
1173 static NoDriverClass NoDriver;
+
1175 static AudioDriverAD1938Class AudioDriverAD1938;
+
1177 static AudioDriverCS42448Class AudioDriverCS42448;
+
1178 
+
1179 } // namespace audio_driver
Common.h
DRIVER_DEFAULT_VOLUME
#define DRIVER_DEFAULT_VOLUME
Definition: Common.h:20
RESULT_OK
#define RESULT_OK
Fixed Definitions.
Definition: Common.h:31
@@ -1154,203 +1159,204 @@
AD_LOGE
void AD_LOGE(const char *fmr,...)
Definition: Logger.c:46
AD_LOGD
void AD_LOGD(const char *fmr,...)
Definition: Logger.c:10
AD_LOGI
void AD_LOGI(const char *fmr,...)
Definition: Logger.c:22
-
audio_driver::AudioDriverAC101Class
Driver API for AC101 codec chip.
Definition: Driver.h:298
-
audio_driver::AudioDriverAC101Class::deinit
bool deinit()
Definition: Driver.h:314
-
audio_driver::AudioDriverAC101Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:311
-
audio_driver::AudioDriverAC101Class::setMute
bool setMute(bool mute)
Definition: Driver.h:300
-
audio_driver::AudioDriverAC101Class::getVolume
int getVolume()
Definition: Driver.h:304
-
audio_driver::AudioDriverAC101Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:301
-
audio_driver::AudioDriverAC101Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:318
-
audio_driver::AudioDriverAC101Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:315
-
audio_driver::AudioDriverAD1938Class
Driver API for AD1938 TDS DAC/ADC.
Definition: Driver.h:328
-
audio_driver::AudioDriverAD1938Class::getVolume
int getVolume() override
Definition: Driver.h:378
-
audio_driver::AudioDriverAD1938Class::isInputVolumeSupported
bool isInputVolumeSupported() override
Definition: Driver.h:381
-
audio_driver::AudioDriverAD1938Class::setMute
bool setMute(bool mute) override
Definition: Driver.h:356
-
audio_driver::AudioDriverAD1938Class::volumes
int volumes[8]
Definition: Driver.h:390
-
audio_driver::AudioDriverAD1938Class::pins
DriverPins & pins()
Definition: Driver.h:383
-
audio_driver::AudioDriverAD1938Class::isVolumeSupported
bool isVolumeSupported() override
Definition: Driver.h:380
-
audio_driver::AudioDriverAD1938Class::setMute
bool setMute(bool mute, int line)
Definition: Driver.h:358
-
audio_driver::AudioDriverAD1938Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:351
-
audio_driver::AudioDriverAD1938Class::driver
AD1938 & driver()
Definition: Driver.h:384
-
audio_driver::AudioDriverAD1938Class::end
bool end(void) override
Definition: Driver.h:355
-
audio_driver::AudioDriverAD1938Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins) override
Definition: Driver.h:330
-
audio_driver::AudioDriverAD1938Class::setVolume
bool setVolume(int volume, int line)
Defines the Volume per DAC (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:372
-
audio_driver::AudioDriverAD1938Class::setInputVolume
bool setInputVolume(int volume) override
Definition: Driver.h:379
-
audio_driver::AudioDriverAD1938Class::setVolume
bool setVolume(int volume) override
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:364
-
audio_driver::AudioDriverAD1938Class::p_pins
DriverPins * p_pins
Definition: Driver.h:388
-
audio_driver::AudioDriverAD1938Class::volume
int volume
Definition: Driver.h:389
-
audio_driver::AudioDriverAD1938Class::ad1938
AD1938 ad1938
Definition: Driver.h:387
-
audio_driver::AudioDriverCS42448Class
Driver API for CS42448 TDS DAC/ADC.
Definition: Driver.h:498
-
audio_driver::AudioDriverCS42448Class::getVolume
int getVolume() override
Definition: Driver.h:537
-
audio_driver::AudioDriverCS42448Class::driver
CS42448 & driver()
Definition: Driver.h:546
-
audio_driver::AudioDriverCS42448Class::isInputVolumeSupported
bool isInputVolumeSupported() override
Definition: Driver.h:543
-
audio_driver::AudioDriverCS42448Class::pins
DriverPins & pins()
Definition: Driver.h:545
-
audio_driver::AudioDriverCS42448Class::isVolumeSupported
bool isVolumeSupported() override
Definition: Driver.h:542
-
audio_driver::AudioDriverCS42448Class::cs42448
CS42448 cs42448
Definition: Driver.h:549
-
audio_driver::AudioDriverCS42448Class::setMute
bool setMute(bool enable) override
Definition: Driver.h:524
-
audio_driver::AudioDriverCS42448Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:509
-
audio_driver::AudioDriverCS42448Class::setVolume
bool setVolume(int dac, int volume)
Definition: Driver.h:533
-
audio_driver::AudioDriverCS42448Class::end
bool end(void) override
Definition: Driver.h:523
-
audio_driver::AudioDriverCS42448Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins) override
Definition: Driver.h:500
-
audio_driver::AudioDriverCS42448Class::setInputVolume
bool setInputVolume(int volume) override
Definition: Driver.h:538
-
audio_driver::AudioDriverCS42448Class::setVolume
bool setVolume(int volume) override
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:529
-
audio_driver::AudioDriverCS42448Class::cfg
CodecConfig cfg
Definition: Driver.h:552
-
audio_driver::AudioDriverCS42448Class::setMute
bool setMute(bool enable, int line)
Definition: Driver.h:525
-
audio_driver::AudioDriverCS42448Class::p_pins
DriverPins * p_pins
Definition: Driver.h:550
-
audio_driver::AudioDriverCS42448Class::volume
int volume
Definition: Driver.h:551
-
audio_driver::AudioDriverCS43l22Class
Driver API for the CS43l22 codec chip on 0x94 (0x4A<<1)
Definition: Driver.h:398
-
audio_driver::AudioDriverCS43l22Class::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:406
-
audio_driver::AudioDriverCS43l22Class::deviceAddr
uint16_t deviceAddr
Definition: Driver.h:446
-
audio_driver::AudioDriverCS43l22Class::deinit
bool deinit()
Definition: Driver.h:449
-
audio_driver::AudioDriverCS43l22Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:426
-
audio_driver::AudioDriverCS43l22Class::setMute
bool setMute(bool mute)
Definition: Driver.h:434
-
audio_driver::AudioDriverCS43l22Class::setI2CAddress
void setI2CAddress(uint16_t adr)
Definition: Driver.h:404
-
audio_driver::AudioDriverCS43l22Class::getVolume
int getVolume()
Definition: Driver.h:443
-
audio_driver::AudioDriverCS43l22Class::getFrequency
uint32_t getFrequency(samplerate_t rateNum)
Definition: Driver.h:456
-
audio_driver::AudioDriverCS43l22Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:439
-
audio_driver::AudioDriverCS43l22Class::volume
int volume
Definition: Driver.h:447
-
audio_driver::AudioDriverCS43l22Class::getOutput
uint16_t getOutput(output_device_t output_device)
Definition: Driver.h:478
-
audio_driver::AudioDriverCS43l22Class::AudioDriverCS43l22Class
AudioDriverCS43l22Class(uint16_t deviceAddr=0x4A)
Definition: Driver.h:400
-
audio_driver::AudioDriverES7210Class
Driver API for ES7210 codec chip.
Definition: Driver.h:560
-
audio_driver::AudioDriverES7210Class::deinit
bool deinit()
Definition: Driver.h:575
-
audio_driver::AudioDriverES7210Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:572
-
audio_driver::AudioDriverES7210Class::setMute
bool setMute(bool mute)
Definition: Driver.h:562
-
audio_driver::AudioDriverES7210Class::getVolume
int getVolume()
Definition: Driver.h:567
-
audio_driver::AudioDriverES7210Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:563
-
audio_driver::AudioDriverES7210Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:580
-
audio_driver::AudioDriverES7210Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:577
-
audio_driver::AudioDriverES7210Class::volume
int volume
Definition: Driver.h:570
-
audio_driver::AudioDriverES7243Class
Driver API for Lyrat ES7243 codec chip.
Definition: Driver.h:590
-
audio_driver::AudioDriverES7243Class::deinit
bool deinit()
Definition: Driver.h:608
-
audio_driver::AudioDriverES7243Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:605
-
audio_driver::AudioDriverES7243Class::setMute
bool setMute(bool mute)
Definition: Driver.h:592
-
audio_driver::AudioDriverES7243Class::getVolume
int getVolume()
Definition: Driver.h:598
-
audio_driver::AudioDriverES7243Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:595
-
audio_driver::AudioDriverES7243Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:613
-
audio_driver::AudioDriverES7243Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:610
-
audio_driver::AudioDriverES7243eClass
Driver API for ES7243e codec chip.
Definition: Driver.h:624
-
audio_driver::AudioDriverES7243eClass::deinit
bool deinit()
Definition: Driver.h:645
-
audio_driver::AudioDriverES7243eClass::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:642
-
audio_driver::AudioDriverES7243eClass::setMute
bool setMute(bool mute)
Definition: Driver.h:626
-
audio_driver::AudioDriverES7243eClass::getVolume
int getVolume()
Definition: Driver.h:633
-
audio_driver::AudioDriverES7243eClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:629
-
audio_driver::AudioDriverES7243eClass::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:650
-
audio_driver::AudioDriverES7243eClass::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:647
-
audio_driver::AudioDriverES7243eClass::volume
int volume
Definition: Driver.h:640
-
audio_driver::AudioDriverES8156Class
Driver API for ES8156 codec chip.
Definition: Driver.h:660
-
audio_driver::AudioDriverES8156Class::deinit
bool deinit()
Definition: Driver.h:679
-
audio_driver::AudioDriverES8156Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:676
-
audio_driver::AudioDriverES8156Class::setMute
bool setMute(bool mute)
Definition: Driver.h:662
-
audio_driver::AudioDriverES8156Class::getVolume
int getVolume()
Definition: Driver.h:669
-
audio_driver::AudioDriverES8156Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:665
-
audio_driver::AudioDriverES8156Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:684
-
audio_driver::AudioDriverES8156Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:681
-
audio_driver::AudioDriverES8311Class
Driver API for Lyrat ES8311 codec chip.
Definition: Driver.h:694
-
audio_driver::AudioDriverES8311Class::AudioDriverES8311Class
AudioDriverES8311Class(int i2cAddr=0)
Definition: Driver.h:696
-
audio_driver::AudioDriverES8311Class::deinit
bool deinit()
Definition: Driver.h:720
-
audio_driver::AudioDriverES8311Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:710
-
audio_driver::AudioDriverES8311Class::i2c_address
int i2c_address
Definition: Driver.h:708
-
audio_driver::AudioDriverES8311Class::setMute
bool setMute(bool mute)
Definition: Driver.h:697
-
audio_driver::AudioDriverES8311Class::getVolume
int getVolume()
Definition: Driver.h:701
-
audio_driver::AudioDriverES8311Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:698
-
audio_driver::AudioDriverES8311Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:725
-
audio_driver::AudioDriverES8311Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:722
-
audio_driver::AudioDriverES8374Class
Driver API for ES8374 codec chip.
Definition: Driver.h:735
-
audio_driver::AudioDriverES8374Class::deinit
bool deinit()
Definition: Driver.h:760
-
audio_driver::AudioDriverES8374Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:752
-
audio_driver::AudioDriverES8374Class::i2c_address
int i2c_address
Definition: Driver.h:750
-
audio_driver::AudioDriverES8374Class::setMute
bool setMute(bool mute)
Definition: Driver.h:738
-
audio_driver::AudioDriverES8374Class::AudioDriverES8374Class
AudioDriverES8374Class(int i2cAddr=0)
Definition: Driver.h:737
-
audio_driver::AudioDriverES8374Class::getVolume
int getVolume()
Definition: Driver.h:743
-
audio_driver::AudioDriverES8374Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:739
-
audio_driver::AudioDriverES8374Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:765
-
audio_driver::AudioDriverES8374Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:762
-
audio_driver::AudioDriverES8388Class
Driver API for ES8388 codec chip.
Definition: Driver.h:775
-
audio_driver::AudioDriverES8388Class::deinit
bool deinit()
Definition: Driver.h:831
-
audio_driver::AudioDriverES8388Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:828
-
audio_driver::AudioDriverES8388Class::setMute
bool setMute(bool mute, int line)
Definition: Driver.h:783
-
audio_driver::AudioDriverES8388Class::line_active
bool line_active[2]
Definition: Driver.h:826
-
audio_driver::AudioDriverES8388Class::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:823
-
audio_driver::AudioDriverES8388Class::setMute
bool setMute(bool mute)
Definition: Driver.h:777
-
audio_driver::AudioDriverES8388Class::getVolume
int getVolume()
Definition: Driver.h:806
-
audio_driver::AudioDriverES8388Class::setMicrophoneGain
bool setMicrophoneGain(es_mic_gain_t gain)
Definition: Driver.h:819
-
audio_driver::AudioDriverES8388Class::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:812
-
audio_driver::AudioDriverES8388Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:802
-
audio_driver::AudioDriverES8388Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:836
-
audio_driver::AudioDriverES8388Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:833
+
audio_driver::AudioDriverAC101Class
Driver API for AC101 codec chip.
Definition: Driver.h:304
+
audio_driver::AudioDriverAC101Class::deinit
bool deinit()
Definition: Driver.h:320
+
audio_driver::AudioDriverAC101Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:317
+
audio_driver::AudioDriverAC101Class::setMute
bool setMute(bool mute)
Definition: Driver.h:306
+
audio_driver::AudioDriverAC101Class::getVolume
int getVolume()
Definition: Driver.h:310
+
audio_driver::AudioDriverAC101Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:307
+
audio_driver::AudioDriverAC101Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:324
+
audio_driver::AudioDriverAC101Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:321
+
audio_driver::AudioDriverAD1938Class
Driver API for AD1938 TDS DAC/ADC.
Definition: Driver.h:334
+
audio_driver::AudioDriverAD1938Class::getVolume
int getVolume() override
Definition: Driver.h:384
+
audio_driver::AudioDriverAD1938Class::isInputVolumeSupported
bool isInputVolumeSupported() override
Definition: Driver.h:387
+
audio_driver::AudioDriverAD1938Class::setMute
bool setMute(bool mute) override
Definition: Driver.h:362
+
audio_driver::AudioDriverAD1938Class::volumes
int volumes[8]
Definition: Driver.h:396
+
audio_driver::AudioDriverAD1938Class::pins
DriverPins & pins()
Definition: Driver.h:389
+
audio_driver::AudioDriverAD1938Class::isVolumeSupported
bool isVolumeSupported() override
Definition: Driver.h:386
+
audio_driver::AudioDriverAD1938Class::setMute
bool setMute(bool mute, int line)
Mute individual lines: only supported for some rare DACs.
Definition: Driver.h:364
+
audio_driver::AudioDriverAD1938Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:357
+
audio_driver::AudioDriverAD1938Class::driver
AD1938 & driver()
Definition: Driver.h:390
+
audio_driver::AudioDriverAD1938Class::end
bool end(void) override
Definition: Driver.h:361
+
audio_driver::AudioDriverAD1938Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins) override
Definition: Driver.h:336
+
audio_driver::AudioDriverAD1938Class::setVolume
bool setVolume(int volume, int line)
Defines the Volume per DAC (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:378
+
audio_driver::AudioDriverAD1938Class::setInputVolume
bool setInputVolume(int volume) override
Definition: Driver.h:385
+
audio_driver::AudioDriverAD1938Class::setVolume
bool setVolume(int volume) override
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:370
+
audio_driver::AudioDriverAD1938Class::p_pins
DriverPins * p_pins
Definition: Driver.h:394
+
audio_driver::AudioDriverAD1938Class::volume
int volume
Definition: Driver.h:395
+
audio_driver::AudioDriverAD1938Class::ad1938
AD1938 ad1938
Definition: Driver.h:393
+
audio_driver::AudioDriverCS42448Class
Driver API for CS42448 TDS DAC/ADC.
Definition: Driver.h:504
+
audio_driver::AudioDriverCS42448Class::getVolume
int getVolume() override
Definition: Driver.h:543
+
audio_driver::AudioDriverCS42448Class::driver
CS42448 & driver()
Definition: Driver.h:552
+
audio_driver::AudioDriverCS42448Class::isInputVolumeSupported
bool isInputVolumeSupported() override
Definition: Driver.h:549
+
audio_driver::AudioDriverCS42448Class::pins
DriverPins & pins()
Definition: Driver.h:551
+
audio_driver::AudioDriverCS42448Class::isVolumeSupported
bool isVolumeSupported() override
Definition: Driver.h:548
+
audio_driver::AudioDriverCS42448Class::cs42448
CS42448 cs42448
Definition: Driver.h:555
+
audio_driver::AudioDriverCS42448Class::setMute
bool setMute(bool enable) override
Definition: Driver.h:530
+
audio_driver::AudioDriverCS42448Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:515
+
audio_driver::AudioDriverCS42448Class::setVolume
bool setVolume(int dac, int volume)
Definition: Driver.h:539
+
audio_driver::AudioDriverCS42448Class::end
bool end(void) override
Definition: Driver.h:529
+
audio_driver::AudioDriverCS42448Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins) override
Definition: Driver.h:506
+
audio_driver::AudioDriverCS42448Class::setInputVolume
bool setInputVolume(int volume) override
Definition: Driver.h:544
+
audio_driver::AudioDriverCS42448Class::setVolume
bool setVolume(int volume) override
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:535
+
audio_driver::AudioDriverCS42448Class::cfg
CodecConfig cfg
Definition: Driver.h:558
+
audio_driver::AudioDriverCS42448Class::setMute
bool setMute(bool enable, int line)
Mute individual lines: only supported for some rare DACs.
Definition: Driver.h:531
+
audio_driver::AudioDriverCS42448Class::p_pins
DriverPins * p_pins
Definition: Driver.h:556
+
audio_driver::AudioDriverCS42448Class::volume
int volume
Definition: Driver.h:557
+
audio_driver::AudioDriverCS43l22Class
Driver API for the CS43l22 codec chip on 0x94 (0x4A<<1)
Definition: Driver.h:404
+
audio_driver::AudioDriverCS43l22Class::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:412
+
audio_driver::AudioDriverCS43l22Class::deviceAddr
uint16_t deviceAddr
Definition: Driver.h:452
+
audio_driver::AudioDriverCS43l22Class::deinit
bool deinit()
Definition: Driver.h:455
+
audio_driver::AudioDriverCS43l22Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:432
+
audio_driver::AudioDriverCS43l22Class::setMute
bool setMute(bool mute)
Definition: Driver.h:440
+
audio_driver::AudioDriverCS43l22Class::setI2CAddress
void setI2CAddress(uint16_t adr)
Definition: Driver.h:410
+
audio_driver::AudioDriverCS43l22Class::getVolume
int getVolume()
Definition: Driver.h:449
+
audio_driver::AudioDriverCS43l22Class::getFrequency
uint32_t getFrequency(samplerate_t rateNum)
Definition: Driver.h:462
+
audio_driver::AudioDriverCS43l22Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:445
+
audio_driver::AudioDriverCS43l22Class::volume
int volume
Definition: Driver.h:453
+
audio_driver::AudioDriverCS43l22Class::getOutput
uint16_t getOutput(output_device_t output_device)
Definition: Driver.h:484
+
audio_driver::AudioDriverCS43l22Class::AudioDriverCS43l22Class
AudioDriverCS43l22Class(uint16_t deviceAddr=0x4A)
Definition: Driver.h:406
+
audio_driver::AudioDriverES7210Class
Driver API for ES7210 codec chip.
Definition: Driver.h:566
+
audio_driver::AudioDriverES7210Class::deinit
bool deinit()
Definition: Driver.h:581
+
audio_driver::AudioDriverES7210Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:578
+
audio_driver::AudioDriverES7210Class::setMute
bool setMute(bool mute)
Definition: Driver.h:568
+
audio_driver::AudioDriverES7210Class::getVolume
int getVolume()
Definition: Driver.h:573
+
audio_driver::AudioDriverES7210Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:569
+
audio_driver::AudioDriverES7210Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:586
+
audio_driver::AudioDriverES7210Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:583
+
audio_driver::AudioDriverES7210Class::volume
int volume
Definition: Driver.h:576
+
audio_driver::AudioDriverES7243Class
Driver API for Lyrat ES7243 codec chip.
Definition: Driver.h:596
+
audio_driver::AudioDriverES7243Class::deinit
bool deinit()
Definition: Driver.h:614
+
audio_driver::AudioDriverES7243Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:611
+
audio_driver::AudioDriverES7243Class::setMute
bool setMute(bool mute)
Definition: Driver.h:598
+
audio_driver::AudioDriverES7243Class::getVolume
int getVolume()
Definition: Driver.h:604
+
audio_driver::AudioDriverES7243Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:601
+
audio_driver::AudioDriverES7243Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:619
+
audio_driver::AudioDriverES7243Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:616
+
audio_driver::AudioDriverES7243eClass
Driver API for ES7243e codec chip.
Definition: Driver.h:630
+
audio_driver::AudioDriverES7243eClass::deinit
bool deinit()
Definition: Driver.h:651
+
audio_driver::AudioDriverES7243eClass::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:648
+
audio_driver::AudioDriverES7243eClass::setMute
bool setMute(bool mute)
Definition: Driver.h:632
+
audio_driver::AudioDriverES7243eClass::getVolume
int getVolume()
Definition: Driver.h:639
+
audio_driver::AudioDriverES7243eClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:635
+
audio_driver::AudioDriverES7243eClass::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:656
+
audio_driver::AudioDriverES7243eClass::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:653
+
audio_driver::AudioDriverES7243eClass::volume
int volume
Definition: Driver.h:646
+
audio_driver::AudioDriverES8156Class
Driver API for ES8156 codec chip.
Definition: Driver.h:666
+
audio_driver::AudioDriverES8156Class::deinit
bool deinit()
Definition: Driver.h:685
+
audio_driver::AudioDriverES8156Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:682
+
audio_driver::AudioDriverES8156Class::setMute
bool setMute(bool mute)
Definition: Driver.h:668
+
audio_driver::AudioDriverES8156Class::getVolume
int getVolume()
Definition: Driver.h:675
+
audio_driver::AudioDriverES8156Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:671
+
audio_driver::AudioDriverES8156Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:690
+
audio_driver::AudioDriverES8156Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:687
+
audio_driver::AudioDriverES8311Class
Driver API for Lyrat ES8311 codec chip.
Definition: Driver.h:700
+
audio_driver::AudioDriverES8311Class::AudioDriverES8311Class
AudioDriverES8311Class(int i2cAddr=0)
Definition: Driver.h:702
+
audio_driver::AudioDriverES8311Class::deinit
bool deinit()
Definition: Driver.h:726
+
audio_driver::AudioDriverES8311Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:716
+
audio_driver::AudioDriverES8311Class::i2c_address
int i2c_address
Definition: Driver.h:714
+
audio_driver::AudioDriverES8311Class::setMute
bool setMute(bool mute)
Definition: Driver.h:703
+
audio_driver::AudioDriverES8311Class::getVolume
int getVolume()
Definition: Driver.h:707
+
audio_driver::AudioDriverES8311Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:704
+
audio_driver::AudioDriverES8311Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:731
+
audio_driver::AudioDriverES8311Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:728
+
audio_driver::AudioDriverES8374Class
Driver API for ES8374 codec chip.
Definition: Driver.h:741
+
audio_driver::AudioDriverES8374Class::deinit
bool deinit()
Definition: Driver.h:766
+
audio_driver::AudioDriverES8374Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:758
+
audio_driver::AudioDriverES8374Class::i2c_address
int i2c_address
Definition: Driver.h:756
+
audio_driver::AudioDriverES8374Class::setMute
bool setMute(bool mute)
Definition: Driver.h:744
+
audio_driver::AudioDriverES8374Class::AudioDriverES8374Class
AudioDriverES8374Class(int i2cAddr=0)
Definition: Driver.h:743
+
audio_driver::AudioDriverES8374Class::getVolume
int getVolume()
Definition: Driver.h:749
+
audio_driver::AudioDriverES8374Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:745
+
audio_driver::AudioDriverES8374Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:771
+
audio_driver::AudioDriverES8374Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:768
+
audio_driver::AudioDriverES8388Class
Driver API for ES8388 codec chip.
Definition: Driver.h:781
+
audio_driver::AudioDriverES8388Class::deinit
bool deinit()
Definition: Driver.h:837
+
audio_driver::AudioDriverES8388Class::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:834
+
audio_driver::AudioDriverES8388Class::setMute
bool setMute(bool mute, int line)
Mute individual lines: only supported for some rare DACs.
Definition: Driver.h:789
+
audio_driver::AudioDriverES8388Class::line_active
bool line_active[2]
Definition: Driver.h:832
+
audio_driver::AudioDriverES8388Class::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:829
+
audio_driver::AudioDriverES8388Class::setMute
bool setMute(bool mute)
Definition: Driver.h:783
+
audio_driver::AudioDriverES8388Class::getVolume
int getVolume()
Definition: Driver.h:812
+
audio_driver::AudioDriverES8388Class::setMicrophoneGain
bool setMicrophoneGain(es_mic_gain_t gain)
Definition: Driver.h:825
+
audio_driver::AudioDriverES8388Class::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:818
+
audio_driver::AudioDriverES8388Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:808
+
audio_driver::AudioDriverES8388Class::configInterface
bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:842
+
audio_driver::AudioDriverES8388Class::controlState
bool controlState(codec_mode_t mode)
Definition: Driver.h:839
audio_driver::AudioDriver
Abstract Driver API for codec chips.
Definition: Driver.h:169
audio_driver::AudioDriver::setMute
virtual bool setMute(bool enable)=0
-
audio_driver::AudioDriver::isInputVolumeSupported
virtual bool isInputVolumeSupported()
Definition: Driver.h:214
+
audio_driver::AudioDriver::isInputVolumeSupported
virtual bool isInputVolumeSupported()
Definition: Driver.h:220
audio_driver::AudioDriver::end
virtual bool end(void)
Definition: Driver.h:207
-
audio_driver::AudioDriver::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:212
-
audio_driver::AudioDriver::setPAPower
bool setPAPower(bool enable)
Sets the PA Power pin to active or inactive.
Definition: Driver.h:219
+
audio_driver::AudioDriver::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:218
+
audio_driver::AudioDriver::setPAPower
bool setPAPower(bool enable)
Sets the PA Power pin to active or inactive.
Definition: Driver.h:225
audio_driver::AudioDriver::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:171
-
audio_driver::AudioDriver::isVolumeSupported
virtual bool isVolumeSupported()
Definition: Driver.h:213
-
audio_driver::AudioDriver::codec_cfg
CodecConfig codec_cfg
Definition: Driver.h:230
-
audio_driver::AudioDriver::pins
DriverPins & pins()
Definition: Driver.h:216
+
audio_driver::AudioDriver::isVolumeSupported
virtual bool isVolumeSupported()
Definition: Driver.h:219
+
audio_driver::AudioDriver::codec_cfg
CodecConfig codec_cfg
Definition: Driver.h:236
+
audio_driver::AudioDriver::pins
DriverPins & pins()
Definition: Driver.h:222
audio_driver::AudioDriver::setVolume
virtual bool setVolume(int volume)=0
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
-
audio_driver::AudioDriver::getI2CAddress
int getI2CAddress()
Definition: Driver.h:243
-
audio_driver::AudioDriver::deinit
virtual bool deinit()
Definition: Driver.h:253
+
audio_driver::AudioDriver::setMute
virtual bool setMute(bool mute, int line)
Mute individual lines: only supported for some rare DACs.
Definition: Driver.h:210
+
audio_driver::AudioDriver::getI2CAddress
int getI2CAddress()
Definition: Driver.h:249
+
audio_driver::AudioDriver::deinit
virtual bool deinit()
Definition: Driver.h:259
audio_driver::AudioDriver::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:183
-
audio_driver::AudioDriver::limitValue
int limitValue(int volume, int min=0, int max=100)
Definition: Driver.h:262
-
audio_driver::AudioDriver::controlState
virtual bool controlState(codec_mode_t mode)
Definition: Driver.h:254
+
audio_driver::AudioDriver::limitValue
int limitValue(int volume, int min=0, int max=100)
Definition: Driver.h:268
+
audio_driver::AudioDriver::controlState
virtual bool controlState(codec_mode_t mode)
Definition: Driver.h:260
audio_driver::AudioDriver::getVolume
virtual int getVolume()=0
-
audio_driver::AudioDriver::getI2C
TwoWire * getI2C()
Determine the TwoWire object from the I2C config or use Wire.
Definition: Driver.h:234
-
audio_driver::AudioDriver::p_pins
DriverPins * p_pins
Definition: Driver.h:231
-
audio_driver::AudioDriver::init
virtual bool init(codec_config_t codec_cfg)
Definition: Driver.h:252
-
audio_driver::AudioDriver::configInterface
virtual bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:255
-
audio_driver::AudioDriverLyratMiniClass
Driver API for Lyrat Mini with a ES8311 and a ES7243 codec chip.
Definition: Driver.h:1113
-
audio_driver::AudioDriverLyratMiniClass::end
bool end(void)
Definition: Driver.h:1123
-
audio_driver::AudioDriverLyratMiniClass::adc
AudioDriverES7243Class adc
Definition: Driver.h:1138
-
audio_driver::AudioDriverLyratMiniClass::dac
AudioDriverES8311Class dac
Definition: Driver.h:1137
-
audio_driver::AudioDriverLyratMiniClass::begin
bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:1115
-
audio_driver::AudioDriverLyratMiniClass::setMute
bool setMute(bool enable)
Definition: Driver.h:1129
-
audio_driver::AudioDriverLyratMiniClass::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:1134
-
audio_driver::AudioDriverLyratMiniClass::getVolume
int getVolume()
Definition: Driver.h:1131
-
audio_driver::AudioDriverLyratMiniClass::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:1132
-
audio_driver::AudioDriverLyratMiniClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:1130
-
audio_driver::AudioDriverLyratMiniClass::getInputVolume
int getInputVolume()
Definition: Driver.h:1133
-
audio_driver::AudioDriverTAS5805MClass
Driver API for TAS5805M codec chip.
Definition: Driver.h:846
-
audio_driver::AudioDriverTAS5805MClass::deinit
bool deinit()
Definition: Driver.h:863
-
audio_driver::AudioDriverTAS5805MClass::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:860
-
audio_driver::AudioDriverTAS5805MClass::setMute
bool setMute(bool mute)
Definition: Driver.h:848
-
audio_driver::AudioDriverTAS5805MClass::getVolume
int getVolume()
Definition: Driver.h:853
-
audio_driver::AudioDriverTAS5805MClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:849
-
audio_driver::AudioDriverWM8960Class
Driver API for WM8990 codec chip.
Definition: Driver.h:871
-
audio_driver::AudioDriverWM8960Class::modeMasterSlave
mtb_wm8960_mode_t modeMasterSlave(bool is_master)
if microcontroller is master then module is slave
Definition: Driver.h:1039
-
audio_driver::AudioDriverWM8960Class::volume_in
int volume_in
Definition: Driver.h:939
-
audio_driver::AudioDriverWM8960Class::end
bool end(void)
Definition: Driver.h:897
-
audio_driver::AudioDriverWM8960Class::setI2CRetryCount
void setI2CRetryCount(int cnt)
Configuration: define retry count (default : 0)
Definition: Driver.h:928
-
audio_driver::AudioDriverWM8960Class::setMclkHz
void setMclkHz(uint32_t hz)
Configuration: define master clock frequency (default: 0)
Definition: Driver.h:934
-
audio_driver::AudioDriverWM8960Class::wordLength
mtb_wm8960_word_length_t wordLength(int bits)
Definition: Driver.h:1022
-
audio_driver::AudioDriverWM8960Class::isVolumeSupported
bool isVolumeSupported()
Definition: Driver.h:923
-
audio_driver::AudioDriverWM8960Class::vs1053_enable_pll
bool vs1053_enable_pll
Definition: Driver.h:943
-
audio_driver::AudioDriverWM8960Class::i2c_retry_count
int i2c_retry_count
Definition: Driver.h:941
-
audio_driver::AudioDriverWM8960Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:873
-
audio_driver::AudioDriverWM8960Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:902
-
audio_driver::AudioDriverWM8960Class::setMute
bool setMute(bool enable)
Definition: Driver.h:907
-
audio_driver::AudioDriverWM8960Class::sampleRate
mtb_wm8960_adc_dac_sample_rate_t sampleRate(int rate)
Definition: Driver.h:994
-
audio_driver::AudioDriverWM8960Class::setEnablePLL
void setEnablePLL(bool active)
Configuration: enable/disable PLL (active by default)
Definition: Driver.h:931
-
audio_driver::AudioDriverWM8960Class::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:925
-
audio_driver::AudioDriverWM8960Class::getFeatures
int getFeatures(CodecConfig cfg)
Definition: Driver.h:945
-
audio_driver::AudioDriverWM8960Class::dumpRegisters
void dumpRegisters()
Definition: Driver.h:936
-
audio_driver::AudioDriverWM8960Class::getVolume
int getVolume()
Definition: Driver.h:916
-
audio_driver::AudioDriverWM8960Class::volume_out
int volume_out
Definition: Driver.h:940
-
audio_driver::AudioDriverWM8960Class::configure_clocking
bool configure_clocking()
Definition: Driver.h:978
-
audio_driver::AudioDriverWM8960Class::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:918
-
audio_driver::AudioDriverWM8960Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:910
-
audio_driver::AudioDriverWM8960Class::vs1053_mclk_hz
uint32_t vs1053_mclk_hz
Definition: Driver.h:942
-
audio_driver::AudioDriverWM8994Class
Driver API for the wm8994 codec chip.
Definition: Driver.h:1049
-
audio_driver::AudioDriverWM8994Class::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:1057
-
audio_driver::AudioDriverWM8994Class::deviceAddr
uint16_t deviceAddr
Definition: Driver.h:1083
-
audio_driver::AudioDriverWM8994Class::deinit
bool deinit()
Definition: Driver.h:1086
-
audio_driver::AudioDriverWM8994Class::AudioDriverWM8994Class
AudioDriverWM8994Class(uint16_t deviceAddr=0x1A)
Definition: Driver.h:1051
-
audio_driver::AudioDriverWM8994Class::setMute
bool setMute(bool mute)
Definition: Driver.h:1070
-
audio_driver::AudioDriverWM8994Class::setI2CAddress
void setI2CAddress(uint16_t adr)
Definition: Driver.h:1055
-
audio_driver::AudioDriverWM8994Class::getVolume
int getVolume()
Definition: Driver.h:1080
-
audio_driver::AudioDriverWM8994Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:1075
-
audio_driver::AudioDriverWM8994Class::volume
int volume
Definition: Driver.h:1084
-
audio_driver::AudioDriverWM8994Class::getOutput
uint16_t getOutput(output_device_t output_device)
Definition: Driver.h:1093
+
audio_driver::AudioDriver::getI2C
TwoWire * getI2C()
Determine the TwoWire object from the I2C config or use Wire.
Definition: Driver.h:240
+
audio_driver::AudioDriver::p_pins
DriverPins * p_pins
Definition: Driver.h:237
+
audio_driver::AudioDriver::init
virtual bool init(codec_config_t codec_cfg)
Definition: Driver.h:258
+
audio_driver::AudioDriver::configInterface
virtual bool configInterface(codec_mode_t mode, I2SDefinition iface)
Definition: Driver.h:261
+
audio_driver::AudioDriverLyratMiniClass
Driver API for Lyrat Mini with a ES8311 and a ES7243 codec chip.
Definition: Driver.h:1119
+
audio_driver::AudioDriverLyratMiniClass::end
bool end(void)
Definition: Driver.h:1129
+
audio_driver::AudioDriverLyratMiniClass::adc
AudioDriverES7243Class adc
Definition: Driver.h:1144
+
audio_driver::AudioDriverLyratMiniClass::dac
AudioDriverES8311Class dac
Definition: Driver.h:1143
+
audio_driver::AudioDriverLyratMiniClass::begin
bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:1121
+
audio_driver::AudioDriverLyratMiniClass::setMute
bool setMute(bool enable)
Definition: Driver.h:1135
+
audio_driver::AudioDriverLyratMiniClass::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:1140
+
audio_driver::AudioDriverLyratMiniClass::getVolume
int getVolume()
Definition: Driver.h:1137
+
audio_driver::AudioDriverLyratMiniClass::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:1138
+
audio_driver::AudioDriverLyratMiniClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:1136
+
audio_driver::AudioDriverLyratMiniClass::getInputVolume
int getInputVolume()
Definition: Driver.h:1139
+
audio_driver::AudioDriverTAS5805MClass
Driver API for TAS5805M codec chip.
Definition: Driver.h:852
+
audio_driver::AudioDriverTAS5805MClass::deinit
bool deinit()
Definition: Driver.h:869
+
audio_driver::AudioDriverTAS5805MClass::init
bool init(codec_config_t codec_cfg)
Definition: Driver.h:866
+
audio_driver::AudioDriverTAS5805MClass::setMute
bool setMute(bool mute)
Definition: Driver.h:854
+
audio_driver::AudioDriverTAS5805MClass::getVolume
int getVolume()
Definition: Driver.h:859
+
audio_driver::AudioDriverTAS5805MClass::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:855
+
audio_driver::AudioDriverWM8960Class
Driver API for WM8990 codec chip.
Definition: Driver.h:877
+
audio_driver::AudioDriverWM8960Class::modeMasterSlave
mtb_wm8960_mode_t modeMasterSlave(bool is_master)
if microcontroller is master then module is slave
Definition: Driver.h:1045
+
audio_driver::AudioDriverWM8960Class::volume_in
int volume_in
Definition: Driver.h:945
+
audio_driver::AudioDriverWM8960Class::end
bool end(void)
Definition: Driver.h:903
+
audio_driver::AudioDriverWM8960Class::setI2CRetryCount
void setI2CRetryCount(int cnt)
Configuration: define retry count (default : 0)
Definition: Driver.h:934
+
audio_driver::AudioDriverWM8960Class::setMclkHz
void setMclkHz(uint32_t hz)
Configuration: define master clock frequency (default: 0)
Definition: Driver.h:940
+
audio_driver::AudioDriverWM8960Class::wordLength
mtb_wm8960_word_length_t wordLength(int bits)
Definition: Driver.h:1028
+
audio_driver::AudioDriverWM8960Class::isVolumeSupported
bool isVolumeSupported()
Definition: Driver.h:929
+
audio_driver::AudioDriverWM8960Class::vs1053_enable_pll
bool vs1053_enable_pll
Definition: Driver.h:949
+
audio_driver::AudioDriverWM8960Class::i2c_retry_count
int i2c_retry_count
Definition: Driver.h:947
+
audio_driver::AudioDriverWM8960Class::begin
bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:879
+
audio_driver::AudioDriverWM8960Class::setConfig
virtual bool setConfig(CodecConfig codecCfg)
Definition: Driver.h:908
+
audio_driver::AudioDriverWM8960Class::setMute
bool setMute(bool enable)
Definition: Driver.h:913
+
audio_driver::AudioDriverWM8960Class::sampleRate
mtb_wm8960_adc_dac_sample_rate_t sampleRate(int rate)
Definition: Driver.h:1000
+
audio_driver::AudioDriverWM8960Class::setEnablePLL
void setEnablePLL(bool active)
Configuration: enable/disable PLL (active by default)
Definition: Driver.h:937
+
audio_driver::AudioDriverWM8960Class::isInputVolumeSupported
bool isInputVolumeSupported()
Definition: Driver.h:931
+
audio_driver::AudioDriverWM8960Class::getFeatures
int getFeatures(CodecConfig cfg)
Definition: Driver.h:951
+
audio_driver::AudioDriverWM8960Class::dumpRegisters
void dumpRegisters()
Definition: Driver.h:942
+
audio_driver::AudioDriverWM8960Class::getVolume
int getVolume()
Definition: Driver.h:922
+
audio_driver::AudioDriverWM8960Class::volume_out
int volume_out
Definition: Driver.h:946
+
audio_driver::AudioDriverWM8960Class::configure_clocking
bool configure_clocking()
Definition: Driver.h:984
+
audio_driver::AudioDriverWM8960Class::setInputVolume
bool setInputVolume(int volume)
Definition: Driver.h:924
+
audio_driver::AudioDriverWM8960Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:916
+
audio_driver::AudioDriverWM8960Class::vs1053_mclk_hz
uint32_t vs1053_mclk_hz
Definition: Driver.h:948
+
audio_driver::AudioDriverWM8994Class
Driver API for the wm8994 codec chip.
Definition: Driver.h:1055
+
audio_driver::AudioDriverWM8994Class::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:1063
+
audio_driver::AudioDriverWM8994Class::deviceAddr
uint16_t deviceAddr
Definition: Driver.h:1089
+
audio_driver::AudioDriverWM8994Class::deinit
bool deinit()
Definition: Driver.h:1092
+
audio_driver::AudioDriverWM8994Class::AudioDriverWM8994Class
AudioDriverWM8994Class(uint16_t deviceAddr=0x1A)
Definition: Driver.h:1057
+
audio_driver::AudioDriverWM8994Class::setMute
bool setMute(bool mute)
Definition: Driver.h:1076
+
audio_driver::AudioDriverWM8994Class::setI2CAddress
void setI2CAddress(uint16_t adr)
Definition: Driver.h:1061
+
audio_driver::AudioDriverWM8994Class::getVolume
int getVolume()
Definition: Driver.h:1086
+
audio_driver::AudioDriverWM8994Class::setVolume
bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:1081
+
audio_driver::AudioDriverWM8994Class::volume
int volume
Definition: Driver.h:1090
+
audio_driver::AudioDriverWM8994Class::getOutput
uint16_t getOutput(output_device_t output_device)
Definition: Driver.h:1099
audio_driver::CodecConfig
I2S configuration and definition of input and output with default values.
Definition: Driver.h:35
audio_driver::CodecConfig::CodecConfig
CodecConfig()
setup default values
Definition: Driver.h:38
audio_driver::CodecConfig::getRateNumeric
int getRateNumeric()
get the sample rate as number
Definition: Driver.h:94
@@ -1368,35 +1374,35 @@
audio_driver::DriverPins::getSPIPins
Optional< PinsSPI > getSPIPins(PinFunction function)
Finds the SPI pin info with the help of the function.
Definition: DriverPins.h:323
audio_driver::DriverPins::setSPIActiveForSD
void setSPIActiveForSD(bool active)
Defines if SPI for SD should be started (by default true)
Definition: DriverPins.h:388
audio_driver::DriverPins::getI2CPins
Optional< PinsI2C > getI2CPins(PinFunction function)
Finds the I2C pin info with the help of the function.
Definition: DriverPins.h:316
-
audio_driver::NoDriverClass
Dummy Driver which does nothing.
Definition: Driver.h:275
-
audio_driver::NoDriverClass::isInputVolumeSupported
virtual bool isInputVolumeSupported()
Definition: Driver.h:290
-
audio_driver::NoDriverClass::end
virtual bool end(void)
Definition: Driver.h:282
-
audio_driver::NoDriverClass::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:286
-
audio_driver::NoDriverClass::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:277
-
audio_driver::NoDriverClass::isVolumeSupported
virtual bool isVolumeSupported()
Definition: Driver.h:287
-
audio_driver::NoDriverClass::getVolume
virtual int getVolume()
Definition: Driver.h:285
-
audio_driver::NoDriverClass::setMute
virtual bool setMute(bool enable)
Definition: Driver.h:283
-
audio_driver::NoDriverClass::setVolume
virtual bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:284
+
audio_driver::NoDriverClass
Dummy Driver which does nothing.
Definition: Driver.h:281
+
audio_driver::NoDriverClass::isInputVolumeSupported
virtual bool isInputVolumeSupported()
Definition: Driver.h:296
+
audio_driver::NoDriverClass::end
virtual bool end(void)
Definition: Driver.h:288
+
audio_driver::NoDriverClass::setInputVolume
virtual bool setInputVolume(int volume)
Definition: Driver.h:292
+
audio_driver::NoDriverClass::begin
virtual bool begin(CodecConfig codecCfg, DriverPins &pins)
Definition: Driver.h:283
+
audio_driver::NoDriverClass::isVolumeSupported
virtual bool isVolumeSupported()
Definition: Driver.h:293
+
audio_driver::NoDriverClass::getVolume
virtual int getVolume()
Definition: Driver.h:291
+
audio_driver::NoDriverClass::setMute
virtual bool setMute(bool enable)
Definition: Driver.h:289
+
audio_driver::NoDriverClass::setVolume
virtual bool setVolume(int volume)
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Definition: Driver.h:290
HIGH
#define HIGH
Definition: etc.h:7
delay
void delay(unsigned long)
LOW
#define LOW
Definition: etc.h:10
digitalWrite
void digitalWrite(int, int)
-
audio_driver::AudioDriverES8311
static AudioDriverES8311Class AudioDriverES8311
Definition: Driver.h:1155
-
audio_driver::AudioDriverWM8994
static AudioDriverWM8994Class AudioDriverWM8994
Definition: Driver.h:1163
-
audio_driver::AudioDriverLyratMini
static AudioDriverLyratMiniClass AudioDriverLyratMini
Definition: Driver.h:1165
-
audio_driver::NoDriver
static NoDriverClass NoDriver
Definition: Driver.h:1167
-
audio_driver::AudioDriverES7210
static AudioDriverES7210Class AudioDriverES7210
Definition: Driver.h:1147
-
audio_driver::AudioDriverES8156
static AudioDriverES8156Class AudioDriverES8156
Definition: Driver.h:1153
-
audio_driver::AudioDriverES7243
static AudioDriverES7243Class AudioDriverES7243
Definition: Driver.h:1149
-
audio_driver::AudioDriverAC101
static AudioDriverAC101Class AudioDriverAC101
Definition: Driver.h:1143
-
audio_driver::AudioDriverCS42448
static AudioDriverCS42448Class AudioDriverCS42448
Definition: Driver.h:1171
+
audio_driver::AudioDriverES8311
static AudioDriverES8311Class AudioDriverES8311
Definition: Driver.h:1161
+
audio_driver::AudioDriverWM8994
static AudioDriverWM8994Class AudioDriverWM8994
Definition: Driver.h:1169
+
audio_driver::AudioDriverLyratMini
static AudioDriverLyratMiniClass AudioDriverLyratMini
Definition: Driver.h:1171
+
audio_driver::NoDriver
static NoDriverClass NoDriver
Definition: Driver.h:1173
+
audio_driver::AudioDriverES7210
static AudioDriverES7210Class AudioDriverES7210
Definition: Driver.h:1153
+
audio_driver::AudioDriverES8156
static AudioDriverES8156Class AudioDriverES8156
Definition: Driver.h:1159
+
audio_driver::AudioDriverES7243
static AudioDriverES7243Class AudioDriverES7243
Definition: Driver.h:1155
+
audio_driver::AudioDriverAC101
static AudioDriverAC101Class AudioDriverAC101
Definition: Driver.h:1149
+
audio_driver::AudioDriverCS42448
static AudioDriverCS42448Class AudioDriverCS42448
Definition: Driver.h:1177
output_device_t
output_device_t
Select individual dac for dac output. If the device has only one DAC this might provide the functiona...
Definition: Common.h:67
-
audio_driver::AudioDriverES7243e
static AudioDriverES7243eClass AudioDriverES7243e
Definition: Driver.h:1151
-
audio_driver::AudioDriverCS43l22
static AudioDriverCS43l22Class AudioDriverCS43l22
Definition: Driver.h:1145
-
audio_driver::AudioDriverWM8960
static AudioDriverWM8960Class AudioDriverWM8960
Definition: Driver.h:1161
-
audio_driver::AudioDriverES8388
static AudioDriverES8388Class AudioDriverES8388
Definition: Driver.h:1159
-
audio_driver::AudioDriverES8374
static AudioDriverES8374Class AudioDriverES8374
Definition: Driver.h:1157
-
audio_driver::AudioDriverAD1938
static AudioDriverAD1938Class AudioDriverAD1938
Definition: Driver.h:1169
+
audio_driver::AudioDriverES7243e
static AudioDriverES7243eClass AudioDriverES7243e
Definition: Driver.h:1157
+
audio_driver::AudioDriverCS43l22
static AudioDriverCS43l22Class AudioDriverCS43l22
Definition: Driver.h:1151
+
audio_driver::AudioDriverWM8960
static AudioDriverWM8960Class AudioDriverWM8960
Definition: Driver.h:1167
+
audio_driver::AudioDriverES8388
static AudioDriverES8388Class AudioDriverES8388
Definition: Driver.h:1165
+
audio_driver::AudioDriverES8374
static AudioDriverES8374Class AudioDriverES8374
Definition: Driver.h:1163
+
audio_driver::AudioDriverAD1938
static AudioDriverAD1938Class AudioDriverAD1938
Definition: Driver.h:1175
codec_mode_t
codec_mode_t
Select media hal codec mode.
Definition: Common.h:159
samplerate_t
samplerate_t
Select I2S interface samples per second.
Definition: Common.h:90
es_mic_gain_t
es_mic_gain_t
Microphone Gain.
Definition: Common.h:140
diff --git a/docs/html/classaudio__driver_1_1_audio_driver-members.html b/docs/html/classaudio__driver_1_1_audio_driver-members.html index 5c958cf..3cc0158 100644 --- a/docs/html/classaudio__driver_1_1_audio_driver-members.html +++ b/docs/html/classaudio__driver_1_1_audio_driver-members.html @@ -90,8 +90,9 @@ setConfig(CodecConfig codecCfg)AudioDriverinlinevirtual setInputVolume(int volume)AudioDriverinlinevirtual setMute(bool enable)=0AudioDriverpure virtual - setPAPower(bool enable)AudioDriverinline - setVolume(int volume)=0AudioDriverpure virtual + setMute(bool mute, int line)AudioDriverinlinevirtual + setPAPower(bool enable)AudioDriverinline + setVolume(int volume)=0AudioDriverpure virtual