44 #include <px4_platform_common/getopt.h> 47 #define I2C_ADDRESS 0x75 48 #define ETS_PATH "/dev/ets_airspeed" 57 #define MIN_ACCURATE_DIFF_PRES_PA 0 60 #define CONVERSION_INTERVAL (1000000 / 100) 99 ret = transfer(&cmd, 1,
nullptr, 0);
114 uint8_t val[2] = {0, 0};
118 ret = transfer(
nullptr, 0, &val[0], 2);
125 float diff_pres_pa_raw = (float)(val[1] << 8 | val[0]);
136 diff_pres_pa_raw = 0.001f * (report.
timestamp & 0x01);
258 if (g_dev !=
nullptr) {
259 PX4_ERR(
"already started");
266 if (g_dev ==
nullptr) {
270 if (
OK != g_dev->
init()) {
289 if (g_dev !=
nullptr) {
303 if (g_dev !=
nullptr) {
308 PX4_ERR(
"driver not running");
329 PX4_ERR(
"driver reset failed");
334 PX4_ERR(
"driver poll restart failed");
347 PX4_INFO(
"usage: ets_airspeed command [options]");
348 PX4_INFO(
"options:");
350 PX4_INFO(
"\t-a --all");
351 PX4_INFO(
"command:");
352 PX4_INFO(
"\tstart|stop|reset|info");
362 const char *myoptarg =
nullptr;
363 bool start_all =
false;
365 while ((ch = px4_getopt(argc, argv,
"ab:", &myoptind, &myoptarg)) != EOF) {
368 i2c_bus = atoi(myoptarg);
381 if (myoptind >= argc) {
389 if (!strcmp(argv[myoptind],
"start")) {
401 if (!strcmp(argv[myoptind],
"stop")) {
408 if (!strcmp(argv[myoptind],
"reset")) {
orb_advert_t _airspeed_pub
void stop()
Stop the automatic measurement state machine.
float differential_pressure_raw_pa
ETSAirspeed(int bus, int address=I2C_ADDRESS, const char *path=ETS_PATH)
#define AIRSPEED0_DEVICE_PATH
#define CONVERSION_INTERVAL
#define SENSOR_POLLRATE_DEFAULT
poll at driver normal rate
__EXPORT int ets_airspeed_main(int argc, char *argv[])
int reset()
Reset the driver.
Local functions in support of the shell command.
#define SENSORIOCSPOLLRATE
Set the driver polling rate to (arg) Hz, or one of the SENSOR_POLLRATE constants. ...
static constexpr uint8_t PX4_I2C_BUS_DEFAULT
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
void perf_count(perf_counter_t handle)
Count a performance event.
perf_counter_t _sample_perf
void perf_end(perf_counter_t handle)
End a performance event.
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
static const int i2c_bus_options[]
int stop()
Stop the driver.
void Run() override
Perform a poll cycle; collect from the previous measurement and start a new one.
#define DRV_DIFF_PRESS_DEVTYPE_MS4525
#define SENSORIOCRESET
Reset the sensor to its default configuration.
uint64_t perf_event_count(perf_counter_t handle)
Return current event_count.
int start_bus(int i2c_bus)
Start the driver on a specific bus.
static void ets_airspeed_usage()
#define NUM_I2C_BUS_OPTIONS
int start()
Attempt to start driver on all available I2C busses.
float differential_pressure_filtered_pa
void perf_begin(perf_counter_t handle)
Begin a performance event.
#define DEVICE_DEBUG(FMT,...)
perf_counter_t _comms_errors
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
void start()
Initialise the automatic measurement state machine and start it.
int info()
Print a little info about the driver.