43 #define LPS22HB_CONVERSION_INTERVAL (1000000 / 25) 47 ScheduledWorkItem(MODULE_NAME,
px4::device_bus_to_wq(interface->get_device_id())),
48 _interface(interface),
78 PX4_DEBUG(
"CDev init failed");
102 unsigned dummy = arg;
135 unsigned interval = (1000000 / arg);
158 case DEVIOCGDEVICEID:
163 return CDev::ioctl(filp, cmd, arg);
201 PX4_DEBUG(
"collection error");
224 PX4_DEBUG(
"measure error");
254 #pragma pack(push, 1) 276 uint32_t
P = report.PRESS_OUT_XL + (report.PRESS_OUT_L << 8) + (report.PRESS_OUT_H << 16);
278 uint32_t TEMP_OUT = report.TEMP_OUT_L + (report.TEMP_OUT_H << 8);
282 new_report.
temperature = 42.5f + (TEMP_OUT / 480.0f);
298 PX4_ERR(
"advertise failed");
int reset()
Reset the device.
#define BARO_BASE_DEVICE_PATH
measure the time elapsed performing an event
int measure()
Issue a measurement command.
static constexpr uint8_t PRESS_OUT_XL
virtual int register_class_devname(const char *class_devname)
Register a class device name, automatically adding device class instance suffix if need be...
#define DRV_BARO_DEVTYPE_LPS22HB
#define SENSOR_POLLRATE_DEFAULT
poll at driver normal rate
static constexpr uint8_t TEMP_OUT_H
unsigned _measure_interval
device::Device * _interface
static constexpr uint8_t PRESS_OUT_L
count the number of times an event occurs
void start()
Initialise the automatic measurement state machine and start it.
sensor_baro_s _last_report
used for info()
static constexpr uint8_t CTRL_REG2
void Run() override
Perform a poll cycle; collect from the previous measurement and start a new one.
perf_counter_t _sample_perf
static constexpr uint8_t STATUS
uint32_t get_device_id() const
#define SENSORIOCSPOLLRATE
Set the driver polling rate to (arg) Hz, or one of the SENSOR_POLLRATE constants. ...
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
virtual int ioctl(struct file *filp, int cmd, unsigned long arg)
void perf_count(perf_counter_t handle)
Count a performance event.
void perf_free(perf_counter_t handle)
Free a counter.
void init()
Activates/configures the hardware registers.
virtual int unregister_class_devname(const char *class_devname, unsigned class_instance)
Register a class device name, automatically adding device class instance suffix if need be...
#define LPS22HB_CONVERSION_INTERVAL
static constexpr uint8_t TEMP_OUT_L
perf_counter_t _comms_errors
void perf_end(perf_counter_t handle)
End a performance event.
void print_info()
Diagnostics - print some basic information about the driver.
virtual int write(unsigned address, void *data, unsigned count)
Write directly to the device.
int collect()
Collect the result of the most recent measurement.
int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, const void *data)
virtual int ioctl(unsigned operation, unsigned &arg)
Perform a device-specific operation.
void set_device_type(uint8_t devtype)
virtual bool external() const
static constexpr uint8_t PRESS_OUT_H
LPS22HB(device::Device *interface, const char *path)
struct @83::@85::@87 file
int write_reg(uint8_t reg, uint8_t val)
Write a register.
void perf_print_counter(perf_counter_t handle)
Print one performance counter to stdout.
#define SENSORIOCRESET
Reset the sensor to its default configuration.
uint64_t perf_event_count(perf_counter_t handle)
Return current event_count.
Fundamental base class for all physical drivers (I2C, SPI).
void stop()
Stop the automatic measurement state machine.
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, int priority)
void perf_begin(perf_counter_t handle)
Begin a performance event.
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
virtual int read(unsigned address, void *data, unsigned count)
Read directly from the device.
int read_reg(uint8_t reg, uint8_t &val)
Read a register.