|
|
|
@ -1355,10 +1355,9 @@ start_bus(struct hmc5883_bus_option &bus, enum Rotation rotation)
@@ -1355,10 +1355,9 @@ start_bus(struct hmc5883_bus_option &bus, enum Rotation rotation)
|
|
|
|
|
void |
|
|
|
|
start(enum HMC5883_BUS busid, enum Rotation rotation) |
|
|
|
|
{ |
|
|
|
|
uint8_t i; |
|
|
|
|
bool started = false; |
|
|
|
|
|
|
|
|
|
for (i=0; i<NUM_BUS_OPTIONS; i++) { |
|
|
|
|
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) { |
|
|
|
|
if (busid == HMC5883_BUS_ALL && bus_options[i].dev != NULL) { |
|
|
|
|
// this device is already started
|
|
|
|
|
continue; |
|
|
|
@ -1373,7 +1372,6 @@ start(enum HMC5883_BUS busid, enum Rotation rotation)
@@ -1373,7 +1372,6 @@ start(enum HMC5883_BUS busid, enum Rotation rotation)
|
|
|
|
|
if (!started) |
|
|
|
|
errx(1, "driver start failed"); |
|
|
|
|
|
|
|
|
|
// one or more drivers started OK
|
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1382,13 +1380,13 @@ start(enum HMC5883_BUS busid, enum Rotation rotation)
@@ -1382,13 +1380,13 @@ start(enum HMC5883_BUS busid, enum Rotation rotation)
|
|
|
|
|
*/ |
|
|
|
|
struct hmc5883_bus_option &find_bus(enum HMC5883_BUS busid) |
|
|
|
|
{ |
|
|
|
|
for (uint8_t i=0; i<NUM_BUS_OPTIONS; i++) { |
|
|
|
|
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) { |
|
|
|
|
if ((busid == HMC5883_BUS_ALL || |
|
|
|
|
busid == bus_options[i].busid) && bus_options[i].dev != NULL) { |
|
|
|
|
return bus_options[i]; |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
errx(1,"bus %u not started", (unsigned)busid); |
|
|
|
|
errx(1, "bus %u not started", (unsigned)busid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1625,6 +1623,8 @@ hmc5883_main(int argc, char *argv[])
@@ -1625,6 +1623,8 @@ hmc5883_main(int argc, char *argv[])
|
|
|
|
|
} else { |
|
|
|
|
errx(1, "calibration failed"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|