Arduino AudioKit HAL
AudioKitHAL.h
1 /**
2  * @file AudioKit.h
3  * @author Phil Schatzmann
4  * @brief Arduino API for AudioKit
5  * @version 0.1
6  * @date 2021-12-12
7  *
8  * @copyright Copyright (c) 2021
9  *
10  */
11 #pragma once
12 #include "AudioKitSettings.h"
13 
14 // include drivers
15 #include "audio_driver/es7148/es7148.h"
16 #include "audio_driver/es7210/es7210.h"
17 #include "audio_driver/es7243/es7243.h"
18 #include "audio_driver/es8311/es8311.h"
19 #include "audio_driver/es8374/es8374.h"
20 #include "audio_driver/es8388/es8388.h"
21 #include "audio_driver/tas5805m/tas5805m.h"
22 #include "audio_hal/audiokit_board.h"
23 #include "audio_hal/audiokit_logger.h"
24 #include "SPI.h"
25 
26 #ifdef ESP32
27 #include "esp_a2dp_api.h"
28 #include "audio_hal/audio_system.h"
29 #include "audio_hal/audio_version.h"
30 #include "driver/i2s.h"
31 #include "audio_hal/audio_type_def.h"
32 
33 #endif
34 
35 // Support for old IDF versions
36 #if ESP_IDF_VERSION_MAJOR < 4 && !defined(I2S_COMM_FORMAT_STAND_I2S)
37 #define I2S_COMM_FORMAT_STAND_I2S \
38  (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB)
39 #define I2S_COMM_FORMAT_STAND_MSB \
40  (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB)
41 #define I2S_COMM_FORMAT_STAND_PCM_LONG \
42  (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_LONG)
43 #define I2S_COMM_FORMAT_STAND_PCM_SHORT \
44  (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_SHORT)
45 typedef int eps32_i2s_audio_sample_rate_type;
46 #else
47 typedef uint32_t eps32_i2s_audio_sample_rate_type;
48 #endif
49 
50 class AudioKit;
51 class AudioKit* selfAudioKit = nullptr;
52 
53 /**
54  * @brief Configuation for AudioKit
55  *
56  */
58  i2s_port_t i2s_num = (i2s_port_t)0;
59  gpio_num_t mclk_gpio = (gpio_num_t)0;
60  bool sd_active = true;
61 
62  audio_hal_adc_input_t adc_input = AUDIOKIT_DEFAULT_INPUT; /*!< set adc channel with audio_hal_adc_input_t*/
63  audio_hal_dac_output_t dac_output =AUDIOKIT_DEFAULT_OUTPUT; /*!< set dac channel */
64  audio_hal_codec_mode_t codec_mode; /*!< select codec mode: adc, dac or both */
65  audio_hal_iface_mode_t master_slave_mode = AUDIOKIT_DEFAULT_MASTER_SLAVE; /*!< audio codec chip mode */
66  audio_hal_iface_format_t fmt = AUDIOKIT_DEFAULT_I2S_FMT; /*!< I2S interface format */
67  audio_hal_iface_samples_t sample_rate = AUDIOKIT_DEFAULT_RATE; /*!< I2S interface samples per second */
68  audio_hal_iface_bits_t bits_per_sample = AUDIOKIT_DEFAULT_BITSIZE; /*!< i2s interface number of bits per sample */
69 
70  /// Returns true if the CODEC is the master
71  bool isMaster() { return master_slave_mode == AUDIO_HAL_MODE_MASTER; }
72 
73  /// provides the bits per sample
74  int bitsPerSample() {
75  switch (bits_per_sample) {
76  case AUDIO_HAL_BIT_LENGTH_16BITS:
77  return 16;
78  case AUDIO_HAL_BIT_LENGTH_24BITS:
79  return 24;
80  case AUDIO_HAL_BIT_LENGTH_32BITS:
81  return 32;
82  }
83  KIT_LOGE("bits_per_sample not supported: %d", bits_per_sample);
84  return 0;
85  }
86 
87  /// Provides the sample rate in samples per second
88  uint32_t sampleRate() {
89  switch (sample_rate) {
90  case AUDIO_HAL_08K_SAMPLES: /*!< set to 8k samples per second */
91  return 8000;
92  case AUDIO_HAL_11K_SAMPLES: /*!< set to 11.025k samples per second */
93  return 11000;
94  case AUDIO_HAL_16K_SAMPLES: /*!< set to 16k samples in per second */
95  return 16000;
96  case AUDIO_HAL_22K_SAMPLES: /*!< set to 22.050k samples per second */
97  return 22000;
98  case AUDIO_HAL_24K_SAMPLES: /*!< set to 24k samples in per second */
99  return 24000;
100  case AUDIO_HAL_32K_SAMPLES: /*!< set to 32k samples in per second */
101  return 32000;
102  case AUDIO_HAL_44K_SAMPLES: /*!< set to 44.1k samples per second */
103  return 44000;
104  case AUDIO_HAL_48K_SAMPLES: /*!< set to 48k samples per second */
105  return 48000;
106  }
107  KIT_LOGE("sample rate not supported: %d", sample_rate);
108  return 0;
109  }
110 
111 #ifdef ESP32
112  /// Provides the ESP32 i2s_config_t to configure I2S
113  i2s_config_t i2sConfig() {
114  // use just the oposite of the CODEC setting
115  const i2s_config_t i2s_config = {
116  .mode = i2sMode(),
117  .sample_rate = sampleRate(),
118  .bits_per_sample = (i2s_bits_per_sample_t)bitsPerSample(),
119  .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
120  .communication_format = (i2s_comm_format_t)i2sFormat(),
121  .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2 | ESP_INTR_FLAG_IRAM,
122  .dma_buf_count = 3,
123  .dma_buf_len = 320,
124  .use_apll = true,
125  .tx_desc_auto_clear = true,
126  // #if ESP_IDF_VERSION_MAJOR >= 4
127  // .fixed_mclk = 2000000,
128  // #endif
129  };
130  return i2s_config;
131  }
132 
133  /// Provides the ESP32 i2s_pin_config_t to configure the pins for I2S
134  i2s_pin_config_t i2sPins() {
135  i2s_pin_config_t result;
136  get_i2s_pins(i2s_num, &result);
137  #if ESP_IDF_VERSION_MAJOR >= 4
138  result.mck_io_num = I2S_PIN_NO_CHANGE; //mclk_gpio;
139  #endif
140  return result;
141  }
142 
143  protected:
144  i2s_comm_format_t i2sFormat(){
145  i2s_comm_format_t its_com_fmt = (i2s_comm_format_t) I2S_COMM_FORMAT_STAND_I2S;
146  if (fmt==AUDIO_HAL_I2S_LEFT){
147  its_com_fmt = (i2s_comm_format_t) I2S_COMM_FORMAT_STAND_MSB;
148  } else if(fmt==AUDIO_HAL_I2S_RIGHT){
149  its_com_fmt = (i2s_comm_format_t) I2S_COMM_FORMAT_STAND_MSB;
150  } else if(fmt==AUDIO_HAL_I2S_DSP){
151  its_com_fmt = (i2s_comm_format_t )I2S_COMM_FORMAT_STAND_PCM_SHORT;
152  }
153  return its_com_fmt;
154  }
155 
156  i2s_mode_t i2sMode() {
157  int mode = isMaster() ? I2S_MODE_SLAVE : I2S_MODE_MASTER;
158  // using ESP32 dac/adc
159  if (fmt == AUDIO_HAL_I2S_DSP){
160  if (codec_mode == AUDIO_HAL_CODEC_MODE_DECODE) {
161  mode = mode | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN;
162  } else if (codec_mode == AUDIO_HAL_CODEC_MODE_ENCODE) {
163  mode = mode | I2S_MODE_RX | I2S_MODE_ADC_BUILT_IN;
164  } else if (codec_mode == AUDIO_HAL_CODEC_MODE_BOTH) {
165  mode = mode | I2S_MODE_RX | I2S_MODE_TX | I2S_MODE_ADC_BUILT_IN | I2S_MODE_DAC_BUILT_IN;
166  }
167  } else {
168  // I2S
169  if (codec_mode == AUDIO_HAL_CODEC_MODE_DECODE) {
170  mode = mode | I2S_MODE_TX;
171  } else if (codec_mode == AUDIO_HAL_CODEC_MODE_ENCODE) {
172  mode = mode | I2S_MODE_RX;
173  } else if (codec_mode == AUDIO_HAL_CODEC_MODE_BOTH) {
174  mode = mode | I2S_MODE_RX | I2S_MODE_TX;
175  }
176  }
177  return (i2s_mode_t) mode;
178  }
179 
180 #endif
181 };
182 
183 /**
184  * @brief Do we read or write audio data - or both
185  *
186  */
187 enum AudioKitInOut {AudioOutput, AudioInput, AudioInputOutput };
188 
189 /**
190  * @brief AudioKit API using the audio_hal
191  *
192  */
193 
194 class AudioKit {
195 
196  public:
197  AudioKit() {
198  // setup SPI for SD drives
199  selfAudioKit = this;
200  // added to constructor so that SPI is setup as part of global variable setup
201  setupSPI();
202  }
203 
204  /// Provides the default configuration for input or output
205  AudioKitConfig defaultConfig(AudioKitInOut inout=AudioInputOutput) {
206  AudioKitConfig result;
207  switch(inout){
208  case AudioOutput:
209  result.codec_mode = AUDIO_HAL_CODEC_MODE_DECODE; // dac
210  case AudioInput:
211  result.codec_mode = AUDIO_HAL_CODEC_MODE_ENCODE; // adc
212  default:
213  result.codec_mode = AUDIO_HAL_CODEC_MODE_BOTH;
214  }
215  return result;
216  }
217 
218  /// Starts the codec
219  bool begin(AudioKitConfig cnfg) {
220  KIT_LOGI(LOG_METHOD);
221  cfg = cnfg;
222  KIT_LOGI("Selected board: %d", AUDIOKIT_BOARD);
223 
224  // setup SPI for SD card
225  setupSPI();
226 
227  // setup headphone if necessary
229 
230  audio_hal_conf.adc_input = cfg.adc_input;
231  audio_hal_conf.dac_output = cfg.dac_output;
232  audio_hal_conf.codec_mode = cfg.codec_mode;
233  audio_hal_conf.i2s_iface.mode = cfg.master_slave_mode;
234  audio_hal_conf.i2s_iface.fmt = cfg.fmt;
235  audio_hal_conf.i2s_iface.samples = cfg.sample_rate;
236  audio_hal_conf.i2s_iface.bits = cfg.bits_per_sample;
237 
238  // init HAL
239  if (hal_handle == 0) {
240  hal_handle = audio_hal_init(&audio_hal_conf, &AUDIO_DRIVER);
241  if (hal_handle == 0) {
242  KIT_LOGE("audio_hal_init");
243  return false;
244  }
245  }
246 
247 
248 #ifdef ESP32
249 
250  // setup i2s driver - with no queue
251  i2s_config_t i2s_config = cfg.i2sConfig();
252  if (i2s_driver_install(cfg.i2s_num, &i2s_config, 0, NULL) != ESP_OK) {
253  KIT_LOGE("i2s_driver_install");
254  return false;
255  }
256 
257  // define i2s pins
258  i2s_pin_config_t pin_config = cfg.i2sPins();
259  KIT_LOGI("i2s_set_pin");
260  if (i2s_set_pin(cfg.i2s_num, &pin_config) != ESP_OK) {
261  KIT_LOGE("i2s_set_pin");
262  return false;
263  }
264 
265 //#if ESP_IDF_VERSION_MAJOR < 4
266  if (i2s_mclk_gpio_select(cfg.i2s_num, cfg.mclk_gpio) != ESP_OK) {
267  KIT_LOGE("i2s_mclk_gpio_select");
268  return false;
269  }
270 //#endif
271 
272 #endif
273 
274  // call start
275  if (!setActive(true)) {
276  KIT_LOGE("setActive");
277  return false;
278  }
279 
280  return true;
281  }
282 
283  /// Stops the CODEC
284  bool end() {
285  KIT_LOGI(LOG_METHOD);
286 
287 #ifdef ESP32
288  // uninstall i2s driver
289  i2s_driver_uninstall(cfg.i2s_num);
290 #endif
291  // stop codec driver
292  audio_hal_ctrl_codec(hal_handle, cfg.codec_mode, AUDIO_HAL_CTRL_STOP);
293  // deinit
294  audio_hal_deinit(hal_handle);
295  return true;
296  }
297 
298  /// Provides the actual configuration
299  AudioKitConfig config() { return cfg; }
300 
301  /// Sets the codec active / inactive
302  bool setActive(bool active) {
303  return audio_hal_ctrl_codec( hal_handle, cfg.codec_mode, active ? AUDIO_HAL_CTRL_START : AUDIO_HAL_CTRL_STOP) == ESP_OK;
304  }
305 
306  /// Mutes the output
307  bool setMute(bool mute) {
308  return audio_hal_set_mute(hal_handle, mute) == ESP_OK;
309  }
310 
311  /// Defines the Volume
312  bool setVolume(int vol) {
313  return (vol > 0) ? audio_hal_set_volume(hal_handle, vol) == ESP_OK : false;
314  }
315 
316  /// Determines the volume
317  int volume() {
318  int volume;
319  if (audio_hal_get_volume(hal_handle, &volume) != ESP_OK) {
320  volume = -1;
321  }
322  return volume;
323  }
324 
325 #ifdef ESP32
326 
327  /// Writes the audio data via i2s to the DAC
328  size_t write(const void *src, size_t size,
329  TickType_t ticks_to_wait = portMAX_DELAY) {
330  KIT_LOGD("write: %zu", size);
331  size_t bytes_written = 0;
332  if (i2s_write(cfg.i2s_num, src, size, &bytes_written, ticks_to_wait) !=
333  ESP_OK) {
334  KIT_LOGE("i2s_write");
335  }
336  return bytes_written;
337  }
338 
339  /// Reads the audio data via i2s from the ADC
340  size_t read(void *dest, size_t size,
341  TickType_t ticks_to_wait = portMAX_DELAY) {
342  KIT_LOGD("read: %zu", size);
343  size_t bytes_read = 0;
344  if (i2s_read(cfg.i2s_num, dest, size, &bytes_read, ticks_to_wait) !=
345  ESP_OK) {
346  KIT_LOGE("i2s_read");
347  }
348  return bytes_read;
349  }
350 
351 #endif
352 
353  /**
354  * @brief Get the gpio number for auxin detection
355  *
356  * @return -1 non-existent
357  * Others gpio number
358  */
359  int8_t pinAuxin() { return get_auxin_detect_gpio(); }
360 
361  /**
362  * @brief Get the gpio number for headphone detection
363  *
364  * @return -1 non-existent
365  * Others gpio number
366  */
367  int8_t pinHeadphoneDetect() { return get_headphone_detect_gpio(); }
368 
369  /**
370  * @brief Get the gpio number for PA enable
371  *
372  * @return -1 non-existent
373  * Others gpio number
374  */
375  int8_t pinPaEnable() { return get_pa_enable_gpio(); }
376 
377  /**
378  * @brief Get the gpio number for adc detection
379  *
380  * @return -1 non-existent
381  * Others gpio number
382  */
383  int8_t pinAdcDetect() { return get_adc_detect_gpio(); }
384 
385  /**
386  * @brief Get the mclk gpio number of es7243
387  *
388  * @return -1 non-existent
389  * Others gpio number
390  */
391  int8_t pinEs7243Mclk() { return get_es7243_mclk_gpio(); }
392 
393  /**
394  * @brief Get the record-button id for adc-button
395  *
396  * @return -1 non-existent
397  * Others button id
398  */
399  int8_t pinInputRec() { return get_input_rec_id(); }
400 
401  /**
402  * @brief Get the number for mode-button
403  *
404  * @return -1 non-existent
405  * Others number
406  */
407  int8_t pinInputMode() { return get_input_mode_id(); }
408 
409  /**
410  * @brief Get number for set function
411  *
412  * @return -1 non-existent
413  * Others number
414  */
415  int8_t pinInputSet() { return get_input_set_id(); };
416 
417  /**
418  * @brief Get number for play function
419  *
420  * @return -1 non-existent
421  * Others number
422  */
423  int8_t pinInputPlay() { return get_input_play_id(); }
424 
425  /**
426  * @brief number for volume up function
427  *
428  * @return -1 non-existent
429  * Others number
430  */
431  int8_t pinVolumeUp() { return get_input_volup_id(); }
432 
433  /**
434  * @brief Get number for volume down function
435  *
436  * @return -1 non-existent
437  * Others number
438  */
439  int8_t pinVolumeDown() { return get_input_voldown_id(); }
440 
441  /**
442  * @brief Get reset codec gpio number
443  *
444  * @return -1 non-existent
445  * Others gpio number
446  */
447  int8_t pinResetCodec() { return get_reset_codec_gpio(); }
448 
449  /**
450  * @brief Get gpio number to reset the board
451  *
452  * @return -1 non-existent
453  * Others gpio number
454  */
455  int8_t pinResetBoard() { return get_reset_board_gpio(); }
456 
457  /**
458  * @brief Get gpio number for green led
459  *
460  * @return -1 non-existent
461  * Others gpio number
462  */
463  int8_t pinGreenLed() { return get_green_led_gpio(); }
464 
465  /**
466  * @brief Get blue led gpio number
467  *
468  * @return -1 non-existent
469  * Others gpio number
470  */
471  int8_t pinBlueLed() { return get_blue_led_gpio(); }
472 
473  /**
474  * @brief SPI CS Pin for SD Drive
475  *
476  * @return int8_t
477  */
478  int8_t pinSpiCs() {
479  return spi_cs_pin;
480  }
481 
482  /**
483  * @brief Activates/deactivates the speaker amplifier output
484  * This is working only if the driver is supporting the functionality
485  * @param active
486  */
487  void setSpeakerActive(bool active) {
488  int paPin = get_pa_enable_gpio();
489  if (paPin>0){
490  digitalWrite(paPin, active);
491  } else {
492  KIT_LOGW("setSpeakerActive not supported");
493  }
494  }
495 
496  /**
497  * @brief Switch off the PA if the headphone in plugged in
498  * and switch it on again if the headphone is unplugged
499  *
500  */
501  static void actionHeadphoneDetection() {
502  if (selfAudioKit->headphonePin>0){
503 
504  // detect changes
505  bool isConnected = selfAudioKit->headphoneStatus();
506  if (selfAudioKit->headphoneIsConnected != isConnected) {
507  selfAudioKit->headphoneIsConnected = isConnected;
508 
509  // update if things have stabilized
510  bool powerActive = !isConnected;
511  KIT_LOGW("Headphone jack has been %s", isConnected ? "inserted" : "removed");
512  selfAudioKit->setSpeakerActive(powerActive);
513  }
514  }
515  yield();
516  }
517 
518 
519  /**
520  * @brief Returns true if the headphone was detected
521  *
522  * @return true
523  * @return false
524  */
526  return headphonePin>0 ? !digitalRead(headphonePin) : false;
527  }
528 
529  /// checks if the SD is active
530  bool isSDActive() {
531  return cfg.sd_active;
532  }
533 
534  protected:
535  AudioKitConfig cfg;
536  audio_hal_codec_config_t audio_hal_conf;
537  audio_hal_handle_t hal_handle = 0;
538  audio_hal_codec_i2s_iface_t iface;
539  int8_t spi_cs_pin;
540  bool headphoneIsConnected = false;
541  unsigned long speakerChangeTimeout = 0;
542  int8_t headphonePin = -1;
543  bool setup_sd_spi = true;
544 
545  /**
546  * @brief Setup the headphone detection
547  */
549  int8_t paPin = pinPaEnable();
550  if (paPin>0){
551  headphonePin = pinHeadphoneDetect();
552  if (headphonePin>0){
553  pinMode(headphonePin, INPUT_PULLUP);
554  pinMode(paPin, OUTPUT);
555  KIT_LOGI("headphone detection is active");
556  } else {
557  KIT_LOGI("headphone detection not supported");
558  }
559  } else {
560  KIT_LOGI("headphone detection: PA not supported");
561  }
562  }
563 
564  /**
565  * @brief Setup the SPI so that we can access the SD Drive
566  */
567  void setupSPI() {
568 // I assume this is valid for all AudioKits!
569 #if AUDIOKIT_SETUP_SD==1
570  if (cfg.sd_active && setup_sd_spi){
571  KIT_LOGI(LOG_METHOD);
572  spi_cs_pin = PIN_AUDIO_KIT_SD_CARD_CS;
573  pinMode(spi_cs_pin, OUTPUT);
574  digitalWrite(spi_cs_pin, HIGH);
575 
576  SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS);
577  setup_sd_spi = false;
578  }
579 #else
580  #warning "SPI initialization for the SD drive not supported - you might need to take care of this yourself"
581  cfg.sd_active = false;
582 #endif
583  }
584 
585 
586 
587 };
AUDIOKIT_BOARD selects a specic board: 1) lyrat_v4_3 2) lyrat_v4_2 3) lyrat_mini_v1_1 4) esp32_s2_kal...
AudioKit API using the audio_hal.
Definition: AudioKitHAL.h:194
int8_t pinHeadphoneDetect()
Get the gpio number for headphone detection.
Definition: AudioKitHAL.h:367
int8_t pinGreenLed()
Get gpio number for green led.
Definition: AudioKitHAL.h:463
bool headphoneStatus()
Returns true if the headphone was detected.
Definition: AudioKitHAL.h:525
int8_t pinAdcDetect()
Get the gpio number for adc detection.
Definition: AudioKitHAL.h:383
int8_t pinVolumeUp()
number for volume up function
Definition: AudioKitHAL.h:431
int8_t pinSpiCs()
SPI CS Pin for SD Drive.
Definition: AudioKitHAL.h:478
int8_t pinPaEnable()
Get the gpio number for PA enable.
Definition: AudioKitHAL.h:375
int8_t pinInputRec()
Get the record-button id for adc-button.
Definition: AudioKitHAL.h:399
bool setActive(bool active)
Sets the codec active / inactive.
Definition: AudioKitHAL.h:302
int8_t pinInputMode()
Get the number for mode-button.
Definition: AudioKitHAL.h:407
int8_t pinEs7243Mclk()
Get the mclk gpio number of es7243.
Definition: AudioKitHAL.h:391
static void actionHeadphoneDetection()
Switch off the PA if the headphone in plugged in and switch it on again if the headphone is unplugged...
Definition: AudioKitHAL.h:501
int volume()
Determines the volume.
Definition: AudioKitHAL.h:317
int8_t pinAuxin()
Get the gpio number for auxin detection.
Definition: AudioKitHAL.h:359
void setupSPI()
Setup the SPI so that we can access the SD Drive.
Definition: AudioKitHAL.h:567
bool begin(AudioKitConfig cnfg)
Starts the codec.
Definition: AudioKitHAL.h:219
bool setMute(bool mute)
Mutes the output.
Definition: AudioKitHAL.h:307
int8_t pinVolumeDown()
Get number for volume down function.
Definition: AudioKitHAL.h:439
bool end()
Stops the CODEC.
Definition: AudioKitHAL.h:284
int8_t pinResetBoard()
Get gpio number to reset the board.
Definition: AudioKitHAL.h:455
void setupHeadphoneDetection()
Setup the headphone detection.
Definition: AudioKitHAL.h:548
bool setVolume(int vol)
Defines the Volume.
Definition: AudioKitHAL.h:312
int8_t pinResetCodec()
Get reset codec gpio number.
Definition: AudioKitHAL.h:447
int8_t pinInputSet()
Get number for set function.
Definition: AudioKitHAL.h:415
AudioKitConfig defaultConfig(AudioKitInOut inout=AudioInputOutput)
Provides the default configuration for input or output.
Definition: AudioKitHAL.h:205
int8_t pinBlueLed()
Get blue led gpio number.
Definition: AudioKitHAL.h:471
bool isSDActive()
checks if the SD is active
Definition: AudioKitHAL.h:530
int8_t pinInputPlay()
Get number for play function.
Definition: AudioKitHAL.h:423
AudioKitConfig config()
Provides the actual configuration.
Definition: AudioKitHAL.h:299
void setSpeakerActive(bool active)
Activates/deactivates the speaker amplifier output This is working only if the driver is supporting t...
Definition: AudioKitHAL.h:487
Configuation for AudioKit.
Definition: AudioKitHAL.h:57
audio_hal_iface_bits_t bits_per_sample
Definition: AudioKitHAL.h:68
uint32_t sampleRate()
Provides the sample rate in samples per second.
Definition: AudioKitHAL.h:88
int bitsPerSample()
provides the bits per sample
Definition: AudioKitHAL.h:74
audio_hal_dac_output_t dac_output
Definition: AudioKitHAL.h:63
bool isMaster()
Returns true if the CODEC is the master.
Definition: AudioKitHAL.h:71
audio_hal_adc_input_t adc_input
Definition: AudioKitHAL.h:62
audio_hal_iface_format_t fmt
Definition: AudioKitHAL.h:66
audio_hal_iface_mode_t master_slave_mode
Definition: AudioKitHAL.h:65
audio_hal_iface_samples_t sample_rate
Definition: AudioKitHAL.h:67
audio_hal_codec_mode_t codec_mode
Definition: AudioKitHAL.h:64