AP_HAL_Linux: Remove hole from SPIBus
Also handle a few coding style bikesheds.
This commit is contained in:
parent
4152b555fd
commit
cf4fb09881
@ -171,8 +171,8 @@ public:
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
uint16_t bus;
|
uint16_t bus;
|
||||||
uint16_t subdev;
|
uint16_t subdev;
|
||||||
uint8_t ref;
|
|
||||||
int16_t last_mode = -1;
|
int16_t last_mode = -1;
|
||||||
|
uint8_t ref;
|
||||||
};
|
};
|
||||||
|
|
||||||
SPIBus::~SPIBus()
|
SPIBus::~SPIBus()
|
||||||
@ -222,7 +222,7 @@ SPIDevice::SPIDevice(SPIBus &bus, SPIDesc &device_desc)
|
|||||||
set_device_bus(_bus.bus);
|
set_device_bus(_bus.bus);
|
||||||
set_device_address(_desc.subdev);
|
set_device_address(_desc.subdev);
|
||||||
_speed = _desc.highspeed;
|
_speed = _desc.highspeed;
|
||||||
|
|
||||||
if (_desc.cs_pin != SPI_CS_KERNEL) {
|
if (_desc.cs_pin != SPI_CS_KERNEL) {
|
||||||
_cs = hal.gpio->channel(_desc.cs_pin);
|
_cs = hal.gpio->channel(_desc.cs_pin);
|
||||||
if (!_cs) {
|
if (!_cs) {
|
||||||
@ -466,7 +466,8 @@ SPIDeviceManager::get_device(const char *name)
|
|||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t SPIDeviceManager::get_count() {
|
uint8_t SPIDeviceManager::get_count()
|
||||||
|
{
|
||||||
return _n_device_desc;
|
return _n_device_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +484,9 @@ SPIDeviceManager::_create_device(SPIBus &b, SPIDesc &desc) const
|
|||||||
if (!dev) {
|
if (!dev) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
b.ref++;
|
b.ref++;
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user