From 7c96522e44dafcfc22e03123e40ce9398b63ca2f Mon Sep 17 00:00:00 2001 From: Iampete1 Date: Fri, 5 Feb 2021 13:18:04 +0000 Subject: [PATCH] AP_HAL_ChibiOS: add semaphore to AnalogIn::channel to make it thread safe --- libraries/AP_HAL_ChibiOS/AnalogIn.cpp | 1 + libraries/AP_HAL_ChibiOS/AnalogIn.h | 1 + 2 files changed, 2 insertions(+) diff --git a/libraries/AP_HAL_ChibiOS/AnalogIn.cpp b/libraries/AP_HAL_ChibiOS/AnalogIn.cpp index c4ce8e1595..a8031c74a2 100644 --- a/libraries/AP_HAL_ChibiOS/AnalogIn.cpp +++ b/libraries/AP_HAL_ChibiOS/AnalogIn.cpp @@ -357,6 +357,7 @@ void AnalogIn::_timer_tick(void) AP_HAL::AnalogSource* AnalogIn::channel(int16_t pin) { + WITH_SEMAPHORE(_semaphore); for (uint8_t j=0; j