Tools: add and use option to compile SLCAN support out of code

This commit is contained in:
Peter Barker 2023-03-11 11:46:34 +11:00 committed by Peter Barker
parent 144c3ef42c
commit 7995bc5175
5 changed files with 6 additions and 5 deletions

View File

@ -118,7 +118,7 @@ public:
static HALSITL::CANIface* can_iface_periph[HAL_NUM_CAN_IFACES];
#endif
#ifdef HAL_PERIPH_ENABLE_SLCAN
#if AP_CAN_SLCAN_ENABLED
static SLCAN::CANIface slcan_interface;
#endif

View File

@ -85,7 +85,7 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
// @RebootRequired: True
GARRAY(can_baudrate, 0, "CAN_BAUDRATE", 1000000),
#ifdef HAL_PERIPH_ENABLE_SLCAN
#if AP_CAN_SLCAN_ENABLED
// @Param: CAN_SLCAN_CPORT
// @DisplayName: SLCAN Route
// @Description: CAN Interface ID to be routed to SLCAN, 0 means no routing

View File

@ -80,7 +80,7 @@ public:
AP_Enum<AP_CANManager::Driver_Type> can_protocol[HAL_NUM_CAN_IFACES];
#endif
#ifdef HAL_PERIPH_ENABLE_SLCAN
#if AP_CAN_SLCAN_ENABLED
AP_Int8 can_slcan_cport;
#endif

View File

@ -172,7 +172,7 @@ ChibiOS::CANIface* AP_Periph_FW::can_iface_periph[HAL_NUM_CAN_IFACES];
HALSITL::CANIface* AP_Periph_FW::can_iface_periph[HAL_NUM_CAN_IFACES];
#endif
#ifdef HAL_PERIPH_ENABLE_SLCAN
#if AP_CAN_SLCAN_ENABLED
SLCAN::CANIface AP_Periph_FW::slcan_interface;
#endif
@ -1537,7 +1537,7 @@ void AP_Periph_FW::can_start()
}
}
#ifdef HAL_PERIPH_ENABLE_SLCAN
#if AP_CAN_SLCAN_ENABLED
const uint8_t slcan_selected_index = g.can_slcan_cport - 1;
if (slcan_selected_index < HAL_NUM_CAN_IFACES) {
slcan_interface.set_can_iface(can_iface_periph[slcan_selected_index]);

View File

@ -778,6 +778,7 @@ class sitl_periph_gps(sitl):
HAL_GENERATOR_ENABLED = 0,
AP_STATS_ENABLED = 0,
HAL_SUPPORT_RCOUT_SERIAL = 0,
AP_CAN_SLCAN_ENABLED = 0,
)
# libcanard is written for 32bit platforms
env.CXXFLAGS += [