AP_HAL_Linux: SPIDevice: 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:
parent
590539f674
commit
ea0595c7ac
@ -136,14 +136,26 @@ const uint8_t SPIDeviceManager::_n_device_desc = LINUX_SPI_DEVICE_NUM_DEVICES;
|
|||||||
/* Private struct to maintain for each bus */
|
/* Private struct to maintain for each bus */
|
||||||
class SPIBus {
|
class SPIBus {
|
||||||
public:
|
public:
|
||||||
~SPIBus()
|
~SPIBus();
|
||||||
|
|
||||||
|
int open(uint16_t bus_, uint16_t kernel_cs_);
|
||||||
|
|
||||||
|
Semaphore sem;
|
||||||
|
int fd = -1;
|
||||||
|
uint16_t bus;
|
||||||
|
uint16_t kernel_cs;
|
||||||
|
uint8_t ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
SPIBus::~SPIBus()
|
||||||
{
|
{
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
::close(fd);
|
::close(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int open(uint16_t bus_, uint16_t kernel_cs_)
|
|
||||||
|
int SPIBus::open(uint16_t bus_, uint16_t kernel_cs_)
|
||||||
{
|
{
|
||||||
char path[sizeof("/dev/spidevXXXXX.XXXXX")];
|
char path[sizeof("/dev/spidevXXXXX.XXXXX")];
|
||||||
|
|
||||||
@ -164,12 +176,6 @@ public:
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
Semaphore sem;
|
|
||||||
int fd = -1;
|
|
||||||
uint16_t bus;
|
|
||||||
uint16_t kernel_cs;
|
|
||||||
uint8_t ref;
|
|
||||||
};
|
|
||||||
|
|
||||||
SPIDevice::SPIDevice(SPIBus &bus, SPIDesc &device_desc)
|
SPIDevice::SPIDevice(SPIBus &bus, SPIDesc &device_desc)
|
||||||
: _bus(bus)
|
: _bus(bus)
|
||||||
|
Loading…
Reference in New Issue
Block a user