From f83b56156653ae79f9551a74da53aa2b5faca462 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 14 Sep 2023 21:05:58 +1000 Subject: [PATCH] AP_HAL_SITL: guard against DSP being compiled out of code --- libraries/AP_HAL_SITL/DSP.cpp | 4 ++++ libraries/AP_HAL_SITL/DSP.h | 5 +++++ libraries/AP_HAL_SITL/HAL_SITL_Class.cpp | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/libraries/AP_HAL_SITL/DSP.cpp b/libraries/AP_HAL_SITL/DSP.cpp index c67223bfe7..2bb4d8131a 100644 --- a/libraries/AP_HAL_SITL/DSP.cpp +++ b/libraries/AP_HAL_SITL/DSP.cpp @@ -17,6 +17,8 @@ #include +#if HAL_WITH_DSP + #include "AP_HAL_SITL.h" #include #include @@ -209,3 +211,5 @@ void DSP::calculate_fft(complexf *samples, uint16_t fftlen) istep <<= 1; } } + +#endif diff --git a/libraries/AP_HAL_SITL/DSP.h b/libraries/AP_HAL_SITL/DSP.h index 9813fe4bfe..c8acab8ed4 100644 --- a/libraries/AP_HAL_SITL/DSP.h +++ b/libraries/AP_HAL_SITL/DSP.h @@ -17,6 +17,9 @@ #pragma once #include + +#if HAL_WITH_DSP + #include "AP_HAL_SITL.h" #include @@ -55,3 +58,5 @@ private: void vector_add_float(const float* vin1, const float* vin2, float* vout, uint16_t len) const override; void calculate_fft(complexf* f, uint16_t length); }; + +#endif diff --git a/libraries/AP_HAL_SITL/HAL_SITL_Class.cpp b/libraries/AP_HAL_SITL/HAL_SITL_Class.cpp index 0d79624ee6..88b19026f7 100644 --- a/libraries/AP_HAL_SITL/HAL_SITL_Class.cpp +++ b/libraries/AP_HAL_SITL/HAL_SITL_Class.cpp @@ -46,7 +46,9 @@ static Empty::RCInput sitlRCInput; static RCOutput sitlRCOutput(&sitlState); static GPIO sitlGPIO(&sitlState); static AnalogIn sitlAnalogIn(&sitlState); +#if HAL_WITH_DSP static DSP dspDriver; +#endif // use the Empty HAL for hardware we don't emulate @@ -104,7 +106,9 @@ HAL_SITL::HAL_SITL() : &utilInstance, /* util */ &emptyOpticalFlow, /* onboard optical flow */ &emptyFlash, /* flash driver */ +#if HAL_WITH_DSP &dspDriver, /* dsp driver */ +#endif #if HAL_NUM_CAN_IFACES (AP_HAL::CANIface**)canDrivers #else