AP_HAL_ChibiOS: use get_HAL_mutable() to install new CAN interfaces

Avoids dubious extern redefinition.
This commit is contained in:
Thomas Watson 2023-11-23 21:07:03 -06:00 committed by Peter Barker
parent 008c0baf5f
commit 87fef1ae5d
2 changed files with 4 additions and 4 deletions

View File

@ -85,7 +85,7 @@
#error "Unsupported MCU for FDCAN"
#endif
extern AP_HAL::HAL& hal;
extern const AP_HAL::HAL& hal;
#define STR(x) #x
#define XSTR(x) STR(x)
@ -568,7 +568,7 @@ bool CANIface::init(const uint32_t bitrate, const uint32_t fdbitrate, const Oper
if (can_ifaces[self_index_] == nullptr) {
can_ifaces[self_index_] = this;
#if !defined(HAL_BOOTLOADER_BUILD)
hal.can[self_index_] = this;
AP_HAL::get_HAL_mutable().can[self_index_] = this;
#endif
}

View File

@ -84,7 +84,7 @@
#endif
extern AP_HAL::HAL& hal;
extern const AP_HAL::HAL& hal;
using namespace ChibiOS;
@ -846,7 +846,7 @@ bool CANIface::init(const uint32_t bitrate, const CANIface::OperatingMode mode)
if (can_ifaces[self_index_] == nullptr) {
can_ifaces[self_index_] = this;
#if !defined(HAL_BOOTLOADER_BUILD)
hal.can[self_index_] = this;
AP_HAL::get_HAL_mutable().can[self_index_] = this;
#endif
}