From 88e7efcf9c585fca7e11ed65358a5b0d85854f31 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell <andrew@tridgell.net> Date: Mon, 14 Feb 2022 09:02:27 +1100 Subject: [PATCH] AP_HAL: make CANFrame data available as uint32_t this makes the critical sections in CANFrame handling on STM32 faster --- libraries/AP_HAL/CANIface.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL/CANIface.h b/libraries/AP_HAL/CANIface.h index 0a0b8a614e..0d11ea1159 100644 --- a/libraries/AP_HAL/CANIface.h +++ b/libraries/AP_HAL/CANIface.h @@ -35,7 +35,10 @@ struct AP_HAL::CANFrame { static const uint8_t MaxDataLen = 8; uint32_t id; ///< CAN ID with flags (above) - uint8_t data[MaxDataLen]; + union { + uint8_t data[MaxDataLen]; + uint32_t data_32[MaxDataLen/4]; + }; uint8_t dlc; ///< Data Length Code CANFrame() :