Arduino AudioKit HAL
|
Go to the source code of this file.
Classes | |
struct | audio_hal_codec_i2s_iface_t |
I2s interface configuration for audio codec chip. More... | |
struct | audio_hal_codec_config_t |
Configure media hal for initialization of audio codec chip. More... | |
struct | audio_hal |
Configuration of functions and variables used to operate audio codec chip. More... | |
Macros | |
#define | portTICK_PERIOD_MS 1 |
#define | portTICK_RATE_MS portTICK_PERIOD_MS |
#define | AUDIO_HAL_VOL_DEFAULT 20 |
#define | ets_printf KIT_LOGI |
Typedefs | |
typedef void * | xSemaphoreHandle |
typedef struct audio_hal * | audio_hal_handle_t |
typedef struct audio_hal | audio_hal_func_t |
Configuration of functions and variables used to operate audio codec chip. | |
Functions | |
audio_hal_handle_t | audio_hal_init (audio_hal_codec_config_t *audio_hal_conf, audio_hal_func_t *audio_hal_func) |
Initialize media codec driver. More... | |
esp_err_t | audio_hal_deinit (audio_hal_handle_t audio_hal) |
Uninitialize media codec driver. More... | |
esp_err_t | audio_hal_ctrl_codec (audio_hal_handle_t audio_hal, audio_hal_codec_mode_t mode, audio_hal_ctrl_t audio_hal_ctrl) |
Start/stop codec driver. More... | |
esp_err_t | audio_hal_codec_iface_config (audio_hal_handle_t audio_hal, audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface) |
Set codec I2S interface samples rate & bit width and format either I2S or PCM/DSP. More... | |
esp_err_t | audio_hal_set_mute (audio_hal_handle_t audio_hal, bool mute) |
Set voice mute. Enables or disables DAC mute of a codec. More... | |
esp_err_t | audio_hal_set_volume (audio_hal_handle_t audio_hal, int volume) |
Set voice volume. More... | |
esp_err_t | audio_hal_get_volume (audio_hal_handle_t audio_hal, int *volume) |
get voice volume. More... | |
struct audio_hal_codec_i2s_iface_t |
I2s interface configuration for audio codec chip.
Definition at line 143 of file audio_hal.h.
Class Members | ||
---|---|---|
audio_hal_iface_bits_t | bits |
i2s interface number of bits per sample |
audio_hal_iface_format_t | fmt |
I2S interface format |
audio_hal_iface_mode_t | mode |
audio codec chip mode |
audio_hal_iface_samples_t | samples |
I2S interface samples per second |
struct audio_hal_codec_config_t |
Configure media hal for initialization of audio codec chip.
Definition at line 153 of file audio_hal.h.
Class Members | ||
---|---|---|
audio_hal_adc_input_t | adc_input |
set adc channel |
audio_hal_codec_mode_t | codec_mode |
select codec mode: adc, dac or both |
audio_hal_dac_output_t | dac_output |
set dac channel |
audio_hal_codec_i2s_iface_t | i2s_iface |
set I2S interface configuration |
Select adc channel for input mic signal.
Definition at line 75 of file audio_hal.h.
Select media hal codec mode.
Enumerator | |
---|---|
AUDIO_HAL_CODEC_MODE_ENCODE | select adc |
AUDIO_HAL_CODEC_MODE_DECODE | select dac |
AUDIO_HAL_CODEC_MODE_BOTH | select both adc and dac |
AUDIO_HAL_CODEC_MODE_LINE_IN | set adc channel |
Definition at line 65 of file audio_hal.h.
enum audio_hal_ctrl_t |
Select operating mode i.e. start or stop for audio codec chip.
Enumerator | |
---|---|
AUDIO_HAL_CTRL_STOP | set stop mode |
AUDIO_HAL_CTRL_START | set start mode |
Definition at line 94 of file audio_hal.h.
Select channel for dac output.
Enumerator | |
---|---|
AUDIO_HAL_DAC_OUTPUT_LINE1 | dac output signal to channel 1 |
AUDIO_HAL_DAC_OUTPUT_LINE2 | dac output signal to channel 2 |
AUDIO_HAL_DAC_OUTPUT_ALL | dac output signal to both channels |
Definition at line 85 of file audio_hal.h.
Select I2S interface number of bits per sample.
Enumerator | |
---|---|
AUDIO_HAL_BIT_LENGTH_16BITS | set 16 bits per sample |
AUDIO_HAL_BIT_LENGTH_24BITS | set 24 bits per sample |
AUDIO_HAL_BIT_LENGTH_32BITS | set 32 bits per sample |
Definition at line 124 of file audio_hal.h.
Select I2S interface format for audio codec chip.
Enumerator | |
---|---|
AUDIO_HAL_I2S_NORMAL | set normal I2S format |
AUDIO_HAL_I2S_LEFT | set all left format |
AUDIO_HAL_I2S_RIGHT | set all right format |
AUDIO_HAL_I2S_DSP | set dsp/pcm format |
Definition at line 133 of file audio_hal.h.
Select I2S interface operating mode i.e. master or slave for audio codec chip.
Enumerator | |
---|---|
AUDIO_HAL_MODE_SLAVE | set slave mode |
AUDIO_HAL_MODE_MASTER | set master mode |
Definition at line 102 of file audio_hal.h.
Select I2S interface samples per second.
Definition at line 110 of file audio_hal.h.
esp_err_t audio_hal_codec_iface_config | ( | audio_hal_handle_t | audio_hal, |
audio_hal_codec_mode_t | mode, | ||
audio_hal_codec_i2s_iface_t * | iface | ||
) |
Set codec I2S interface samples rate & bit width and format either I2S or PCM/DSP.
audio_hal | reference function pointer for selected audio codec |
mode | select media hal codec mode either encode/decode/or both to start from audio_hal_codec_mode_t |
iface | I2S sample rate (ex: 16000, 44100), I2S bit width (16, 24, 32),I2s format (I2S, PCM, DSP). |
esp_err_t audio_hal_ctrl_codec | ( | audio_hal_handle_t | audio_hal, |
audio_hal_codec_mode_t | mode, | ||
audio_hal_ctrl_t | audio_hal_ctrl | ||
) |
Start/stop codec driver.
audio_hal | reference function pointer for selected audio codec |
mode | select media hal codec mode either encode/decode/or both to start from audio_hal_codec_mode_t |
audio_hal_ctrl | select start stop state for specific mode |
esp_err_t audio_hal_deinit | ( | audio_hal_handle_t | audio_hal | ) |
Uninitialize media codec driver.
audio_hal | reference function pointer for selected audio codec |
esp_err_t audio_hal_get_volume | ( | audio_hal_handle_t | audio_hal, |
int * | volume | ||
) |
get voice volume.
audio_hal | reference function pointer for selected audio codec |
volume | value of volume in percent returned(%) |
audio_hal_handle_t audio_hal_init | ( | audio_hal_codec_config_t * | audio_hal_conf, |
audio_hal_func_t * | audio_hal_func | ||
) |
Initialize media codec driver.
audio_hal_conf | Configure structure audio_hal_config_t |
audio_hal_func | Structure containing functions used to operate audio the codec chip |
esp_err_t audio_hal_set_mute | ( | audio_hal_handle_t | audio_hal, |
bool | mute | ||
) |
Set voice mute. Enables or disables DAC mute of a codec.
audio_hal_get_volume
will still give a non-zero number in mute state. It will be set to that number when speaker is unmuted.audio_hal | reference function pointer for selected audio codec |
mute | true/false. If true speaker will be muted and if false speaker will be unmuted. |
esp_err_t audio_hal_set_volume | ( | audio_hal_handle_t | audio_hal, |
int | volume | ||
) |
Set voice volume.
audio_hal | reference function pointer for selected audio codec |
volume | value of volume in percent(%) |