PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
IRLOCK (int bus=IRLOCK_I2C_BUS, int address=IRLOCK_I2C_ADDRESS) | |
constructor More... | |
virtual | ~IRLOCK () |
destructor More... | |
virtual int | init () |
initialise driver to communicate with sensor More... | |
virtual int | probe () |
probe the device is on the I2C bus More... | |
virtual int | info () |
display driver info More... | |
virtual int | test () |
test driver More... | |
virtual ssize_t | read (struct file *filp, char *buffer, size_t buflen) |
Private Member Functions | |
void | start () |
start periodic reads from sensor More... | |
void | stop () |
stop periodic reads from sensor More... | |
void | Run () override |
read from device and schedule next read More... | |
int | read_device () |
low level communication with sensor More... | |
bool | sync_device () |
sync device to ensure reading starts at new frame More... | |
int | read_device_word (uint16_t *word) |
read a word (two bytes) from sensor More... | |
int | read_device_block (struct irlock_target_s *block) |
read a single block (a full frame) from sensor More... | |
Private Attributes | |
ringbuffer::RingBuffer * | _reports |
internal variables More... | |
bool | _sensor_ok |
uint32_t | _read_failures |
int | _orb_class_instance |
orb_advert_t | _irlock_report_topic |
Definition at line 99 of file irlock.cpp.
IRLOCK::IRLOCK | ( | int | bus = IRLOCK_I2C_BUS , |
int | address = IRLOCK_I2C_ADDRESS |
||
) |
constructor
Definition at line 149 of file irlock.cpp.
Referenced by irlock_main().
|
virtual |
destructor
clear reports queue
Definition at line 161 of file irlock.cpp.
References _reports, and stop().
|
virtual |
display driver info
display reports in queue
Definition at line 213 of file irlock.cpp.
References _read_failures, _reports, _sensor_ok, errx, OK, and warnx.
|
virtual |
initialise driver to communicate with sensor
initialise I2C bus
allocate buffer storing values read from sensor
start work queue
Definition at line 172 of file irlock.cpp.
References _reports, _sensor_ok, ToneAlarmInterface::init(), OK, and start().
|
virtual |
|
virtual |
|
private |
low level communication with sensor
read all available frames from sensor
if we sync, then we are starting a new frame, else fail
Definition at line 344 of file irlock.cpp.
References _irlock_report_topic, _orb_class_instance, _reports, DEVICE_LOG, hrt_absolute_time(), IRLOCK_OBJECTS_MAX, irlock_s::num_targets, OK, orb_advertise_multi(), ORB_ID, ORB_PRIO_LOW, orb_publish(), irlock_report_s::pos_x, irlock_target_s::pos_x, irlock_report_s::pos_y, irlock_target_s::pos_y, read_device_block(), irlock_report_s::signature, irlock_target_s::signature, irlock_report_s::size_x, irlock_target_s::size_x, irlock_report_s::size_y, irlock_target_s::size_y, sync_device(), irlock_s::targets, irlock_report_s::timestamp, and irlock_s::timestamp.
Referenced by Run().
|
private |
read a single block (a full frame) from sensor
crc check
convert to angles
Definition at line 406 of file irlock.cpp.
References _read_failures, IRLOCK_CENTER_X, IRLOCK_CENTER_Y, IRLOCK_TAN_ANG_PER_PIXEL_X, IRLOCK_TAN_ANG_PER_PIXEL_Y, irlock_target_s::pos_x, irlock_target_s::pos_y, irlock_report_s::signature, irlock_target_s::signature, irlock_target_s::size_x, irlock_target_s::size_y, and status.
Referenced by read_device().
|
private |
read a word (two bytes) from sensor
Definition at line 394 of file irlock.cpp.
References status.
Referenced by sync_device().
|
overrideprivate |
read from device and schedule next read
ignoring failure, if we do, we will be back again right away...
schedule the next cycle
Definition at line 287 of file irlock.cpp.
References IRLOCK_CONVERSION_INTERVAL_US, and read_device().
|
private |
start periodic reads from sensor
flush ring and reset state machine
start work queue cycle
Definition at line 272 of file irlock.cpp.
References _reports.
Referenced by init().
|
private |
stop periodic reads from sensor
Definition at line 282 of file irlock.cpp.
Referenced by ~IRLOCK().
|
private |
sync device to ensure reading starts at new frame
Definition at line 320 of file irlock.cpp.
References IRLOCK_ADJUST, IRLOCK_RESYNC, IRLOCK_SYNC, OK, and read_device_word().
Referenced by read_device().
|
virtual |
test driver
exit immediately if driver not running
exit immediately if sensor is not healty
instructions to user
read from sensor for 10 seconds
output all objects found
sleep for 0.05 seconds
Definition at line 232 of file irlock.cpp.
References _reports, _sensor_ok, errx, hrt_absolute_time(), irlock_s::num_targets, OK, irlock_target_s::pos_x, irlock_target_s::pos_y, irlock_target_s::signature, irlock_target_s::size_x, irlock_target_s::size_y, irlock_s::targets, and warnx.
|
private |
Definition at line 135 of file irlock.cpp.
Referenced by read_device().
|
private |
Definition at line 134 of file irlock.cpp.
Referenced by read_device().
|
private |
Definition at line 132 of file irlock.cpp.
Referenced by info(), and read_device_block().
|
private |
internal variables
Definition at line 130 of file irlock.cpp.
Referenced by info(), init(), read(), read_device(), start(), test(), and ~IRLOCK().
|
private |
Definition at line 131 of file irlock.cpp.