diff options
| author | Uros Majstorovic <majstor@majstor.org> | 2026-01-07 22:13:36 +0100 |
|---|---|---|
| committer | Uros Majstorovic <majstor@majstor.org> | 2026-01-07 22:13:36 +0100 |
| commit | 285ddd410a559449b7e2cbab9b2b10e850efbd08 (patch) | |
| tree | d6cfe1577675c3478444f0b82b7c5f56bd6b174f /fw/esp32/components/eos/cell_pcm.c | |
| parent | 2357302c5e0228c1209b747cc5e0b11d7bef0a02 (diff) | |
added APP <-> FE310 bridge SPI messages; enabled esp32 wake from deep sleep; IP tunnel for app module supports NAT and port forwadring; introduced EOSMessage struct for SPI messages;
Diffstat (limited to 'fw/esp32/components/eos/cell_pcm.c')
| -rw-r--r-- | fw/esp32/components/eos/cell_pcm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fw/esp32/components/eos/cell_pcm.c b/fw/esp32/components/eos/cell_pcm.c index 3f5089d..67a3a08 100644 --- a/fw/esp32/components/eos/cell_pcm.c +++ b/fw/esp32/components/eos/cell_pcm.c @@ -23,16 +23,20 @@ static i2s_chan_handle_t rx_chan; static const char *TAG = "EOS CELL PCM"; static void pcm_rcvr_task(void *pvParameters) { - unsigned char *buffer; + EOSMessage msg; size_t size_r; esp_err_t ret; int done = 0; int rv; while (!done) { - buffer = eos_net_alloc(); - buffer[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM; - ret = i2s_channel_read(rx_chan, buffer + 1, PCM_RX_WM, &size_r, 1000); + eos_net_alloc(&msg); + if (msg.size < PCM_RX_WM + 1) { + eos_net_free(&msg); + return; + } + msg.buffer[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_PCM; + ret = i2s_channel_read(rx_chan, msg.buffer + 1, PCM_RX_WM, &size_r, 1000); switch (ret) { case ESP_OK: { assert(size_r == PCM_RX_WM); @@ -51,10 +55,10 @@ static void pcm_rcvr_task(void *pvParameters) { } } if (ret == ESP_OK) { - rv = eos_net_send(EOS_NET_MTYPE_CELL, buffer, size_r + 1); + rv = eos_net_send(EOS_NET_MTYPE_CELL, &msg, size_r + 1); if (rv) ESP_LOGE(TAG, "NET SEND ERR:%d", rv); } else { - eos_net_free(buffer); + eos_net_free(&msg); } } vTaskDelete(NULL); |
