mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 08:33:34 +08:00
Add direct-access methods to the base Device class, so that there's a common way of talking to drivers regardless of which of the specialised classes they derive from.
Make the Device destructor public and virtual, so that arbitrary devices can be deleted. Likewise for classes that derive from it. Make Device::init public so that arbitrary devices can be initialised after being returned by factories.
This commit is contained in:
@@ -55,13 +55,11 @@ class __EXPORT I2C : public CDev
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Get the address
|
||||
*/
|
||||
uint16_t get_address() {
|
||||
return _address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the address
|
||||
*/
|
||||
int16_t get_address() { return _address; }
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The number of times a read or write operation will be retried on
|
||||
@@ -90,7 +88,7 @@ protected:
|
||||
uint16_t address,
|
||||
uint32_t frequency,
|
||||
int irq = 0);
|
||||
~I2C();
|
||||
virtual ~I2C();
|
||||
|
||||
virtual int init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user