AP_HAL_Linux: I2CDevice: move implementation to outside

As we add methods, it's becoming too complex to be implemented together
with the declaration.
This commit is contained in:
Lucas De Marchi 2016-07-16 02:16:09 -03:00
parent 7b39f3d0a7
commit 8e5aba8653
1 changed files with 33 additions and 31 deletions

View File

@ -75,15 +75,24 @@ static inline char *startswith(const char *s, const char *prefix)
/* Private struct to maintain for each bus */
class I2CBus {
public:
~I2CBus()
{
~I2CBus();
int open(uint8_t n);
Semaphore sem;
int fd = -1;
uint8_t bus;
uint8_t ref;
};
I2CBus::~I2CBus()
{
if (fd >= 0) {
::close(fd);
}
}
}
int open(uint8_t n)
{
int I2CBus::open(uint8_t n)
{
char path[sizeof("/dev/i2c-XXX")];
int r;
@ -104,14 +113,7 @@ public:
bus = n;
return fd;
}
Semaphore sem;
int fd = -1;
uint8_t bus;
uint8_t ref;
};
}
I2CDevice::~I2CDevice()
{