From d539a157b74219177322a54f475f3b2588c45532 Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Fri, 2 Feb 2018 00:46:51 +0530 Subject: [PATCH] AP_HAL: move to having ICanDriver as member instead of inheriting it this is to support having drivers using libuavcan supplied helper objects, a method which can lead to much less duplication of code --- libraries/AP_HAL/CAN.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL/CAN.h b/libraries/AP_HAL/CAN.h index 2b973525e3..663bf15fd3 100644 --- a/libraries/AP_HAL/CAN.h +++ b/libraries/AP_HAL/CAN.h @@ -92,8 +92,10 @@ public: /** * Generic CAN driver. */ -class AP_HAL::CANManager: public uavcan::ICanDriver { +class AP_HAL::CANManager { public: + CANManager(uavcan::ICanDriver* driver) : _driver(driver) {} + /* CAN port open method Opens port with specified bit rate bitrate - selects the speed that the port will be configured to. If zero, the port speed is left @@ -115,6 +117,9 @@ public: virtual AP_UAVCAN *get_UAVCAN(void) = 0; virtual void set_UAVCAN(AP_UAVCAN *uavcan) = 0; + uavcan::ICanDriver* get_driver() { return _driver; } +private: + uavcan::ICanDriver* _driver; }; #endif