From 211d1d19ea7ea83ddf1b1792472bdc83c8bc0ef5 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 10 Dec 2015 21:01:44 -0800 Subject: [PATCH] Move Thread WORKING_AREAs out of classes. Limited where and how you could instantiate the classes. --- firmware/baseband/baseband_thread.cpp | 4 +++- firmware/baseband/baseband_thread.hpp | 2 -- firmware/baseband/main.cpp | 5 ++--- firmware/baseband/rssi_thread.cpp | 4 +++- firmware/baseband/rssi_thread.hpp | 2 -- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/firmware/baseband/baseband_thread.cpp b/firmware/baseband/baseband_thread.cpp index f654bda73..606d09254 100644 --- a/firmware/baseband/baseband_thread.cpp +++ b/firmware/baseband/baseband_thread.cpp @@ -42,8 +42,10 @@ #include +WORKING_AREA(baseband_thread_wa, 2048); + Thread* BasebandThread::start(const tprio_t priority) { - return chThdCreateStatic(wa, sizeof(wa), + return chThdCreateStatic(baseband_thread_wa, sizeof(baseband_thread_wa), priority, ThreadBase::fn, this ); diff --git a/firmware/baseband/baseband_thread.hpp b/firmware/baseband/baseband_thread.hpp index f21d53ee9..e19882346 100644 --- a/firmware/baseband/baseband_thread.hpp +++ b/firmware/baseband/baseband_thread.hpp @@ -50,8 +50,6 @@ public: BasebandProcessor* baseband_processor { nullptr }; private: - WORKING_AREA(wa, 2048); - BasebandConfiguration baseband_configuration; void run() override; diff --git a/firmware/baseband/main.cpp b/firmware/baseband/main.cpp index cb0cb3656..6705f8af7 100755 --- a/firmware/baseband/main.cpp +++ b/firmware/baseband/main.cpp @@ -74,9 +74,6 @@ void __late_init(void) { } -static BasebandThread baseband_thread; -static RSSIThread rssi_thread; - static void init() { i2s::i2s0::configure( audio::i2s0_config_tx, @@ -163,6 +160,8 @@ public: private: MessageHandlerMap message_map; + BasebandThread baseband_thread; + RSSIThread rssi_thread; bool is_running = true; diff --git a/firmware/baseband/rssi_thread.cpp b/firmware/baseband/rssi_thread.cpp index d7b5f99ca..0bf153342 100644 --- a/firmware/baseband/rssi_thread.cpp +++ b/firmware/baseband/rssi_thread.cpp @@ -28,8 +28,10 @@ #include "message.hpp" #include "portapack_shared_memory.hpp" +WORKING_AREA(rssi_thread_wa, 128); + Thread* RSSIThread::start(const tprio_t priority) { - return chThdCreateStatic(wa, sizeof(wa), + return chThdCreateStatic(rssi_thread_wa, sizeof(rssi_thread_wa), priority, ThreadBase::fn, this ); diff --git a/firmware/baseband/rssi_thread.hpp b/firmware/baseband/rssi_thread.hpp index f3fde10ae..0a00ef8e9 100644 --- a/firmware/baseband/rssi_thread.hpp +++ b/firmware/baseband/rssi_thread.hpp @@ -38,8 +38,6 @@ public: Thread* start(const tprio_t priority); private: - WORKING_AREA(wa, 128); - void run() override; const uint32_t sampling_rate { 400000 };