diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-12-11 03:50:14 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-12-11 03:50:14 +0100 |
commit | 9804469a30a877a830e115361b0b78859eaa4d67 (patch) | |
tree | 8ec8daf0ae5120c4efbacbf6c438f6932ce3f14a /code/esp32/components/eos/cell.c | |
parent | 404b1628d381cfff1bb737c5bc08b0fc5a3b74fe (diff) |
cell fixed; cell voice test passed
Diffstat (limited to 'code/esp32/components/eos/cell.c')
-rw-r--r-- | code/esp32/components/eos/cell.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/code/esp32/components/eos/cell.c b/code/esp32/components/eos/cell.c new file mode 100644 index 0000000..49ddeda --- /dev/null +++ b/code/esp32/components/eos/cell.c @@ -0,0 +1,40 @@ +#include <stdlib.h> +#include <stdint.h> + +#include <esp_log.h> + +#include "eos.h" +#include "net.h" +#include "cell.h" + +static void cell_handler(unsigned char _mtype, unsigned char *buffer, uint16_t size) { + uint8_t mtype = buffer[0]; + + switch (mtype) { + case EOS_CELL_MTYPE_DATA: + eos_modem_write(buffer+1, size-1); + break; + case EOS_CELL_MTYPE_DATA_START: + eos_modem_set_mode(EOS_CELL_UART_MODE_RELAY); + break; + case EOS_CELL_MTYPE_DATA_STOP: + eos_modem_set_mode(0); + break; + case EOS_CELL_MTYPE_AUDIO: + eos_pcm_push(buffer+1, size-1); + break; + case EOS_CELL_MTYPE_AUDIO_START: + eos_pcm_start(); + break; + case EOS_CELL_MTYPE_AUDIO_STOP: + eos_pcm_stop(); + break; + } +} + +void eos_cell_init(void) { + eos_pcm_init(); + eos_modem_init(); + eos_net_set_handler(EOS_NET_MTYPE_CELL, cell_handler); +} + |