71 #if defined(PX4_SPIDEV_EXT_BARO) && defined(PX4_SPI_BUS_EXT) 74 #ifdef PX4_SPIDEV_BARO 77 #ifdef PX4_I2C_BUS_ONBOARD 80 #ifdef PX4_I2C_BUS_EXPANSION 83 #ifdef PX4_I2C_BUS_EXPANSION1 86 #ifdef PX4_I2C_BUS_EXPANSION2 90 #define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0])) 98 if (bus.
dev !=
nullptr) {
99 PX4_ERR(
"bus option already started");
104 device::Device *
interface = bus.interface_constructor(prom_buf, bus.busnum);
106 if (interface->init() !=
OK) {
108 PX4_WARN(
"no device on bus %u", (
unsigned)bus.busid);
112 bus.dev =
new MS5611(interface, prom_buf, bus.devpath, device_type);
114 if (bus.dev !=
nullptr &&
OK != bus.dev->init()) {
124 PX4_ERR(
"can't open baro device");
130 PX4_ERR(
"failed setting default poll rate");
148 bool started =
false;
178 if (bus.
dev !=
nullptr) {
190 PX4_INFO(
"missing command: try 'start', 'info',");
191 PX4_INFO(
"options:");
192 PX4_INFO(
" -X (external I2C bus)");
193 PX4_INFO(
" -I (intternal I2C bus)");
194 PX4_INFO(
" -S (external SPI bus)");
195 PX4_INFO(
" -s (internal SPI bus)");
196 PX4_INFO(
" -T 5611|5607 (default 5611)");
197 PX4_INFO(
" -T 0 (autodetect version)");
211 const char *myoptarg = NULL;
214 while ((ch = px4_getopt(argc, argv,
"T:XISs", &myoptind, &myoptarg)) != EOF) {
233 int val = atoi(myoptarg);
239 }
else if (val == 5607) {
243 }
else if (val == 0) {
256 if (myoptind >= argc) {
260 const char *verb = argv[myoptind];
265 if (!strcmp(verb,
"start")) {
272 if (!strcmp(verb,
"info")) {
device::Device *(* MS5611_constructor)(ms5611::prom_u &prom_buf, uint8_t busnum)
struct ms5611::ms5611_bus_option bus_options[]
#define SENSOR_POLLRATE_DEFAULT
poll at driver normal rate
__EXPORT int ms5611_main(int argc, char *argv[])
#define SENSORIOCSPOLLRATE
Set the driver polling rate to (arg) Hz, or one of the SENSOR_POLLRATE constants. ...
MS5611_constructor interface_constructor
Shared defines for the ms5611 driver.
static int start(enum MS5611_BUS busid, enum MS56XX_DEVICE_TYPES device_type)
Start the driver.
device::Device * MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum)
Local functions in support of the shell command.
device::Device * MS5611_spi_interface(ms5611::prom_u &prom_buf, uint8_t busnum)
Fundamental base class for all physical drivers (I2C, SPI).
static bool start_bus(struct ms5611_bus_option &bus, enum MS56XX_DEVICE_TYPES device_type)
Start the driver.
void print_info()
Diagnostics - print some basic information about the driver.