AP_HAL: introduce a CANProtocol interface and remove HAL CAN thread management

This commit is contained in:
Francisco Ferreira 2018-02-27 23:53:37 +00:00
parent e1bf89f32d
commit 0645a5b11a
No known key found for this signature in database
GPG Key ID: F63C20A6773E787E
3 changed files with 13 additions and 5 deletions

View File

@ -29,6 +29,7 @@ namespace AP_HAL {
class Semaphore;
class OpticalFlow;
class CANProtocol;
class CANManager;
class CAN;

View File

@ -32,7 +32,18 @@
#define MAX_NUMBER_OF_CAN_INTERFACES 2
#define MAX_NUMBER_OF_CAN_DRIVERS 2
class AP_UAVCAN;
/**
* Interface that CAN protocols need to implement
*/
class AP_HAL::CANProtocol {
public:
/* method called when initializing the CAN interfaces
*
* if initialization doesn't have errors, protocol class
* should create a thread to do send and receive operations
*/
virtual void init(uint8_t driver_index) = 0;
};
/**
* Single non-blocking CAN interface.
@ -115,8 +126,6 @@ public:
virtual bool is_initialized() = 0;
virtual void initialized(bool val) = 0;
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;

View File

@ -63,8 +63,6 @@ public:
virtual bool in_main_thread() const = 0;
virtual void create_uavcan_thread() {};
/*
disable interrupts and return a context that can be used to
restore the interrupt state. This can be used to protect