|
|
|
@ -9,6 +9,7 @@
@@ -9,6 +9,7 @@
|
|
|
|
|
#include <zephyr/sys/printk.h> |
|
|
|
|
#include <zephyr/drivers/i2s.h> |
|
|
|
|
#include <zephyr/drivers/gpio.h> |
|
|
|
|
#include <zephyr/audio/codec.h> |
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -40,7 +41,7 @@ static struct gpio_dt_spec sw1_spec = GPIO_DT_SPEC_GET(SW1_NODE, gpios);
@@ -40,7 +41,7 @@ static struct gpio_dt_spec sw1_spec = GPIO_DT_SPEC_GET(SW1_NODE, gpios);
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define BLOCK_SIZE (BYTES_PER_SAMPLE * SAMPLES_PER_BLOCK) |
|
|
|
|
#define BLOCK_COUNT (INITIAL_BLOCKS + 2) |
|
|
|
|
#define BLOCK_COUNT (INITIAL_BLOCKS + 4) |
|
|
|
|
K_MEM_SLAB_DEFINE_STATIC(mem_slab, BLOCK_SIZE, BLOCK_COUNT, 4); |
|
|
|
|
|
|
|
|
|
static int16_t echo_block[SAMPLES_PER_BLOCK]; |
|
|
|
@ -256,6 +257,23 @@ int main(void)
@@ -256,6 +257,23 @@ int main(void)
|
|
|
|
|
if (!init_wm8731_i2c()) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
const struct device *const codec_dev = DEVICE_DT_GET(DT_NODELABEL(audio_codec)); |
|
|
|
|
struct audio_codec_cfg audio_cfg; |
|
|
|
|
|
|
|
|
|
audio_cfg.dai_route = AUDIO_ROUTE_PLAYBACK_CAPTURE; |
|
|
|
|
audio_cfg.dai_type = AUDIO_DAI_TYPE_I2S; |
|
|
|
|
audio_cfg.dai_cfg.i2s.word_size = SAMPLE_BIT_WIDTH; |
|
|
|
|
audio_cfg.dai_cfg.i2s.channels = NUMBER_OF_CHANNELS; |
|
|
|
|
audio_cfg.dai_cfg.i2s.format = I2S_FMT_DATA_FORMAT_I2S; |
|
|
|
|
audio_cfg.dai_cfg.i2s.options = I2S_OPT_FRAME_CLK_MASTER; |
|
|
|
|
audio_cfg.dai_cfg.i2s.frame_clk_freq = SAMPLE_FREQUENCY; |
|
|
|
|
audio_cfg.dai_cfg.i2s.mem_slab = &mem_slab; |
|
|
|
|
audio_cfg.dai_cfg.i2s.block_size = BLOCK_SIZE; |
|
|
|
|
audio_codec_configure(codec_dev, &audio_cfg); |
|
|
|
|
k_msleep(1000); |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (!init_buttons()) { |
|
|
|
|