From a22f03446276baabc0cf7d2a7cd5c9b927436ee8 Mon Sep 17 00:00:00 2001 From: dario Date: Wed, 7 Feb 2024 19:12:35 +0100 Subject: [PATCH] Added specification of stack and control block size for RtosThread --- include/sta/rtos/thread.hpp | 4 +++- src/thread.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sta/rtos/thread.hpp b/include/sta/rtos/thread.hpp index 5b20a00..d4fa342 100644 --- a/include/sta/rtos/thread.hpp +++ b/include/sta/rtos/thread.hpp @@ -77,8 +77,10 @@ namespace sta * * @param name The thread's name. Will be used for debugging. * @param prio The thread's priority. + * @param stack_size The thread's stack size. Default of 0 refers to the RTOS2 default stack size specified in the IOC. + * @param cb_size The thread's control block size. Default of 0 refers to the RTOS2 default control block size specified in the IOC. */ - RtosThread(const char* name, osPriority_t prio); + RtosThread(const char* name, osPriority_t prio, uint32_t stack_size = 0, uint32_t cb_size = 0); /** * @brief Get the currently running instance. diff --git a/src/thread.cpp b/src/thread.cpp index 7004578..247962d 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -7,9 +7,9 @@ namespace sta { - RtosThread::RtosThread(const char* name, osPriority_t prio) + RtosThread::RtosThread(const char* name, osPriority_t prio, uint32_t stack_size /* = 0 */, uint32_t cb_size /* = 0 */) : instance_{NULL}, - attribs_{ .name = name, .priority = prio } + attribs_{ .name = name, .cb_size = cb_size, .stack_size = stack_size, .priority = prio } {} osThreadId_t RtosThread::getInstance()