mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 22:03:34 +08:00
bmi055: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
bd185ceb22
commit
045771ffcb
@@ -309,7 +309,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BMI055(const char *name, const char *devname, int bus, enum spi_dev_e device, enum spi_mode_e mode, uint32_t frequency,
|
BMI055(const char *name, const char *devname, int bus, uint32_t device, enum spi_mode_e mode, uint32_t frequency,
|
||||||
enum Rotation rotation);
|
enum Rotation rotation);
|
||||||
virtual ~BMI055();
|
virtual ~BMI055();
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ public:
|
|||||||
class BMI055_accel : public BMI055
|
class BMI055_accel : public BMI055
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BMI055_accel(int bus, const char *path_accel, spi_dev_e device, enum Rotation rotation);
|
BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation);
|
||||||
virtual ~BMI055_accel();
|
virtual ~BMI055_accel();
|
||||||
|
|
||||||
virtual int init();
|
virtual int init();
|
||||||
@@ -484,7 +484,7 @@ private:
|
|||||||
class BMI055_gyro : public BMI055
|
class BMI055_gyro : public BMI055
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BMI055_gyro(int bus, const char *path_gyro, spi_dev_e device, enum Rotation rotation);
|
BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation);
|
||||||
virtual ~BMI055_gyro();
|
virtual ~BMI055_gyro();
|
||||||
|
|
||||||
virtual int init();
|
virtual int init();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const uint8_t BMI055_accel::_checked_registers[BMI055_ACCEL_NUM_CHECKED_REGISTER
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
BMI055_accel::BMI055_accel(int bus, const char *path_accel, spi_dev_e device, enum Rotation rotation) :
|
BMI055_accel::BMI055_accel(int bus, const char *path_accel, uint32_t device, enum Rotation rotation) :
|
||||||
BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
BMI055("BMI055_ACCEL", path_accel, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
||||||
_accel_reports(nullptr),
|
_accel_reports(nullptr),
|
||||||
_accel_scale{},
|
_accel_scale{},
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const uint8_t BMI055_gyro::_checked_registers[BMI055_GYRO_NUM_CHECKED_REGISTERS]
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, spi_dev_e device, enum Rotation rotation) :
|
BMI055_gyro::BMI055_gyro(int bus, const char *path_gyro, uint32_t device, enum Rotation rotation) :
|
||||||
BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
BMI055("BMI055_GYRO", path_gyro, bus, device, SPIDEV_MODE3, BMI055_BUS_SPEED, rotation),
|
||||||
_gyro_reports(nullptr),
|
_gyro_reports(nullptr),
|
||||||
_gyro_scale{},
|
_gyro_scale{},
|
||||||
|
|||||||
@@ -62,13 +62,13 @@ start(bool external_bus, enum Rotation rotation, enum sensor_type sensor)
|
|||||||
/* create the driver */
|
/* create the driver */
|
||||||
if (external_bus) {
|
if (external_bus) {
|
||||||
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_BMI)
|
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_BMI)
|
||||||
*g_dev_acc_ptr = new BMI055_accel(PX4_SPI_BUS_EXT, path_accel, (spi_dev_e)PX4_SPIDEV_EXT_BMI, rotation);
|
*g_dev_acc_ptr = new BMI055_accel(PX4_SPI_BUS_EXT, path_accel, PX4_SPIDEV_EXT_BMI, rotation);
|
||||||
#else
|
#else
|
||||||
errx(0, "External SPI not available");
|
errx(0, "External SPI not available");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
*g_dev_acc_ptr = new BMI055_accel(PX4_SPI_BUS_SENSORS, path_accel, (spi_dev_e)PX4_SPIDEV_BMI055_ACC, rotation);
|
*g_dev_acc_ptr = new BMI055_accel(PX4_SPI_BUS_SENSORS, path_accel, PX4_SPIDEV_BMI055_ACC, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*g_dev_acc_ptr == nullptr) {
|
if (*g_dev_acc_ptr == nullptr) {
|
||||||
@@ -102,13 +102,13 @@ start(bool external_bus, enum Rotation rotation, enum sensor_type sensor)
|
|||||||
/* create the driver */
|
/* create the driver */
|
||||||
if (external_bus) {
|
if (external_bus) {
|
||||||
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_BMI)
|
#if defined(PX4_SPI_BUS_EXT) && defined(PX4_SPIDEV_EXT_BMI)
|
||||||
*g_dev_ptr = new BMI055_gyro(PX4_SPI_BUS_EXT, path_gyro, (spi_dev_e)PX4_SPIDEV_EXT_BMI, rotation);
|
*g_dev_ptr = new BMI055_gyro(PX4_SPI_BUS_EXT, path_gyro, PX4_SPIDEV_EXT_BMI, rotation);
|
||||||
#else
|
#else
|
||||||
errx(0, "External SPI not available");
|
errx(0, "External SPI not available");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
*g_dev_gyr_ptr = new BMI055_gyro(PX4_SPI_BUS_SENSORS, path_gyro, (spi_dev_e)PX4_SPIDEV_BMI055_GYR, rotation);
|
*g_dev_gyr_ptr = new BMI055_gyro(PX4_SPI_BUS_SENSORS, path_gyro, PX4_SPIDEV_BMI055_GYR, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*g_dev_gyr_ptr == nullptr) {
|
if (*g_dev_gyr_ptr == nullptr) {
|
||||||
@@ -452,7 +452,7 @@ usage()
|
|||||||
}//namespace ends
|
}//namespace ends
|
||||||
|
|
||||||
|
|
||||||
BMI055::BMI055(const char *name, const char *devname, int bus, enum spi_dev_e device, enum spi_mode_e mode,
|
BMI055::BMI055(const char *name, const char *devname, int bus, uint32_t device, enum spi_mode_e mode,
|
||||||
uint32_t frequency, enum Rotation rotation):
|
uint32_t frequency, enum Rotation rotation):
|
||||||
SPI(name, devname, bus, device, mode, frequency),
|
SPI(name, devname, bus, device, mode, frequency),
|
||||||
_whoami(0),
|
_whoami(0),
|
||||||
|
|||||||
Reference in New Issue
Block a user