34 #include <px4_platform_common/px4_config.h> 35 #include <px4_platform_common/getopt.h> 59 #if defined(PX4_SPIDEV_EXT_BARO) && defined(PX4_SPI_BUS_EXT) 62 #if defined(PX4_SPIDEV_BARO) 63 # if defined(PX4_SPIDEV_BARO_BUS) 69 #if defined(PX4_I2C_BUS_ONBOARD) && defined(PX4_I2C_OBDEV_BMP388) 72 #if defined(PX4_I2C_BUS_ONBOARD) && defined(PX4_I2C_OBDEV1_BMP388) 75 #if defined(PX4_I2C_BUS_EXPANSION) && defined(PX4_I2C_OBDEV_BMP388) 85 busid == bus_option.busid) && bus_option.dev !=
nullptr) {
96 IBMP388 *
interface = bus.interface_constructor(bus.busnum, bus.address);
98 if ((interface ==
nullptr) || (interface->init() != PX4_OK)) {
99 PX4_WARN(
"no device on bus %u", (
unsigned)bus.busid);
106 if (dev ==
nullptr || (dev->
init() != PX4_OK)) {
107 PX4_ERR(
"driver start failed");
121 if (bus_option.dev !=
nullptr) {
123 PX4_WARN(
"already started");
144 if (bus !=
nullptr && bus->
dev !=
nullptr) {
149 PX4_WARN(
"driver not running");
160 if (bus !=
nullptr && bus->
dev !=
nullptr) {
165 PX4_WARN(
"driver not running");
171 PX4_INFO(
"missing command: try 'start', 'stop', 'status'");
172 PX4_INFO(
"options:");
173 PX4_INFO(
" -X (i2c external bus)");
174 PX4_INFO(
" -I (i2c internal bus)");
175 PX4_INFO(
" -J (i2c internal bus 2)");
176 PX4_INFO(
" -s (spi internal bus)");
177 PX4_INFO(
" -S (spi external bus)");
188 const char *myoptarg =
nullptr;
191 while ((ch = px4_getopt(argc, argv,
"XIJSs", &myoptind, &myoptarg)) != EOF) {
218 if (myoptind >= argc) {
222 const char *verb = argv[myoptind];
224 if (!strcmp(verb,
"start")) {
227 }
else if (!strcmp(verb,
"stop")) {
230 }
else if (!strcmp(verb,
"status")) {
static int stop(BMP388_BUS busid)
static bool start_bus(bmp388_bus_option &bus)
struct bmp388::bmp388_bus_option bus_options[]
void usage(const char *reason)
Print the correct usage.
static struct bmp388_bus_option * find_bus(BMP388_BUS busid)
int bmp388_main(int argc, char *argv[])
static int start(BMP388_BUS busid)
BMP388_constructor interface_constructor
IBMP388 * bmp388_i2c_interface(uint8_t busnum, uint32_t device)
static int status(BMP388_BUS busid)
Shared defines for the bmp388 driver.
IBMP388 * bmp388_spi_interface(uint8_t busnum, uint32_t device)
IBMP388 *(* BMP388_constructor)(uint8_t, uint32_t)