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
This commit is contained in:
Siddharth Purohit 2018-02-02 00:46:51 +05:30 committed by Andrew Tridgell
parent f0f4239d4a
commit d539a157b7

View File

@ -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