AP_HAL: introduce a CANProtocol interface and remove HAL CAN thread management
This commit is contained in:
parent
e1bf89f32d
commit
0645a5b11a
@ -29,6 +29,7 @@ namespace AP_HAL {
|
||||
class Semaphore;
|
||||
class OpticalFlow;
|
||||
|
||||
class CANProtocol;
|
||||
class CANManager;
|
||||
class CAN;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user