From e9421616b08c611bc8a0564ad7aafc1242a3ebd1 Mon Sep 17 00:00:00 2001 From: Matt Kelly Date: Tue, 21 Feb 2017 23:32:56 -0500 Subject: [PATCH] esp32: Use time_ms instead of ticks --- port/esp32/main/btstack_config.h | 2 +- port/esp32/main/component.mk | 2 -- port/esp32/main/hal_tick.c | 28 ---------------------------- port/esp32/main/hal_time_ms.c | 8 ++++++++ 4 files changed, 9 insertions(+), 31 deletions(-) delete mode 100644 port/esp32/main/hal_tick.c create mode 100644 port/esp32/main/hal_time_ms.c diff --git a/port/esp32/main/btstack_config.h b/port/esp32/main/btstack_config.h index e4a5312eb..756557aa6 100644 --- a/port/esp32/main/btstack_config.h +++ b/port/esp32/main/btstack_config.h @@ -6,7 +6,7 @@ #define __BTSTACK_CONFIG // Port related features -#define HAVE_EMBEDDED_TICK +#define HAVE_EMBEDDED_TIME_MS #define HAVE_MALLOC // BTstack features that can be enabled diff --git a/port/esp32/main/component.mk b/port/esp32/main/component.mk index e34ca5769..87113e078 100644 --- a/port/esp32/main/component.mk +++ b/port/esp32/main/component.mk @@ -11,8 +11,6 @@ BTSTACK_ROOT := ../../.. # Examples #include ${BTSTACK_ROOT}/example/Makefile.inc -#COMPONENT_ADD_LDFLAGS := -l$(COMPONENT_NAME) $(COMPONENT_PATH)/../components/libbtdm_app/libbtdm_app.a $(COMPONENT_PATH)/../components/libcoexist/libcoexist.a $(COMPONENT_PATH)/../components/libphy/libphy.a - COMPONENT_ADD_INCLUDEDIRS := $(BTSTACK_ROOT)/src/ble $(BTSTACK_ROOT)/src $(BTSTACK_ROOT)/platform/embedded . COMPONENT_SRCDIRS := $(BTSTACK_ROOT)/src/ble $(BTSTACK_ROOT)/src/ $(BTSTACK_ROOT)/platform/embedded . diff --git a/port/esp32/main/hal_tick.c b/port/esp32/main/hal_tick.c deleted file mode 100644 index 11cb82ed1..000000000 --- a/port/esp32/main/hal_tick.c +++ /dev/null @@ -1,28 +0,0 @@ -#include "hal_tick.h" - -#include -#include - -#include "freertos/FreeRTOS.h" - -static void dummy_handler(void){}; - -static void (*tick_handler)(void) = &dummy_handler; - -void hal_tick_init(void){ - printf("hal_tick_init\n"); -} - -void hal_tick_set_handler(void (*handler)(void)){ - printf("hal_tick_set_handler\n"); - if (handler == NULL){ - tick_handler = &dummy_handler; - return; - } - tick_handler = handler; -} - -int hal_tick_get_tick_period_in_ms(void){ - printf("hal_tick_get_tick_period_in_ms\n"); - return portTICK_PERIOD_MS; -} diff --git a/port/esp32/main/hal_time_ms.c b/port/esp32/main/hal_time_ms.c new file mode 100644 index 000000000..d56e0661d --- /dev/null +++ b/port/esp32/main/hal_time_ms.c @@ -0,0 +1,8 @@ +#include "hal_time_ms.h" + +uint32_t esp_log_timestamp(); + +uint32_t hal_time_ms(void) { + // super hacky way to get ms + return esp_log_timestamp(); +}