diff --git a/examples/cpp_01_tasks/main.cpp b/examples/cpp_01_tasks/main.cpp index 219be74..1295327 100644 --- a/examples/cpp_01_tasks/main.cpp +++ b/examples/cpp_01_tasks/main.cpp @@ -95,9 +95,9 @@ esp_open_rtos::thread::queue_t MyQueue; */ extern "C" void user_init(void) { - sdk_uart_div_modify(0, UART_CLK_FREQ / 115200); + sdk_uart_div_modify(0, UART_CLK_FREQ / 115200); - MyQueue.create(10); + MyQueue.queue_create(10); task_1.queue = MyQueue; task_2.queue = MyQueue; diff --git a/extras/cpp_support/include/mutex.hpp b/extras/cpp_support/include/mutex.hpp index 714c585..aaf29db 100644 --- a/extras/cpp_support/include/mutex.hpp +++ b/extras/cpp_support/include/mutex.hpp @@ -46,14 +46,30 @@ public: */ inline mutex_t() { - mutex = xSemaphoreCreateMutex(); + mutex = 0; + } + /** + * + * @return + */ + inline int mutex_create() + { + mutex = xSemaphoreCreateMutex(); + + if(mutex == NULL) { + return -1; + } + else { + return 0; + } } /** * */ - inline ~mutex_t() + inline void mutex_destroy() { vQueueDelete(mutex); + mutex = 0; } /** * diff --git a/extras/cpp_support/include/queue.hpp b/extras/cpp_support/include/queue.hpp index a24f302..047ce29 100644 --- a/extras/cpp_support/include/queue.hpp +++ b/extras/cpp_support/include/queue.hpp @@ -56,7 +56,7 @@ public: * @param uxItemSize * @return */ - inline int create(unsigned portBASE_TYPE uxQueueLength) + inline int queue_create(unsigned portBASE_TYPE uxQueueLength) { queue = xQueueCreate(uxQueueLength, sizeof(Data)); @@ -69,11 +69,8 @@ public: } /** * - * @param data - * @param ms - * @return */ - inline void destroy() + inline void queue_destroy() { vQueueDelete(queue); queue = 0;