From ccb85c27075a07856065c0e1d2365cde57cd5456 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Jan 2018 10:54:37 +1100 Subject: [PATCH] HAL_ChibiOS: fixed fmuv3 build with no ICU --- libraries/AP_HAL_ChibiOS/RCInput.cpp | 2 +- libraries/AP_HAL_ChibiOS/RCInput.h | 2 +- libraries/AP_HAL_ChibiOS/SoftSigReader.cpp | 3 +++ libraries/AP_HAL_ChibiOS/SoftSigReader.h | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/RCInput.cpp b/libraries/AP_HAL_ChibiOS/RCInput.cpp index e36f70cb24..72c5c426d9 100644 --- a/libraries/AP_HAL_ChibiOS/RCInput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCInput.cpp @@ -214,7 +214,7 @@ void RCInput::_timer_tick(void) bool RCInput::rc_bind(int dsmMode) { -#if HAL_RCINPUT_WITH_AP_RADIO +#ifdef HAL_RCINPUT_WITH_AP_RADIO if (radio) { radio->start_recv_bind(); } diff --git a/libraries/AP_HAL_ChibiOS/RCInput.h b/libraries/AP_HAL_ChibiOS/RCInput.h index 338a5607db..c80e008df5 100644 --- a/libraries/AP_HAL_ChibiOS/RCInput.h +++ b/libraries/AP_HAL_ChibiOS/RCInput.h @@ -69,7 +69,7 @@ private: uint32_t last_radio_us; #endif -#ifdef HAL_USE_ICU +#if HAL_USE_ICU == TRUE ChibiOS::SoftSigReader sig_reader; AP_RCProtocol rcin_prot; #endif diff --git a/libraries/AP_HAL_ChibiOS/SoftSigReader.cpp b/libraries/AP_HAL_ChibiOS/SoftSigReader.cpp index 82a0aea47a..09c980a156 100644 --- a/libraries/AP_HAL_ChibiOS/SoftSigReader.cpp +++ b/libraries/AP_HAL_ChibiOS/SoftSigReader.cpp @@ -22,6 +22,8 @@ using namespace ChibiOS; extern const AP_HAL::HAL& hal; +#if HAL_USE_ICU == TRUE + bool SoftSigReader::attach_capture_timer(ICUDriver* icu_drv, icuchannel_t chan, uint8_t dma_stream, uint32_t dma_channel) { if (chan > ICU_CHANNEL_2) { @@ -115,5 +117,6 @@ bool SoftSigReader::set_bounce_buf_size(uint16_t buf_size) return true; } +#endif // HAL_USE_ICU #endif //CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS diff --git a/libraries/AP_HAL_ChibiOS/SoftSigReader.h b/libraries/AP_HAL_ChibiOS/SoftSigReader.h index c28fe51e12..38788904b6 100644 --- a/libraries/AP_HAL_ChibiOS/SoftSigReader.h +++ b/libraries/AP_HAL_ChibiOS/SoftSigReader.h @@ -20,6 +20,8 @@ #include "AP_HAL_ChibiOS.h" +#if HAL_USE_ICU == TRUE + #define INPUT_CAPTURE_FREQUENCY 1000000 //capture unit in microseconds #define MAX_SIGNAL_TRANSITIONS 256 #define DEFAULT_BOUNCE_BUF_SIZE 32 @@ -41,3 +43,6 @@ private: ICUConfig icucfg; uint16_t _bounce_buf_size = DEFAULT_BOUNCE_BUF_SIZE; }; + +#endif // HAL_USE_ICU +