AP_RangeFinder: populate AP_RangeFinder_config.h

This commit is contained in:
Peter Barker 2023-06-24 11:09:28 +10:00 committed by Peter Barker
parent 5cbb776951
commit e26f8c1d11
7 changed files with 52 additions and 49 deletions

View File

@ -1,19 +1,11 @@
#pragma once #pragma once
#include "AP_RangeFinder.h" #include "AP_RangeFinder_config.h"
#include "AP_RangeFinder_Backend.h"
#include <AP_BoardConfig/AP_BoardConfig.h>
#ifndef AP_RANGEFINDER_BBB_PRU_ENABLED
#define AP_RANGEFINDER_BBB_PRU_ENABLED ( \
AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI \
)
#endif
#if AP_RANGEFINDER_BBB_PRU_ENABLED #if AP_RANGEFINDER_BBB_PRU_ENABLED
#include "AP_RangeFinder_Backend.h"
#define PRU0_CTRL_BASE 0x4a322000 #define PRU0_CTRL_BASE 0x4a322000
#define PRU0_IRAM_BASE 0x4a334000 #define PRU0_IRAM_BASE 0x4a334000
@ -54,4 +46,4 @@ private:
}; };
#endif #endif // AP_RANGEFINDER_BBB_PRU_ENABLED

View File

@ -1,10 +1,6 @@
#pragma once #pragma once
#include "AP_RangeFinder.h" #include "AP_RangeFinder_config.h"
#ifndef AP_RANGEFINDER_BLPING_ENABLED
#define AP_RANGEFINDER_BLPING_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#endif
#if AP_RANGEFINDER_BLPING_ENABLED #if AP_RANGEFINDER_BLPING_ENABLED

View File

@ -14,19 +14,7 @@
*/ */
#pragma once #pragma once
#include "AP_RangeFinder.h" #include "AP_RangeFinder_config.h"
#include "AP_RangeFinder_Backend.h"
#include <AP_HAL/AP_HAL.h>
#include <utility>
#ifndef AP_RANGEFINDER_BEBOP_ENABLED
#define AP_RANGEFINDER_BEBOP_ENABLED \
AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && \
(CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO) && \
defined(HAVE_LIBIIO)
#endif
#if AP_RANGEFINDER_BEBOP_ENABLED #if AP_RANGEFINDER_BEBOP_ENABLED
@ -158,4 +146,4 @@ private:
}; };
#endif #endif // AP_RANGEFINDER_BEBOP_ENABLED

View File

@ -1,9 +1,10 @@
#pragma once #pragma once
#include "AP_RangeFinder.h" #include "AP_RangeFinder_config.h"
#include "AP_RangeFinder_Backend.h"
#if AP_SCRIPTING_ENABLED #if AP_RANGEFINDER_LUA_ENABLED
#include "AP_RangeFinder_Backend.h"
// Data timeout // Data timeout
#define AP_RANGEFINDER_LUA_TIMEOUT_MS 500 #define AP_RANGEFINDER_LUA_TIMEOUT_MS 500
@ -30,4 +31,4 @@ private:
float _distance_m; // stored data from lua script: float _distance_m; // stored data from lua script:
}; };
#endif #endif // AP_RANGEFINDER_LUA_ENABLED

View File

@ -14,16 +14,12 @@
*/ */
#pragma once #pragma once
#include <AP_BoardConfig/AP_BoardConfig.h> #include "AP_RangeFinder_config.h"
#include "AP_RangeFinder_Backend.h"
#ifndef AP_RANGEFINDER_SIM_ENABLED
#define AP_RANGEFINDER_SIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL && AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED)
#endif
#if AP_RANGEFINDER_SIM_ENABLED #if AP_RANGEFINDER_SIM_ENABLED
#include "AP_RangeFinder_Backend.h"
class AP_RangeFinder_SITL : public AP_RangeFinder_Backend { class AP_RangeFinder_SITL : public AP_RangeFinder_Backend {
public: public:
// constructor. This incorporates initialisation as well. // constructor. This incorporates initialisation as well.

View File

@ -1,15 +1,13 @@
#pragma once #pragma once
#include "AP_RangeFinder_config.h"
#if AP_RANGEFINDER_ANALOG_ENABLED
#include "AP_RangeFinder.h" #include "AP_RangeFinder.h"
#include "AP_RangeFinder_Backend.h" #include "AP_RangeFinder_Backend.h"
#include "AP_RangeFinder_Params.h" #include "AP_RangeFinder_Params.h"
#ifndef AP_RANGEFINDER_ANALOG_ENABLED
#define AP_RANGEFINDER_ANALOG_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#endif
#if AP_RANGEFINDER_ANALOG_ENABLED
class AP_RangeFinder_analog : public AP_RangeFinder_Backend class AP_RangeFinder_analog : public AP_RangeFinder_Backend
{ {
public: public:
@ -35,4 +33,4 @@ private:
AP_HAL::AnalogSource *source; AP_HAL::AnalogSource *source;
}; };
#endif #endif // AP_RANGEFINDER_ANALOG_ENABLED

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <AP_HAL/AP_HAL_Boards.h> #include <AP_HAL/AP_HAL_Boards.h>
#include <AP_Scripting/AP_Scripting_config.h>
#ifndef AP_RANGEFINDER_ENABLED #ifndef AP_RANGEFINDER_ENABLED
#define AP_RANGEFINDER_ENABLED 1 #define AP_RANGEFINDER_ENABLED 1
@ -9,3 +10,34 @@
#ifndef AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED #ifndef AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#define AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED AP_RANGEFINDER_ENABLED #define AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED AP_RANGEFINDER_ENABLED
#endif #endif
#ifndef AP_RANGEFINDER_ANALOG_ENABLED
#define AP_RANGEFINDER_ANALOG_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_RANGEFINDER_BBB_PRU_ENABLED
#define AP_RANGEFINDER_BBB_PRU_ENABLED ( \
AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BBBMINI \
)
#endif
#ifndef AP_RANGEFINDER_BLPING_ENABLED
#define AP_RANGEFINDER_BLPING_ENABLED AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_RANGEFINDER_BEBOP_ENABLED
#define AP_RANGEFINDER_BEBOP_ENABLED \
AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED && \
(CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO) && \
defined(HAVE_LIBIIO)
#endif
#ifndef AP_RANGEFINDER_LUA_ENABLED
#define AP_RANGEFINDER_LUA_ENABLED AP_SCRIPTING_ENABLED
#endif
#ifndef AP_RANGEFINDER_SIM_ENABLED
#define AP_RANGEFINDER_SIM_ENABLED (CONFIG_HAL_BOARD == HAL_BOARD_SITL && AP_RANGEFINDER_BACKEND_DEFAULT_ENABLED)
#endif