HAL_ChibiOS: check for ChibiOS features

This commit is contained in:
Andrew Tridgell 2018-03-29 13:07:50 +11:00
parent 03f67d82c9
commit c12d14d7a4
4 changed files with 13 additions and 0 deletions

View File

@ -89,6 +89,7 @@ void DeviceBus::bus_thread(void *arg)
return;
}
#if CH_CFG_USE_HEAP == TRUE
AP_HAL::Device::PeriodicHandle DeviceBus::register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb, AP_HAL::Device *_hal_device)
{
if (!thread_started) {
@ -133,6 +134,7 @@ AP_HAL::Device::PeriodicHandle DeviceBus::register_periodic_callback(uint32_t pe
return callback;
}
#endif // CH_CFG_USE_HEAP
/*
* Adjust the timer for the next call: it needs to be called from the bus

View File

@ -31,6 +31,8 @@
#include <stdarg.h>
#include "stm32_util.h"
#if CH_CFG_USE_HEAP == TRUE
#define MIN_ALIGNMENT 8
#if defined(CCM_RAM_SIZE_KB)
@ -161,3 +163,5 @@ size_t mem_available(void)
return totalp;
}
#endif // CH_CFG_USE_HEAP

View File

@ -20,6 +20,8 @@
code to handle sharing of DMA channels between peripherals
*/
#if CH_CFG_USE_SEMAPHORES == TRUE
using namespace ChibiOS;
Shared_DMA::dma_lock Shared_DMA::locks[SHARED_DMA_MAX_STREAM_ID];
@ -183,3 +185,5 @@ void Shared_DMA::lock_all(void)
chBSemWait(&locks[i].semaphore);
}
}
#endif // CH_CFG_USE_SEMAPHORES

View File

@ -81,7 +81,9 @@ private:
static struct dma_lock {
// semaphore to ensure only one peripheral uses a DMA channel at a time
#if CH_CFG_USE_SEMAPHORES == TRUE
binary_semaphore_t semaphore;
#endif // CH_CFG_USE_SEMAPHORES
// a de-allocation function that is called to release an existing user
dma_deallocate_fn_t deallocate;
@ -90,3 +92,4 @@ private:
Shared_DMA *obj;
} locks[SHARED_DMA_MAX_STREAM_ID];
};