Skip to content

Commit

Permalink
AP_HAL_ChibiOS: use get_HAL_mutable() to install new CAN interfaces
Browse files Browse the repository at this point in the history
Avoids dubious extern redefinition.
  • Loading branch information
tpwrules authored and peterbarker committed Nov 27, 2023
1 parent 008c0ba commit 87fef1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_HAL_ChibiOS/CANFDIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_HAL_ChibiOS/CanIface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#endif


extern AP_HAL::HAL& hal;
extern const AP_HAL::HAL& hal;

using namespace ChibiOS;

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 87fef1a

Please sign in to comment.