diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-12-08 17:47:58 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-12-08 17:47:58 +0100 |
commit | 602d0d803eb9607dcd949f3ea5ff27c14db4085b (patch) | |
tree | d48d217a9a596a757a7e5fc6b4ee46a33dc7ab04 /code/esp32/components/eos/cell_pcm.c | |
parent | 078898fb69ec692e8a051746f423ad3171ff4d7c (diff) |
fixed uart data relay bug; fixed all xCreateTask to use new macros for stack size; fixed err type for msgq;
Diffstat (limited to 'code/esp32/components/eos/cell_pcm.c')
-rw-r--r-- | code/esp32/components/eos/cell_pcm.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/code/esp32/components/eos/cell_pcm.c b/code/esp32/components/eos/cell_pcm.c index 0c9dfc9..961a322 100644 --- a/code/esp32/components/eos/cell_pcm.c +++ b/code/esp32/components/eos/cell_pcm.c @@ -5,6 +5,7 @@ #include <freertos/task.h> #include <freertos/queue.h> #include <driver/i2s.h> +#include <driver/gpio.h> #include <esp_log.h> #include "eos.h" @@ -22,6 +23,8 @@ static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0, &I2S1}; static QueueHandle_t i2s_queue; +static const char *TAG = "EOS PCM"; + static void i2s_event_task(void *pvParameters) { size_t size_out; i2s_event_t event; @@ -54,7 +57,7 @@ static void i2s_event_task(void *pvParameters) { i2s_write(I2S_NUM_0, (const void *)data, BUF_SIZE, &size_out, 1000 / portTICK_RATE_MS); break; case I2S_EVENT_DMA_ERROR: - printf("*** I2S DMA ERROR ***"); + ESP_LOGE(TAG, "*** I2S DMA ERROR ***"); break; default: break; @@ -108,15 +111,18 @@ void eos_pcm_init(void) { .data_out_num = PCM_GPIO_DOUT }; i2s_driver_install(I2S_NUM_0, &i2s_config, 10, &i2s_queue); //install and start i2s driver - i2s_set_pin(I2S_NUM_0, &pin_config); i2s_stop(I2S_NUM_0); + i2s_set_pin(I2S_NUM_0, &pin_config); + gpio_matrix_in(pin_config.ws_io_num, I2S0I_WS_IN_IDX, 1); + gpio_matrix_in(pin_config.bck_io_num, I2S0I_BCK_IN_IDX, 1); I2S[I2S_NUM_0]->conf.tx_mono = 1; I2S[I2S_NUM_0]->conf.rx_mono = 1; - i2s_start(I2S_NUM_0); // Create a task to handle i2s event from ISR - xTaskCreate(i2s_event_task, "i2s_event_task", 2048, NULL, EOS_IRQ_PRIORITY_I2S, NULL); - // xTaskCreate(i2s_write_task, "i2s_write_task", 2048, NULL, EOS_IRQ_PRIORITY_I2S, NULL); + xTaskCreate(i2s_event_task, "i2s_event", EOS_TASK_SSIZE_I2S, NULL, EOS_TASK_PRIORITY_I2S, NULL); + // xTaskCreate(i2s_write_task, "i2s_write_task", EOS_TASK_SSIZE_I2S, NULL, EOS_TASK_PRIORITY_I2S, NULL); + ESP_LOGI(TAG, "INIT"); + i2s_start(I2S_NUM_0); } ssize_t eos_pcm_write(void *data, size_t size) { |