|
| SF0X (const char *port=SF0X_DEFAULT_PORT, uint8_t rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING) |
|
virtual | ~SF0X () |
|
virtual int | init () override |
|
virtual ssize_t | read (device::file_t *filp, char *buffer, size_t buflen) override |
| Perform a read from the device. More...
|
|
virtual int | ioctl (device::file_t *filp, int cmd, unsigned long arg) override |
| Perform an ioctl operation on the device. More...
|
|
void | print_info () |
| Diagnostics - print some basic information about the driver. More...
|
|
| CDev (const char *devname) |
| Constructor. More...
|
|
| CDev (const CDev &)=delete |
|
CDev & | operator= (const CDev &)=delete |
|
| CDev (CDev &&)=delete |
|
CDev & | operator= (CDev &&)=delete |
|
virtual | ~CDev () |
|
virtual int | open (file_t *filep) |
| Handle an open of the device. More...
|
|
virtual int | close (file_t *filep) |
| Handle a close of the device. More...
|
|
virtual ssize_t | write (file_t *filep, const char *buffer, size_t buflen) |
| Perform a write to the device. More...
|
|
virtual off_t | seek (file_t *filep, off_t offset, int whence) |
| Perform a logical seek operation on the device. More...
|
|
virtual int | poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup) |
| Perform a poll setup/teardown operation. More...
|
|
const char * | get_devname () const |
| Get the device name. More...
|
|
Definition at line 80 of file sf0x.cpp.
◆ SF0X()
SF0X::SF0X |
( |
const char * |
port = SF0X_DEFAULT_PORT , |
|
|
uint8_t |
rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING |
|
) |
| |
◆ ~SF0X()
◆ collect()
Definition at line 454 of file sf0x.cpp.
References _comms_errors, _conversion_interval, _distance_sensor_topic, _fd, _last_read, _linebuf, _linebuf_index, _parse_state, _reports, _rotation, _sample_perf, distance_sensor_s::current_distance, get_maximum_distance(), get_minimum_distance(), hrt_absolute_time(), hrt_elapsed_time(), distance_sensor_s::id, distance_sensor_s::max_distance, distance_sensor_s::min_distance, OK, ORB_ID, orb_publish(), distance_sensor_s::orientation, perf_begin(), perf_count(), perf_end(), cdev::CDev::poll_notify(), read(), sf0x_parser(), distance_sensor_s::signal_quality, distance_sensor_s::timestamp, distance_sensor_s::type, and distance_sensor_s::variance.
Referenced by read(), and Run().
◆ get_maximum_distance()
float SF0X::get_maximum_distance |
( |
| ) |
|
|
private |
◆ get_minimum_distance()
float SF0X::get_minimum_distance |
( |
| ) |
|
|
private |
◆ init()
Reimplemented from cdev::CDev.
Definition at line 207 of file sf0x.cpp.
References _class_instance, _conversion_interval, _distance_sensor_topic, _max_distance, _min_distance, _orb_class_instance, _reports, ToneAlarmInterface::init(), OK, orb_advertise_multi(), ORB_ID, ORB_PRIO_HIGH, param_find(), param_get(), RANGE_FINDER_BASE_DEVICE_PATH, and cdev::CDev::register_class_devname().
Referenced by sf0x::start().
◆ ioctl()
int SF0X::ioctl |
( |
device::file_t * |
filep, |
|
|
int |
cmd, |
|
|
unsigned long |
arg |
|
) |
| |
|
overridevirtual |
◆ measure()
◆ print_info()
void SF0X::print_info |
( |
| ) |
|
◆ read()
ssize_t SF0X::read |
( |
device::file_t * |
filep, |
|
|
char * |
buffer, |
|
|
size_t |
buflen |
|
) |
| |
|
overridevirtual |
◆ Run()
Perform a poll cycle; collect from the previous measurement and start a new one.
Definition at line 547 of file sf0x.cpp.
References _collect_phase, _consecutive_fail_count, _conversion_interval, _fd, _measure_interval, _port, collect(), hrt_absolute_time(), measure(), OK, cdev::CDev::open(), param_find(), param_get(), and start().
◆ set_maximum_distance()
void SF0X::set_maximum_distance |
( |
float |
max | ) |
|
|
private |
◆ set_minimum_distance()
void SF0X::set_minimum_distance |
( |
float |
min | ) |
|
|
private |
Set the min and max distance thresholds if you want the end points of the sensors range to be brought in at all, otherwise it will use the defaults SF0X_MIN_DISTANCE and SF0X_MAX_DISTANCE.
Definition at line 287 of file sf0x.cpp.
References _min_distance, and math::min().
◆ start()
Initialise the automatic measurement state machine and start it.
- Note
- This function is called at open and error time. It might make sense to make it more aggressive about resetting the bus in case of errors.
Definition at line 530 of file sf0x.cpp.
References _collect_phase, and _reports.
Referenced by ioctl(), and Run().
◆ stop()
Stop the automatic measurement state machine.
Definition at line 541 of file sf0x.cpp.
Referenced by ~SF0X().
◆ _class_instance
int SF0X::_class_instance |
|
private |
◆ _collect_phase
bool SF0X::_collect_phase |
|
private |
◆ _comms_errors
◆ _consecutive_fail_count
unsigned SF0X::_consecutive_fail_count |
|
private |
◆ _conversion_interval
int SF0X::_conversion_interval |
|
private |
◆ _distance_sensor_topic
◆ _fd
◆ _last_read
◆ _linebuf
◆ _linebuf_index
unsigned SF0X::_linebuf_index |
|
private |
◆ _max_distance
float SF0X::_max_distance |
|
private |
◆ _measure_interval
int SF0X::_measure_interval |
|
private |
◆ _min_distance
float SF0X::_min_distance |
|
private |
◆ _orb_class_instance
int SF0X::_orb_class_instance |
|
private |
◆ _parse_state
◆ _port
◆ _reports
ringbuffer::RingBuffer* SF0X::_reports |
|
private |
◆ _rotation
◆ _sample_perf
The documentation for this class was generated from the following file:
- src/drivers/distance_sensor/sf0x/sf0x.cpp