From 144c3ef42c084cb4c6c86dd180e7f8781944f85a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 11 Mar 2023 11:46:34 +1100 Subject: [PATCH] AP_HAL_ChibiOS: add and use option to compile SLCAN support out of code --- .../AP_HAL_ChibiOS/hwdef/CubeOrange-periph-heavy/hwdef.dat | 2 +- libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph/hwdef.dat | 2 +- libraries/AP_HAL_ChibiOS/hwdef/include/minimize_features.inc | 3 +++ libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph-heavy/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph-heavy/hwdef.dat index d08a49cb52..2afb20b32c 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph-heavy/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph-heavy/hwdef.dat @@ -16,7 +16,7 @@ env AP_PERIPH_HEAVY 1 -define HAL_PERIPH_ENABLE_SLCAN +define AP_CAN_SLCAN_ENABLED 1 define HAL_PERIPH_ENABLE_BATTERY define HAL_PERIPH_ENABLE_GPS define HAL_PERIPH_ENABLE_MAG diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph/hwdef.dat index 7666766ba7..6587e190ac 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/CubeOrange-periph/hwdef.dat @@ -15,7 +15,7 @@ env AP_PERIPH 1 -define HAL_PERIPH_ENABLE_SLCAN +define AP_CAN_SLCAN_ENABLED 1 define HAL_PERIPH_ENABLE_BATTERY define HAL_PERIPH_ENABLE_GPS define HAL_PERIPH_ENABLE_MAG diff --git a/libraries/AP_HAL_ChibiOS/hwdef/include/minimize_features.inc b/libraries/AP_HAL_ChibiOS/hwdef/include/minimize_features.inc index 3e2aeb7af8..e6aea3fb4a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/include/minimize_features.inc +++ b/libraries/AP_HAL_ChibiOS/hwdef/include/minimize_features.inc @@ -57,3 +57,6 @@ define AP_WINCH_ENABLED 0 define AP_CAMERA_BACKEND_DEFAULT_ENABLED 0 define AP_CAMERA_RELAY_ENABLED 1 define AP_CAMERA_SERVO_ENABLED 1 + +# no SLCAN on these boards (use can-over-mavlink if required) +define AP_CAN_SLCAN_ENABLED 0 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 7b7fb9ca44..a803a39f82 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -3007,6 +3007,11 @@ def add_apperiph_defaults(f): // no CAN manager in AP_Periph: #define HAL_CANMANAGER_ENABLED 0 +// SLCAN is off by default: +#ifndef AP_CAN_SLCAN_ENABLED +#define AP_CAN_SLCAN_ENABLED 0 +#endif + // Periphs don't use the FFT library: #ifndef HAL_GYROFFT_ENABLED #define HAL_GYROFFT_ENABLED 0