mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_HAL: Device: add bus_type field
Sometimes it's necessary to know the type of bus to make some decisions where AP_HAL::Device abstraction is used.
This commit is contained in:
parent
7edb6e76f0
commit
4693501d9d
@ -26,6 +26,11 @@
|
||||
*/
|
||||
class AP_HAL::Device {
|
||||
public:
|
||||
enum BusType {
|
||||
I2C,
|
||||
SPI,
|
||||
};
|
||||
|
||||
enum Speed {
|
||||
SPEED_HIGH,
|
||||
SPEED_LOW,
|
||||
@ -33,6 +38,12 @@ public:
|
||||
|
||||
typedef void PeriodicHandle;
|
||||
|
||||
const enum BusType bus_type;
|
||||
|
||||
Device(enum BusType type)
|
||||
: bus_type(type)
|
||||
{ }
|
||||
|
||||
virtual ~Device() { }
|
||||
|
||||
/*
|
||||
|
@ -27,6 +27,8 @@ namespace AP_HAL {
|
||||
|
||||
class I2CDevice : public Device {
|
||||
public:
|
||||
I2CDevice() : Device(I2C) { }
|
||||
|
||||
virtual ~I2CDevice() { }
|
||||
|
||||
/*
|
||||
|
@ -27,6 +27,8 @@ namespace AP_HAL {
|
||||
|
||||
class SPIDevice : public Device {
|
||||
public:
|
||||
SPIDevice() : Device(SPI) { }
|
||||
|
||||
virtual ~SPIDevice() { }
|
||||
/* Device implementation */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user