PX4 Firmware
PX4 Autopilot Software http://px4.io
leddar_one.cpp File Reference
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <arch/board/board.h>
#include <drivers/device/device.h>
#include <drivers/device/ringbuffer.h>
#include <drivers/drv_hrt.h>
#include <lib/drivers/rangefinder/PX4Rangefinder.hpp>
#include <perf/perf_counter.h>
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/defines.h>
#include <px4_platform_common/getopt.h>
#include <px4_platform_common/module.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <uORB/topics/distance_sensor.h>
Include dependency graph for leddar_one.cpp:

Go to the source code of this file.

Classes

class  LeddarOne
 

Namespaces

 leddar_one
 Local functions in support of the shell command.
 

Macros

#define DEVICE_PATH   "/dev/LeddarOne"
 
#define LEDDAR_ONE_DEFAULT_SERIAL_PORT   "/dev/ttyS3"
 
#define LEDDAR_ONE_FIELD_OF_VIEW   (0.105f)
 
#define LEDDAR_ONE_MAX_DISTANCE   40.0f
 
#define LEDDAR_ONE_MIN_DISTANCE   0.01f
 
#define LEDDAR_ONE_MEASURE_INTERVAL   100_ms
 
#define MODBUS_SLAVE_ADDRESS   0x01
 
#define MODBUS_READING_FUNCTION   0x04
 
#define READING_START_ADDR   0x14
 
#define READING_LEN   0xA
 

Functions

struct __attribute__ ((__packed__)) reading_msg
 
int leddar_one::start (const char *port=LEDDAR_ONE_DEFAULT_SERIAL_PORT, const uint8_t rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
 
int leddar_one::status ()
 Print the driver status. More...
 
int leddar_one::stop ()
 Stop the driver. More...
 
int leddar_one::test (const char *port)
 Perform some basic functional tests on the driver; make sure we can collect data from the sensor in polled and automatic modes. More...
 
int leddar_one::usage ()
 Prints info about the driver argument usage. More...
 
__EXPORT int leddar_one_main (int argc, char *argv[])
 

Variables

static const uint8_t request_reading_msg []
 
LeddarOneleddar_one::g_dev
 

Macro Definition Documentation

◆ DEVICE_PATH

#define DEVICE_PATH   "/dev/LeddarOne"

Definition at line 54 of file leddar_one.cpp.

Referenced by leddar_one::start().

◆ LEDDAR_ONE_DEFAULT_SERIAL_PORT

#define LEDDAR_ONE_DEFAULT_SERIAL_PORT   "/dev/ttyS3"

Definition at line 55 of file leddar_one.cpp.

Referenced by leddar_one_main().

◆ LEDDAR_ONE_FIELD_OF_VIEW

#define LEDDAR_ONE_FIELD_OF_VIEW   (0.105f)

Definition at line 57 of file leddar_one.cpp.

Referenced by LeddarOne::LeddarOne().

◆ LEDDAR_ONE_MAX_DISTANCE

#define LEDDAR_ONE_MAX_DISTANCE   40.0f

Definition at line 59 of file leddar_one.cpp.

Referenced by LeddarOne::LeddarOne().

◆ LEDDAR_ONE_MEASURE_INTERVAL

#define LEDDAR_ONE_MEASURE_INTERVAL   100_ms

◆ LEDDAR_ONE_MIN_DISTANCE

#define LEDDAR_ONE_MIN_DISTANCE   0.01f

Definition at line 60 of file leddar_one.cpp.

Referenced by LeddarOne::LeddarOne().

◆ MODBUS_READING_FUNCTION

#define MODBUS_READING_FUNCTION   0x04

Definition at line 65 of file leddar_one.cpp.

Referenced by LeddarOne::collect().

◆ MODBUS_SLAVE_ADDRESS

#define MODBUS_SLAVE_ADDRESS   0x01

Definition at line 64 of file leddar_one.cpp.

Referenced by LeddarOne::collect().

◆ READING_LEN

#define READING_LEN   0xA

Definition at line 67 of file leddar_one.cpp.

◆ READING_START_ADDR

#define READING_START_ADDR   0x14

Definition at line 66 of file leddar_one.cpp.

Function Documentation

◆ __attribute__()

struct __attribute__ ( (__packed__)  )

Definition at line 80 of file leddar_one.cpp.

Referenced by test_file(), and test_mount().

Here is the caller graph for this function:

◆ leddar_one_main()

__EXPORT int leddar_one_main ( int  argc,
char *  argv[] 
)

Definition at line 593 of file leddar_one.cpp.

References LEDDAR_ONE_DEFAULT_SERIAL_PORT, leddar_one::start(), leddar_one::status(), leddar_one::stop(), leddar_one::test(), and leddar_one::usage().

Here is the call graph for this function:

Variable Documentation

◆ request_reading_msg

const uint8_t request_reading_msg[]
static
Initial value:
= {
0,
0,
0x30,
0x09
}
#define MODBUS_SLAVE_ADDRESS
Definition: leddar_one.cpp:64
#define MODBUS_READING_FUNCTION
Definition: leddar_one.cpp:65
#define READING_START_ADDR
Definition: leddar_one.cpp:66
#define READING_LEN
Definition: leddar_one.cpp:67

Definition at line 69 of file leddar_one.cpp.

Referenced by LeddarOne::measure(), and leddar_one::test().