34 #include <px4_platform_common/getopt.h> 35 #include <px4_platform_common/module.h> 63 #if defined(PX4_I2C_BUS_EXPANSION) 70 #if defined(PX4_I2C_BUS_EXPANSION1) 77 #if defined(PX4_I2C_BUS_EXPANSION2) 85 #define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0])) 96 PX4_ERR(
"bus option already started");
128 bool started =
false;
132 if (bus_options[i].busid == busid) {
139 PX4_WARN(
"bus option number is %d", i);
140 PX4_ERR(
"driver start failed");
153 if (bus_options[i].vbat.dev) {
154 bus_options[i].vbat.dev->print_info();
157 if (bus_options[i].vpwr.dev) {
158 bus_options[i].vpwr.dev->print_info();
168 PRINT_MODULE_USAGE_NAME_SIMPLE(
"voxlpm",
"command");
170 PRINT_MODULE_USAGE_COMMAND_DESCR(
"start",
"start monitoring");
171 PRINT_MODULE_USAGE_COMMAND_DESCR(
"info",
"display info");;
172 PRINT_MODULE_USAGE_COMMAND_DESCR(
"-X",
"PX4_I2C_BUS_EXPANSION");
173 PRINT_MODULE_USAGE_COMMAND_DESCR(
"-T",
"PX4_I2C_BUS_EXPANSION1");
174 PRINT_MODULE_USAGE_COMMAND_DESCR(
"-R",
"PX4_I2C_BUS_EXPANSION2 (default)");
183 const char *myoptarg =
nullptr;
186 while ((ch = px4_getopt(argc, argv,
"XTR", &myoptind, &myoptarg)) != EOF) {
206 if (myoptind >= argc) {
211 const char *verb = argv[myoptind];
213 if (!strcmp(verb,
"start")) {
217 if (!strcmp(verb,
"info")) {
__EXPORT int voxlpm_main(int argc, char *argv[])
Shared defines for the voxlpm (QTY2 LTC2946) driver.
void info()
Print a little info about the driver.
Local functions in support of the shell command.
#define VOXLPM_LTC2946_ADDR_P5VD
#define VOXLPM_LTC2946_ADDR_VBATT
struct voxlpm::voxlpm_bus_option bus_options[]
void start(enum VOXLPM_BUS busid)
bool start_bus(struct voxlpm_bus_option &bus)
Start the driver.
void usage()
Prints info about the driver argument usage.