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_modem.c | |
parent | 404b1628d381cfff1bb737c5bc08b0fc5a3b74fe (diff) |
cell fixed; cell voice test passed
Diffstat (limited to 'code/esp32/components/eos/cell_modem.c')
-rw-r--r-- | code/esp32/components/eos/cell_modem.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/code/esp32/components/eos/cell_modem.c b/code/esp32/components/eos/cell_modem.c index 2534eb1..af27093 100644 --- a/code/esp32/components/eos/cell_modem.c +++ b/code/esp32/components/eos/cell_modem.c @@ -22,18 +22,12 @@ #define UART_GPIO_DTR 32 #define UART_GPIO_RI 35 - -#define UART_EVENT_MODE_NONE 0 -#define UART_EVENT_MODE_PPP 1 -#define UART_EVENT_MODE_RELAY 2 - static QueueHandle_t uart_queue; -// static uint8_t *uart_data[UART_BUF_SIZE]; static const char *TAG = "EOS MODEM"; static void uart_event_task(void *pvParameters) { - char mode = 0; + char mode = EOS_CELL_UART_MODE_RELAY; uart_event_t event; size_t len; unsigned char *buf; @@ -47,10 +41,10 @@ static void uart_event_task(void *pvParameters) { /* Event of UART receiving data */ switch (mode) { - case UART_EVENT_MODE_PPP: + case EOS_CELL_UART_MODE_PPP: break; - case UART_EVENT_MODE_RELAY: + case EOS_CELL_UART_MODE_RELAY: buf = eos_net_alloc(); buf[0] = EOS_CELL_MTYPE_DATA; len = uart_read_bytes(UART_NUM_2, buf+1, MIN(event.size, EOS_NET_SIZE_BUF-1), 100 / portTICK_RATE_MS); @@ -76,22 +70,6 @@ static void uart_event_task(void *pvParameters) { vTaskDelete(NULL); } -static void modem_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(UART_EVENT_MODE_RELAY); - break; - case EOS_CELL_MTYPE_DATA_STOP: - eos_modem_set_mode(0); - break; - } -} - void eos_modem_init(void) { /* Configure parameters of an UART driver, * communication pins and install the driver */ @@ -117,8 +95,6 @@ void eos_modem_init(void) { // Create a task to handle uart event from ISR xTaskCreate(uart_event_task, "uart_event", EOS_TASK_SSIZE_UART, NULL, EOS_TASK_PRIORITY_UART, NULL); - - eos_net_set_handler(EOS_NET_MTYPE_CELL, modem_handler); ESP_LOGI(TAG, "INIT"); } @@ -128,6 +104,7 @@ ssize_t eos_modem_write(void *data, size_t size) { void eos_modem_set_mode(char mode) { uart_event_t evt; + evt.type = UART_EVENT_MAX; /* my type */ evt.size = mode; xQueueSend(uart_queue, (void *)&evt, portMAX_DELAY); |