From 2ec1bab5d5f153172163ac6a2e585eb9a4a66f36 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 10 Aug 2016 10:36:03 -0700 Subject: [PATCH] Plumb BasebandThread to accept direction argument. Default is to receive, for compatibility with existing users. --- firmware/baseband/baseband_thread.cpp | 6 ++++-- firmware/baseband/baseband_thread.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/baseband/baseband_thread.cpp b/firmware/baseband/baseband_thread.cpp index 926e4fb0..3f683a59 100644 --- a/firmware/baseband/baseband_thread.cpp +++ b/firmware/baseband/baseband_thread.cpp @@ -44,9 +44,11 @@ Thread* BasebandThread::thread = nullptr; BasebandThread::BasebandThread( uint32_t sampling_rate, BasebandProcessor* const baseband_processor, - const tprio_t priority + const tprio_t priority, + baseband::Direction direction ) : baseband_processor { baseband_processor }, - sampling_rate { sampling_rate } + sampling_rate { sampling_rate }, + _direction { direction } { thread = chThdCreateStatic(baseband_thread_wa, sizeof(baseband_thread_wa), priority, ThreadBase::fn, diff --git a/firmware/baseband/baseband_thread.hpp b/firmware/baseband/baseband_thread.hpp index 3263b4f1..4d06e326 100644 --- a/firmware/baseband/baseband_thread.hpp +++ b/firmware/baseband/baseband_thread.hpp @@ -33,20 +33,22 @@ public: BasebandThread( uint32_t sampling_rate, BasebandProcessor* const baseband_processor, - const tprio_t priority + const tprio_t priority, + const baseband::Direction direction = baseband::Direction::Receive ); ~BasebandThread(); // This getter should die, it's just here to leak information to code that // isn't in the right place to begin with. baseband::Direction direction() const { - return baseband::Direction::Receive; + return _direction; } private: static Thread* thread; BasebandProcessor* baseband_processor { nullptr }; + baseband::Direction _direction; uint32_t sampling_rate; void run() override;