From d8ed9be1d4d4d97900ea1054bdab0db0eda65c92 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Thu, 23 Apr 2020 16:34:13 -0300 Subject: [PATCH] freertos/timer: fix the static timer creation Removes the not used spinlock field inside timer object which was causing assertion fail --- components/freertos/include/freertos/FreeRTOS.h | 3 --- components/freertos/test/test_timers.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/freertos/include/freertos/FreeRTOS.h b/components/freertos/include/freertos/FreeRTOS.h index 1dd8e69d79..bd241abf26 100644 --- a/components/freertos/include/freertos/FreeRTOS.h +++ b/components/freertos/include/freertos/FreeRTOS.h @@ -1274,9 +1274,6 @@ typedef struct xSTATIC_TIMER UBaseType_t uxDummy7; #endif uint8_t ucDummy8; - - portMUX_TYPE xDummy9; - } StaticTimer_t; /* diff --git a/components/freertos/test/test_timers.c b/components/freertos/test/test_timers.c index a46cd846d8..7d0af71710 100644 --- a/components/freertos/test/test_timers.c +++ b/components/freertos/test/test_timers.c @@ -68,3 +68,20 @@ TEST_CASE("Recurring FreeRTOS timers", "[freertos]") TEST_ASSERT( xTimerDelete(recurring, 1) ); } + +#ifdef CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION +TEST_CASE("Static timer creation", "[freertos]") +{ + StaticTimer_t static_timer; + TimerHandle_t created_timer; + volatile int count = 0; + + created_timer = xTimerCreateStatic("oneshot", 100 / portTICK_PERIOD_MS, + pdTRUE, + (void *)&count, + timer_callback, + &static_timer); + + TEST_ASSERT_NOT_NULL(created_timer); +} +#endif \ No newline at end of file