AP_HAL_Linux: export number of SPI devices

Save in the manager the number of devices so it can be used in other
places like the SPIDevice implementation. This is a temporary storage
while we migrate to SPIDevice.

While at it use protected rather than private.
This commit is contained in:
Lucas De Marchi 2015-12-22 18:19:17 -02:00
parent cb40444bf8
commit 0d1bb7aa84
2 changed files with 3 additions and 1 deletions

View File

@ -78,6 +78,7 @@ SPIDeviceDriver SPIDeviceManager::_device[0];
#endif
#define LINUX_SPI_DEVICE_NUM_DEVICES ARRAY_SIZE(SPIDeviceManager::_device)
const uint8_t SPIDeviceManager::_n_device_desc = LINUX_SPI_DEVICE_NUM_DEVICES;
// have a separate semaphore per bus
Semaphore SPIDeviceManager::_semaphore[LINUX_SPI_MAX_BUSES];

View File

@ -52,7 +52,8 @@ public:
static void cs_release(enum AP_HAL::SPIDeviceType type);
static bool transaction(SPIDeviceDriver &driver, const uint8_t *tx, uint8_t *rx, uint16_t len);
private:
protected:
static const uint8_t _n_device_desc;
static SPIDeviceDriver _device[];
static Semaphore _semaphore[LINUX_SPI_MAX_BUSES];
};