PX4 Firmware
PX4 Autopilot Software http://px4.io
mb12xx.cpp File Reference
#include <fcntl.h>
#include <math.h>
#include <poll.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <board_config.h>
#include <containers/Array.hpp>
#include <drivers/device/device.h>
#include <drivers/device/i2c.h>
#include <drivers/device/ringbuffer.h>
#include <drivers/drv_hrt.h>
#include <drivers/drv_range_finder.h>
#include <perf/perf_counter.h>
#include <px4_platform_common/px4_config.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/uORB.h>
#include <uORB/topics/distance_sensor.h>
Include dependency graph for mb12xx.cpp:

Go to the source code of this file.

Classes

class  MB12XX
 

Namespaces

 mb12xx
 Local functions in support of the shell command.
 

Macros

#define MB12XX_BASE_ADDR   0x70
 
#define MB12XX_MIN_ADDR   0x5A
 
#define MB12XX_BUS_DEFAULT   PX4_I2C_BUS_EXPANSION
 
#define MB12XX_BUS_SPEED   100000
 
#define MB12XX_DEVICE_PATH   "/dev/mb12xx"
 
#define MB12XX_TAKE_RANGE_REG   0x51
 
#define MB12XX_SET_ADDRESS_1   0xAA
 
#define MB12XX_SET_ADDRESS_2   0xA5
 
#define MB12XX_MIN_DISTANCE   (0.20f)
 
#define MB12XX_MAX_DISTANCE   (7.65f)
 
#define MB12XX_MEASURE_INTERVAL   100_ms
 
#define MB12XX_INTERVAL_BETWEEN_SUCCESIVE_FIRES   100_ms
 

Functions

int mb12xx::reset ()
 Reset the driver. More...
 
int mb12xx::set_address (const uint8_t address=MB12XX_BASE_ADDR)
 
int mb12xx::start ()
 Attempt to start driver on all available I2C busses. More...
 
int mb12xx::start_bus (const int i2c_bus)
 Start the driver on a specific bus. More...
 
int mb12xx::status ()
 Print the driver status. More...
 
int mb12xx::stop ()
 Stop the driver. More...
 
int mb12xx::test ()
 Perform some basic functional tests on the driver; make sure we can collect data from the sensor in polled and automatic modes. More...
 
int mb12xx::usage ()
 Print information about the driver usage. More...
 
__EXPORT int mb12xx_main (int argc, char *argv[])
 Driver 'main' command. More...
 

Variables

MB12XXmb12xx::g_dev
 

Detailed Description

Author
Greg Hulands
Jon Verbeke jon.v.nosp@m.erbe.nosp@m.ke@ku.nosp@m.leuv.nosp@m.en.be

Driver for the Maxbotix sonar range finders connected via I2C.

Definition in file mb12xx.cpp.

Macro Definition Documentation

◆ MB12XX_BASE_ADDR

#define MB12XX_BASE_ADDR   0x70

Definition at line 73 of file mb12xx.cpp.

Referenced by MB12XX::init(), and mb12xx_main().

◆ MB12XX_BUS_DEFAULT

#define MB12XX_BUS_DEFAULT   PX4_I2C_BUS_EXPANSION

Definition at line 75 of file mb12xx.cpp.

Referenced by mb12xx_main(), and mb12xx::usage().

◆ MB12XX_BUS_SPEED

#define MB12XX_BUS_SPEED   100000

Definition at line 76 of file mb12xx.cpp.

◆ MB12XX_DEVICE_PATH

#define MB12XX_DEVICE_PATH   "/dev/mb12xx"

Definition at line 77 of file mb12xx.cpp.

Referenced by pmw3901::test().

◆ MB12XX_INTERVAL_BETWEEN_SUCCESIVE_FIRES

#define MB12XX_INTERVAL_BETWEEN_SUCCESIVE_FIRES   100_ms

Definition at line 89 of file mb12xx.cpp.

Referenced by MB12XX::init().

◆ MB12XX_MAX_DISTANCE

#define MB12XX_MAX_DISTANCE   (7.65f)

Definition at line 86 of file mb12xx.cpp.

Referenced by MB12XX::collect().

◆ MB12XX_MEASURE_INTERVAL

#define MB12XX_MEASURE_INTERVAL   100_ms

Definition at line 88 of file mb12xx.cpp.

◆ MB12XX_MIN_ADDR

#define MB12XX_MIN_ADDR   0x5A

Definition at line 74 of file mb12xx.cpp.

Referenced by MB12XX::init().

◆ MB12XX_MIN_DISTANCE

#define MB12XX_MIN_DISTANCE   (0.20f)

Definition at line 85 of file mb12xx.cpp.

Referenced by MB12XX::collect().

◆ MB12XX_SET_ADDRESS_1

#define MB12XX_SET_ADDRESS_1   0xAA

Definition at line 81 of file mb12xx.cpp.

Referenced by MB12XX::set_address().

◆ MB12XX_SET_ADDRESS_2

#define MB12XX_SET_ADDRESS_2   0xA5

Definition at line 82 of file mb12xx.cpp.

Referenced by MB12XX::set_address().

◆ MB12XX_TAKE_RANGE_REG

#define MB12XX_TAKE_RANGE_REG   0x51

Definition at line 80 of file mb12xx.cpp.

Referenced by MB12XX::measure().

Function Documentation

◆ mb12xx_main()

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

Driver 'main' command.

Definition at line 599 of file mb12xx.cpp.

References MB12XX_BASE_ADDR, MB12XX_BUS_DEFAULT, mb12xx::reset(), mb12xx::set_address(), mb12xx::start(), mb12xx::start_bus(), mb12xx::status(), mb12xx::stop(), mb12xx::test(), and mb12xx::usage().

Here is the call graph for this function: