PX4 Firmware
PX4 Autopilot Software http://px4.io
MappyDot.cpp File Reference
#include <string.h>
#include <containers/Array.hpp>
#include <drivers/device/i2c.h>
#include <drivers/drv_range_finder.h>
#include <perf/perf_counter.h>
#include <px4_platform_common/getopt.h>
#include <px4_platform_common/module_params.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <uORB/topics/distance_sensor.h>
Include dependency graph for MappyDot.cpp:

Go to the source code of this file.

Classes

class  MappyDot
 

Namespaces

 mappydot
 Local functions in support of the shell command.
 

Macros

#define MAPPYDOT_MEASUREMENT_BUDGET   0x42
 
#define MAPPYDOT_READ_ERROR_CODE   0x45
 
#define MAPPYDOT_CHECK_INTERRUPT   0x49
 
#define MAPPYDOT_READ_ACCURACY   0x52
 
#define MAPPYDOT_PERFORM_SINGLE_RANGE   0x53
 
#define MAPPYDOT_SET_CONTINUOUS_RANGING_MODE   0x63
 
#define MAPPYDOT_RANGING_MEASUREMENT_MODE   0x6D
 
#define MAPPYDOT_READ_DISTANCE   0x72
 
#define MAPPYDOT_SET_SINGLE_RANGING_MODE   0x73
 
#define MAPPYDOT_FILTERING_ENABLE   0x46
 
#define MAPPYDOT_SIGNAL_LIMIT_CHECK_VALUE   0x47
 
#define MAPPYDOT_ENABLE_CROSSTALK_COMPENSATION   0x4B
 
#define MAPPYDOT_SIGMA_LIMIT_CHECK_VALUE   0x4C
 
#define MAPPYDOT_INTERSENSOR_CROSSTALK_MEASUREMENT_DELAY   0x51
 
#define MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_ENABLE   0x54
 
#define MAPPYDOT_AVERAGING_ENABLE   0x56
 
#define MAPPYDOT_INTERSENSOR_SYNC_ENABLE   0x59
 
#define MAPPYDOT_CALIBRATE_DISTANCE_OFFSET   0x61
 
#define MAPPYDOT_SET_LED_THRESHOLD_DISTANCE_IN_MM   0x65
 
#define MAPPYDOT_FILTERING_DISABLE   0x66
 
#define MAPPYDOT_SET_GPIO_MODE   0x67
 
#define MAPPYDOT_AVERAGING_SAMPLES   0x69
 
#define MAPPYDOT_DISABLE_CROSSTALK_COMPENSATION   0x6B
 
#define MAPPYDOT_SET_LED_MODE   0x6C
 
#define MAPPYDOT_SET_GPIO_THRESHOLD_DISTANCE_IN_MM   0x6F
 
#define MAPPYDOT_REGION_OF_INTEREST   0x70
 
#define MAPPYDOT_INTERSENSOR_CROSSTALK_TIMEOUT   0x71
 
#define MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_DISABLE   0x74
 
#define MAPPYDOT_CALIBRATE_SPAD   0x75
 
#define MAPPYDOT_AVERAGING_DISABLE   0x76
 
#define MAPPYDOT_CALIBRATE_CROSSTALK   0x78
 
#define MAPPYDOT_INTERSENSOR_SYNC_DISABLE   0x79
 
#define MAPPYDOT_FIRMWARE_VERSION   0x4E
 
#define MAPPYDOT_READ_CURRENT_SETTINGS   0x62
 
#define MAPPYDOT_DEVICE_NAME   0x64
 
#define MAPPYDOT_NAME_DEVICE   0x6E
 
#define MAPPYDOT_WRITE_CURRENT_SETTINGS_AS_START_UP_DEFAULT   0x77
 
#define MAPPYDOT_RESTORE_FACTORY_DEFAULTS   0x7A
 
#define MAPPYDOT_AMBIENT_RATE_RETURN   0x41
 
#define MAPPYDOT_VL53L1X_NOT_SHUTDOWN   0x48
 
#define MAPPYDOT_SIGNAL_RATE_RETURN   0x4A
 
#define MAPPYDOT_RESET_VL53L1X_RANGING   0x58
 
#define MAPPYDOT_VL53L1X_SHUTDOWN   0x68
 
#define MAPPYDOT_READ_NONFILTERED_VALUE   0x6A
 
#define MAPPYDOT_ENTER_FACTORY_MODE   0x23
 
#define MAPPYDOT_WIPE_ALL_SETTINGS   0x3C
 
#define MAPPYDOT_LONG_RANGE   0x6C
 
#define MAPPYDOT_MED_RANGE   0x6D
 
#define MAPPYDOT_SHORT_RANGE   0x73
 
#define MAPPYDOT_LED_OFF   0x66
 
#define MAPPYDOT_LED_MEASUREMENT_OUTPUT   0x6D
 
#define MAPPYDOT_LED_ON   0x6F
 
#define MAPPYDOT_LED_PWM_ENABLED   0x70
 
#define MAPPYDOT_LED_THRESHOLD_ENABLED   0x74
 
#define MAPPYDOT_GPIO_LOW   0x66
 
#define MAPPYDOT_GPIO_MEASUREMENT_INTERRUPT   0x6D
 
#define MAPPYDOT_GPIO_HIGH   0x6F
 
#define MAPPYDOT_GPIO_PWM_ENABLED   0x70
 
#define MAPPYDOT_GPIO_THRESHOLD_ENABLED   0x74
 
#define MAPPYDOT_REBOOT_TO_BOOTLOADER   0x01
 
#define MAPPYDOT_MIN_DISTANCE   (0.2f)
 
#define MAPPYDOT_MAX_DISTANCE   (4.f)
 
#define MAPPYDOT_BUS_CLOCK   400000
 
#define MAPPYDOT_DEVICE_PATH   "/dev/mappydot"
 
#define MAPPYDOT_BASE_ADDR   0x08
 
#define MAPPYDOT_BUS_DEFAULT   PX4_I2C_BUS_EXPANSION
 
#define MAPPYDOT_MEASUREMENT_INTERVAL_USEC   50000
 

Functions

int mappydot::start ()
 Attempt to start driver on all available I2C busses. More...
 
int mappydot::start_bus (int i2c_bus)
 Start the driver on a specific bus. More...
 
int mappydot::status ()
 Print the driver status. More...
 
int mappydot::stop ()
 Stop the driver. More...
 
int mappydot::usage ()
 Print usage information about the driver. More...
 
__EXPORT int mappydot_main (int argc, char *argv[])
 Driver 'main' command. More...
 

Variables

MappyDotmappydot::g_dev
 

Detailed Description

Author
Mohammed Kabir (mhkab.nosp@m.ir@m.nosp@m.it.ed.nosp@m.u)
Mark Sauder (mcsau.nosp@m.der@.nosp@m.gmail.nosp@m..com)

Driver for Mappydot infrared rangefinders connected via I2C.

Definition in file MappyDot.cpp.

Macro Definition Documentation

◆ MAPPYDOT_AMBIENT_RATE_RETURN

#define MAPPYDOT_AMBIENT_RATE_RETURN   0x41

Definition at line 99 of file MappyDot.cpp.

◆ MAPPYDOT_AVERAGING_DISABLE

#define MAPPYDOT_AVERAGING_DISABLE   0x76

Definition at line 86 of file MappyDot.cpp.

◆ MAPPYDOT_AVERAGING_ENABLE

#define MAPPYDOT_AVERAGING_ENABLE   0x56

Definition at line 72 of file MappyDot.cpp.

◆ MAPPYDOT_AVERAGING_SAMPLES

#define MAPPYDOT_AVERAGING_SAMPLES   0x69

Definition at line 78 of file MappyDot.cpp.

◆ MAPPYDOT_BASE_ADDR

#define MAPPYDOT_BASE_ADDR   0x08

Definition at line 140 of file MappyDot.cpp.

Referenced by MappyDot::init().

◆ MAPPYDOT_BUS_CLOCK

#define MAPPYDOT_BUS_CLOCK   400000

Definition at line 136 of file MappyDot.cpp.

◆ MAPPYDOT_BUS_DEFAULT

#define MAPPYDOT_BUS_DEFAULT   PX4_I2C_BUS_EXPANSION

Definition at line 141 of file MappyDot.cpp.

Referenced by mappydot_main(), and mappydot::usage().

◆ MAPPYDOT_CALIBRATE_CROSSTALK

#define MAPPYDOT_CALIBRATE_CROSSTALK   0x78

Definition at line 87 of file MappyDot.cpp.

◆ MAPPYDOT_CALIBRATE_DISTANCE_OFFSET

#define MAPPYDOT_CALIBRATE_DISTANCE_OFFSET   0x61

Definition at line 74 of file MappyDot.cpp.

◆ MAPPYDOT_CALIBRATE_SPAD

#define MAPPYDOT_CALIBRATE_SPAD   0x75

Definition at line 85 of file MappyDot.cpp.

◆ MAPPYDOT_CHECK_INTERRUPT

#define MAPPYDOT_CHECK_INTERRUPT   0x49

Definition at line 57 of file MappyDot.cpp.

◆ MAPPYDOT_DEVICE_NAME

#define MAPPYDOT_DEVICE_NAME   0x64

Definition at line 93 of file MappyDot.cpp.

◆ MAPPYDOT_DEVICE_PATH

#define MAPPYDOT_DEVICE_PATH   "/dev/mappydot"

Definition at line 137 of file MappyDot.cpp.

◆ MAPPYDOT_DISABLE_CROSSTALK_COMPENSATION

#define MAPPYDOT_DISABLE_CROSSTALK_COMPENSATION   0x6B

Definition at line 79 of file MappyDot.cpp.

◆ MAPPYDOT_ENABLE_CROSSTALK_COMPENSATION

#define MAPPYDOT_ENABLE_CROSSTALK_COMPENSATION   0x4B

Definition at line 68 of file MappyDot.cpp.

◆ MAPPYDOT_ENTER_FACTORY_MODE

#define MAPPYDOT_ENTER_FACTORY_MODE   0x23

Definition at line 107 of file MappyDot.cpp.

◆ MAPPYDOT_FILTERING_DISABLE

#define MAPPYDOT_FILTERING_DISABLE   0x66

Definition at line 76 of file MappyDot.cpp.

◆ MAPPYDOT_FILTERING_ENABLE

#define MAPPYDOT_FILTERING_ENABLE   0x46

Definition at line 66 of file MappyDot.cpp.

◆ MAPPYDOT_FIRMWARE_VERSION

#define MAPPYDOT_FIRMWARE_VERSION   0x4E

Definition at line 91 of file MappyDot.cpp.

◆ MAPPYDOT_GPIO_HIGH

#define MAPPYDOT_GPIO_HIGH   0x6F

Definition at line 125 of file MappyDot.cpp.

◆ MAPPYDOT_GPIO_LOW

#define MAPPYDOT_GPIO_LOW   0x66

Definition at line 123 of file MappyDot.cpp.

◆ MAPPYDOT_GPIO_MEASUREMENT_INTERRUPT

#define MAPPYDOT_GPIO_MEASUREMENT_INTERRUPT   0x6D

Definition at line 124 of file MappyDot.cpp.

◆ MAPPYDOT_GPIO_PWM_ENABLED

#define MAPPYDOT_GPIO_PWM_ENABLED   0x70

Definition at line 126 of file MappyDot.cpp.

◆ MAPPYDOT_GPIO_THRESHOLD_ENABLED

#define MAPPYDOT_GPIO_THRESHOLD_ENABLED   0x74

Definition at line 127 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_CROSSTALK_MEASUREMENT_DELAY

#define MAPPYDOT_INTERSENSOR_CROSSTALK_MEASUREMENT_DELAY   0x51

Definition at line 70 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_DISABLE

#define MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_DISABLE   0x74

Definition at line 84 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_ENABLE

#define MAPPYDOT_INTERSENSOR_CROSSTALK_REDUCTION_ENABLE   0x54

Definition at line 71 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_CROSSTALK_TIMEOUT

#define MAPPYDOT_INTERSENSOR_CROSSTALK_TIMEOUT   0x71

Definition at line 83 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_SYNC_DISABLE

#define MAPPYDOT_INTERSENSOR_SYNC_DISABLE   0x79

Definition at line 88 of file MappyDot.cpp.

◆ MAPPYDOT_INTERSENSOR_SYNC_ENABLE

#define MAPPYDOT_INTERSENSOR_SYNC_ENABLE   0x59

Definition at line 73 of file MappyDot.cpp.

◆ MAPPYDOT_LED_MEASUREMENT_OUTPUT

#define MAPPYDOT_LED_MEASUREMENT_OUTPUT   0x6D

Definition at line 117 of file MappyDot.cpp.

◆ MAPPYDOT_LED_OFF

#define MAPPYDOT_LED_OFF   0x66

Definition at line 116 of file MappyDot.cpp.

◆ MAPPYDOT_LED_ON

#define MAPPYDOT_LED_ON   0x6F

Definition at line 118 of file MappyDot.cpp.

◆ MAPPYDOT_LED_PWM_ENABLED

#define MAPPYDOT_LED_PWM_ENABLED   0x70

Definition at line 119 of file MappyDot.cpp.

◆ MAPPYDOT_LED_THRESHOLD_ENABLED

#define MAPPYDOT_LED_THRESHOLD_ENABLED   0x74

Definition at line 120 of file MappyDot.cpp.

◆ MAPPYDOT_LONG_RANGE

#define MAPPYDOT_LONG_RANGE   0x6C

Definition at line 111 of file MappyDot.cpp.

Referenced by MappyDot::init().

◆ MAPPYDOT_MAX_DISTANCE

#define MAPPYDOT_MAX_DISTANCE   (4.f)

Definition at line 134 of file MappyDot.cpp.

Referenced by MappyDot::collect().

◆ MAPPYDOT_MEASUREMENT_BUDGET

#define MAPPYDOT_MEASUREMENT_BUDGET   0x42

Definition at line 55 of file MappyDot.cpp.

Referenced by MappyDot::init().

◆ MAPPYDOT_MEASUREMENT_INTERVAL_USEC

#define MAPPYDOT_MEASUREMENT_INTERVAL_USEC   50000

Definition at line 142 of file MappyDot.cpp.

Referenced by MappyDot::init(), and MappyDot::start().

◆ MAPPYDOT_MED_RANGE

#define MAPPYDOT_MED_RANGE   0x6D

Definition at line 112 of file MappyDot.cpp.

◆ MAPPYDOT_MIN_DISTANCE

#define MAPPYDOT_MIN_DISTANCE   (0.2f)

Definition at line 133 of file MappyDot.cpp.

Referenced by MappyDot::collect().

◆ MAPPYDOT_NAME_DEVICE

#define MAPPYDOT_NAME_DEVICE   0x6E

Definition at line 94 of file MappyDot.cpp.

◆ MAPPYDOT_PERFORM_SINGLE_RANGE

#define MAPPYDOT_PERFORM_SINGLE_RANGE   0x53

Definition at line 59 of file MappyDot.cpp.

Referenced by MappyDot::probe().

◆ MAPPYDOT_RANGING_MEASUREMENT_MODE

#define MAPPYDOT_RANGING_MEASUREMENT_MODE   0x6D

Definition at line 61 of file MappyDot.cpp.

Referenced by MappyDot::init().

◆ MAPPYDOT_READ_ACCURACY

#define MAPPYDOT_READ_ACCURACY   0x52

Definition at line 58 of file MappyDot.cpp.

◆ MAPPYDOT_READ_CURRENT_SETTINGS

#define MAPPYDOT_READ_CURRENT_SETTINGS   0x62

Definition at line 92 of file MappyDot.cpp.

◆ MAPPYDOT_READ_DISTANCE

#define MAPPYDOT_READ_DISTANCE   0x72

Definition at line 62 of file MappyDot.cpp.

◆ MAPPYDOT_READ_ERROR_CODE

#define MAPPYDOT_READ_ERROR_CODE   0x45

Definition at line 56 of file MappyDot.cpp.

◆ MAPPYDOT_READ_NONFILTERED_VALUE

#define MAPPYDOT_READ_NONFILTERED_VALUE   0x6A

Definition at line 104 of file MappyDot.cpp.

◆ MAPPYDOT_REBOOT_TO_BOOTLOADER

#define MAPPYDOT_REBOOT_TO_BOOTLOADER   0x01

Definition at line 130 of file MappyDot.cpp.

◆ MAPPYDOT_REGION_OF_INTEREST

#define MAPPYDOT_REGION_OF_INTEREST   0x70

Definition at line 82 of file MappyDot.cpp.

◆ MAPPYDOT_RESET_VL53L1X_RANGING

#define MAPPYDOT_RESET_VL53L1X_RANGING   0x58

Definition at line 102 of file MappyDot.cpp.

◆ MAPPYDOT_RESTORE_FACTORY_DEFAULTS

#define MAPPYDOT_RESTORE_FACTORY_DEFAULTS   0x7A

Definition at line 96 of file MappyDot.cpp.

◆ MAPPYDOT_SET_CONTINUOUS_RANGING_MODE

#define MAPPYDOT_SET_CONTINUOUS_RANGING_MODE   0x63

Definition at line 60 of file MappyDot.cpp.

◆ MAPPYDOT_SET_GPIO_MODE

#define MAPPYDOT_SET_GPIO_MODE   0x67

Definition at line 77 of file MappyDot.cpp.

◆ MAPPYDOT_SET_GPIO_THRESHOLD_DISTANCE_IN_MM

#define MAPPYDOT_SET_GPIO_THRESHOLD_DISTANCE_IN_MM   0x6F

Definition at line 81 of file MappyDot.cpp.

◆ MAPPYDOT_SET_LED_MODE

#define MAPPYDOT_SET_LED_MODE   0x6C

Definition at line 80 of file MappyDot.cpp.

◆ MAPPYDOT_SET_LED_THRESHOLD_DISTANCE_IN_MM

#define MAPPYDOT_SET_LED_THRESHOLD_DISTANCE_IN_MM   0x65

Definition at line 75 of file MappyDot.cpp.

Referenced by MappyDot::init().

◆ MAPPYDOT_SET_SINGLE_RANGING_MODE

#define MAPPYDOT_SET_SINGLE_RANGING_MODE   0x73

Definition at line 63 of file MappyDot.cpp.

◆ MAPPYDOT_SHORT_RANGE

#define MAPPYDOT_SHORT_RANGE   0x73

Definition at line 113 of file MappyDot.cpp.

◆ MAPPYDOT_SIGMA_LIMIT_CHECK_VALUE

#define MAPPYDOT_SIGMA_LIMIT_CHECK_VALUE   0x4C

Definition at line 69 of file MappyDot.cpp.

◆ MAPPYDOT_SIGNAL_LIMIT_CHECK_VALUE

#define MAPPYDOT_SIGNAL_LIMIT_CHECK_VALUE   0x47

Definition at line 67 of file MappyDot.cpp.

◆ MAPPYDOT_SIGNAL_RATE_RETURN

#define MAPPYDOT_SIGNAL_RATE_RETURN   0x4A

Definition at line 101 of file MappyDot.cpp.

◆ MAPPYDOT_VL53L1X_NOT_SHUTDOWN

#define MAPPYDOT_VL53L1X_NOT_SHUTDOWN   0x48

Definition at line 100 of file MappyDot.cpp.

◆ MAPPYDOT_VL53L1X_SHUTDOWN

#define MAPPYDOT_VL53L1X_SHUTDOWN   0x68

Definition at line 103 of file MappyDot.cpp.

◆ MAPPYDOT_WIPE_ALL_SETTINGS

#define MAPPYDOT_WIPE_ALL_SETTINGS   0x3C

Definition at line 108 of file MappyDot.cpp.

◆ MAPPYDOT_WRITE_CURRENT_SETTINGS_AS_START_UP_DEFAULT

#define MAPPYDOT_WRITE_CURRENT_SETTINGS_AS_START_UP_DEFAULT   0x77

Definition at line 95 of file MappyDot.cpp.

Function Documentation

◆ mappydot_main()

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

Driver 'main' command.

Definition at line 563 of file MappyDot.cpp.

References MAPPYDOT_BUS_DEFAULT, mappydot::start(), mappydot::start_bus(), mappydot::status(), mappydot::stop(), and mappydot::usage().

Here is the call graph for this function: