From 9804469a30a877a830e115361b0b78859eaa4d67 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 11 Dec 2019 03:50:14 +0100 Subject: cell fixed; cell voice test passed --- code/esp32/components/eos/cell_modem.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'code/esp32/components/eos/cell_modem.c') 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); -- cgit v1.2.3