mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 10:03:33 +08:00
l3gd20:spi_dev_e is now uint32_t in NuttX
Using new type of uint32_t for spi device
This commit is contained in:
committed by
Daniel Agar
parent
3cef14482a
commit
44a07e7084
@@ -201,7 +201,7 @@ extern "C" { __EXPORT int l3gd20_main(int argc, char *argv[]); }
|
|||||||
class L3GD20 : public device::SPI
|
class L3GD20 : public device::SPI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
L3GD20(int bus, const char *path, spi_dev_e device, enum Rotation rotation);
|
L3GD20(int bus, const char *path, uint32_t device, enum Rotation rotation);
|
||||||
virtual ~L3GD20();
|
virtual ~L3GD20();
|
||||||
|
|
||||||
virtual int init();
|
virtual int init();
|
||||||
@@ -405,7 +405,7 @@ const uint8_t L3GD20::_checked_registers[L3GD20_NUM_CHECKED_REGISTERS] = { ADDR_
|
|||||||
ADDR_LOW_ODR
|
ADDR_LOW_ODR
|
||||||
};
|
};
|
||||||
|
|
||||||
L3GD20::L3GD20(int bus, const char *path, spi_dev_e device, enum Rotation rotation) :
|
L3GD20::L3GD20(int bus, const char *path, uint32_t device, enum Rotation rotation) :
|
||||||
SPI("L3GD20", path, bus, device, SPIDEV_MODE3,
|
SPI("L3GD20", path, bus, device, SPIDEV_MODE3,
|
||||||
11 * 1000 * 1000 /* will be rounded to 10.4 MHz, within margins for L3GD20 */),
|
11 * 1000 * 1000 /* will be rounded to 10.4 MHz, within margins for L3GD20 */),
|
||||||
_call{},
|
_call{},
|
||||||
@@ -1206,13 +1206,13 @@ start(bool external_bus, enum Rotation rotation)
|
|||||||
/* create the driver */
|
/* create the driver */
|
||||||
if (external_bus) {
|
if (external_bus) {
|
||||||
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_GYRO)
|
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_GYRO)
|
||||||
g_dev = new L3GD20(PX4_SPI_BUS_EXT, L3GD20_DEVICE_PATH, (spi_dev_e)PX4_SPIDEV_EXT_GYRO, rotation);
|
g_dev = new L3GD20(PX4_SPI_BUS_EXT, L3GD20_DEVICE_PATH, PX4_SPIDEV_EXT_GYRO, rotation);
|
||||||
#else
|
#else
|
||||||
errx(0, "External SPI not available");
|
errx(0, "External SPI not available");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
g_dev = new L3GD20(PX4_SPI_BUS_SENSORS, L3GD20_DEVICE_PATH, (spi_dev_e)PX4_SPIDEV_GYRO, rotation);
|
g_dev = new L3GD20(PX4_SPI_BUS_SENSORS, L3GD20_DEVICE_PATH, PX4_SPIDEV_GYRO, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_dev == nullptr) {
|
if (g_dev == nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user