mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 09:22:18 +00:00
SPI: disable SPI locking where possible
It's not possible for buses that run both NuttX and PX4 drivers, e.g. Pixracer. Reduces CPU load: - v5x: 2.5% - v3 (pixhawk cube): 4.4%
This commit is contained in:
@@ -68,7 +68,7 @@ static inline constexpr px4_spi_bus_t initSPIBus(SPI::Bus bus, const px4_spi_bus
|
||||
GPIO::GPIOPin power_enable = {})
|
||||
{
|
||||
px4_spi_bus_t ret{};
|
||||
ret.requires_locking = true; // TODO: set this to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = false;
|
||||
|
||||
for (int i = 0; i < SPI_BUS_MAX_DEVICES; ++i) {
|
||||
ret.devices[i] = devices.devices[i];
|
||||
@@ -118,8 +118,7 @@ static inline constexpr px4_spi_bus_t initSPIBusExternal(SPI::Bus bus, const bus
|
||||
|
||||
ret.bus = (int)bus;
|
||||
ret.is_external = true;
|
||||
// TODO: set requires_locking to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = true; // external buses are never accessed by NuttX drivers
|
||||
ret.requires_locking = false; // external buses are never accessed by NuttX drivers
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ static inline constexpr px4_spi_bus_t initSPIBus(SPI::Bus bus, const px4_spi_bus
|
||||
GPIO::GPIOPin power_enable = {})
|
||||
{
|
||||
px4_spi_bus_t ret{};
|
||||
ret.requires_locking = true; // TODO: set this to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = false;
|
||||
|
||||
for (int i = 0; i < SPI_BUS_MAX_DEVICES; ++i) {
|
||||
ret.devices[i] = devices.devices[i];
|
||||
@@ -112,8 +112,7 @@ static inline constexpr px4_spi_bus_t initSPIBusExternal(SPI::Bus bus, const bus
|
||||
|
||||
ret.bus = (int)bus;
|
||||
ret.is_external = true;
|
||||
// TODO: set requires_locking to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = true; // external buses are never accessed by NuttX drivers
|
||||
ret.requires_locking = false; // external buses are never accessed by NuttX drivers
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ static inline constexpr px4_spi_bus_t initSPIBus(SPI::Bus bus, const px4_spi_bus
|
||||
GPIO::GPIOPin power_enable = {})
|
||||
{
|
||||
px4_spi_bus_t ret{};
|
||||
ret.requires_locking = true; // TODO: set this to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = false;
|
||||
|
||||
for (int i = 0; i < SPI_BUS_MAX_DEVICES; ++i) {
|
||||
ret.devices[i] = devices.devices[i];
|
||||
@@ -114,8 +114,7 @@ static inline constexpr px4_spi_bus_t initSPIBusExternal(SPI::Bus bus, const bus
|
||||
|
||||
ret.bus = (int)bus;
|
||||
ret.is_external = true;
|
||||
// TODO: set requires_locking to false once all drivers are converted to use the I2CSPIDriver class
|
||||
ret.requires_locking = true; // external buses are never accessed by NuttX drivers
|
||||
ret.requires_locking = false; // external buses are never accessed by NuttX drivers
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user