summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/cell_pcm.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-09-04 18:43:50 +0200
committerUros Majstorovic <majstor@majstor.org>2022-09-04 18:43:50 +0200
commit6a4b3ef0e72ee134b81a523ce41fd4c45f3b4429 (patch)
treec4cb9b524711238b162511f515d484df4052e3ab /fw/esp32/components/eos/cell_pcm.c
parent03ec4d6158bd3c555b6c60b9e7476740464f19fa (diff)
fixed wifi and cell
Diffstat (limited to 'fw/esp32/components/eos/cell_pcm.c')
-rw-r--r--fw/esp32/components/eos/cell_pcm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fw/esp32/components/eos/cell_pcm.c b/fw/esp32/components/eos/cell_pcm.c
index 57258c9..0648be7 100644
--- a/fw/esp32/components/eos/cell_pcm.c
+++ b/fw/esp32/components/eos/cell_pcm.c
@@ -44,11 +44,6 @@ static const char *TAG = "EOS PCM";
static void i2s_event_task(void *pvParameters) {
i2s_event_t event;
- unsigned char *buf;
- unsigned char _type;
- size_t bytes_w;
- ssize_t bytes_r;
- uint16_t bytes_e;
ssize_t hold_bytes_r = 0;
unsigned char *hold_buf = NULL;
char hold_cnt = 0;
@@ -57,9 +52,16 @@ static void i2s_event_task(void *pvParameters) {
// Waiting for I2S event.
if (xQueueReceive(i2s_queue, &event, portMAX_DELAY)) {
switch (event.type) {
- case I2S_EVENT_RX_DONE:
+ case I2S_EVENT_RX_DONE: {
+ ssize_t bytes_r;
+ size_t bytes_w;
+ uint16_t bytes_e;
+ unsigned char _type;
+ unsigned char *buf;
+
// Event of I2S receiving data
if (!hold_cnt) {
+
buf = eos_net_alloc();
buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM;
bytes_r = eos_cell_pcm_read(buf + 1, PCM_MIC_WM);
@@ -91,14 +93,17 @@ static void i2s_event_task(void *pvParameters) {
xSemaphoreGive(mutex);
}
break;
+ }
- case I2S_EVENT_DMA_ERROR:
+ case I2S_EVENT_DMA_ERROR: {
ESP_LOGE(TAG, "*** I2S DMA ERROR ***");
break;
+ }
- case I2S_EVENT_MAX:
+ case I2S_EVENT_MAX: {
hold_cnt = PCM_HOLD_CNT_RX;
break;
+ }
default:
break;