PX4 Firmware
PX4 Autopilot Software http://px4.io
irlock.cpp File Reference
#include <string.h>
#include <drivers/device/i2c.h>
#include <drivers/device/ringbuffer.h>
#include <px4_platform_common/getopt.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <systemlib/err.h>
#include <uORB/uORB.h>
#include <uORB/topics/irlock_report.h>
Include dependency graph for irlock.cpp:

Go to the source code of this file.

Classes

struct  irlock_target_s
 
struct  irlock_s
 irlock_s structure returned from read calls More...
 
class  IRLOCK
 

Macros

#define IRLOCK_I2C_BUS   PX4_I2C_BUS_EXPANSION
 Configuration Constants. More...
 
#define IRLOCK_I2C_ADDRESS   0x54 /** 7-bit address (non shifted) **/
 
#define IRLOCK_CONVERSION_INTERVAL_US   20000U /** us = 20ms = 50Hz **/
 
#define IRLOCK_SYNC   0xAA55
 
#define IRLOCK_RESYNC   0x5500
 
#define IRLOCK_ADJUST   0xAA
 
#define IRLOCK_RES_X   320
 
#define IRLOCK_RES_Y   200
 
#define IRLOCK_CENTER_X   (IRLOCK_RES_X/2)
 
#define IRLOCK_CENTER_Y   (IRLOCK_RES_Y/2)
 
#define IRLOCK_FOV_X   (60.0f*M_PI_F/180.0f)
 
#define IRLOCK_FOV_Y   (35.0f*M_PI_F/180.0f)
 
#define IRLOCK_TAN_HALF_FOV_X   0.57735026919f
 
#define IRLOCK_TAN_HALF_FOV_Y   0.31529878887f
 
#define IRLOCK_TAN_ANG_PER_PIXEL_X   (2*IRLOCK_TAN_HALF_FOV_X/IRLOCK_RES_X)
 
#define IRLOCK_TAN_ANG_PER_PIXEL_Y   (2*IRLOCK_TAN_HALF_FOV_Y/IRLOCK_RES_Y)
 
#define IRLOCK_BASE_DEVICE_PATH   "/dev/irlock"
 
#define IRLOCK0_DEVICE_PATH   "/dev/irlock0"
 
#define IRLOCK_OBJECTS_MAX   5 /** up to 5 objects can be detected/reported **/
 

Functions

void irlock_usage ()
 
__EXPORT int irlock_main (int argc, char *argv[])
 

Detailed Description

Author
Michael Landes

Driver for an IR-Lock and Pixy vision sensor connected via I2C.

Created on: Nov 12, 2014

Definition in file irlock.cpp.

Macro Definition Documentation

◆ IRLOCK0_DEVICE_PATH

#define IRLOCK0_DEVICE_PATH   "/dev/irlock0"

Definition at line 80 of file irlock.cpp.

◆ IRLOCK_ADJUST

#define IRLOCK_ADJUST   0xAA

Definition at line 62 of file irlock.cpp.

Referenced by IRLOCK::sync_device().

◆ IRLOCK_BASE_DEVICE_PATH

#define IRLOCK_BASE_DEVICE_PATH   "/dev/irlock"

Definition at line 79 of file irlock.cpp.

◆ IRLOCK_CENTER_X

#define IRLOCK_CENTER_X   (IRLOCK_RES_X/2)

Definition at line 67 of file irlock.cpp.

Referenced by IRLOCK::read_device_block().

◆ IRLOCK_CENTER_Y

#define IRLOCK_CENTER_Y   (IRLOCK_RES_Y/2)

Definition at line 68 of file irlock.cpp.

Referenced by IRLOCK::read_device_block().

◆ IRLOCK_CONVERSION_INTERVAL_US

#define IRLOCK_CONVERSION_INTERVAL_US   20000U /** us = 20ms = 50Hz **/

Definition at line 58 of file irlock.cpp.

Referenced by IRLOCK::Run().

◆ IRLOCK_FOV_X

#define IRLOCK_FOV_X   (60.0f*M_PI_F/180.0f)

Definition at line 70 of file irlock.cpp.

◆ IRLOCK_FOV_Y

#define IRLOCK_FOV_Y   (35.0f*M_PI_F/180.0f)

Definition at line 71 of file irlock.cpp.

◆ IRLOCK_I2C_ADDRESS

#define IRLOCK_I2C_ADDRESS   0x54 /** 7-bit address (non shifted) **/

Definition at line 57 of file irlock.cpp.

Referenced by irlock_main().

◆ IRLOCK_I2C_BUS

#define IRLOCK_I2C_BUS   PX4_I2C_BUS_EXPANSION

Configuration Constants.

Definition at line 56 of file irlock.cpp.

Referenced by irlock_main(), and irlock_usage().

◆ IRLOCK_OBJECTS_MAX

#define IRLOCK_OBJECTS_MAX   5 /** up to 5 objects can be detected/reported **/

Definition at line 82 of file irlock.cpp.

Referenced by IRLOCK::read_device().

◆ IRLOCK_RES_X

#define IRLOCK_RES_X   320

Definition at line 64 of file irlock.cpp.

◆ IRLOCK_RES_Y

#define IRLOCK_RES_Y   200

Definition at line 65 of file irlock.cpp.

◆ IRLOCK_RESYNC

#define IRLOCK_RESYNC   0x5500

Definition at line 61 of file irlock.cpp.

Referenced by IRLOCK::sync_device().

◆ IRLOCK_SYNC

#define IRLOCK_SYNC   0xAA55

Definition at line 60 of file irlock.cpp.

Referenced by IRLOCK::sync_device().

◆ IRLOCK_TAN_ANG_PER_PIXEL_X

#define IRLOCK_TAN_ANG_PER_PIXEL_X   (2*IRLOCK_TAN_HALF_FOV_X/IRLOCK_RES_X)

Definition at line 76 of file irlock.cpp.

Referenced by IRLOCK::read_device_block().

◆ IRLOCK_TAN_ANG_PER_PIXEL_Y

#define IRLOCK_TAN_ANG_PER_PIXEL_Y   (2*IRLOCK_TAN_HALF_FOV_Y/IRLOCK_RES_Y)

Definition at line 77 of file irlock.cpp.

Referenced by IRLOCK::read_device_block().

◆ IRLOCK_TAN_HALF_FOV_X

#define IRLOCK_TAN_HALF_FOV_X   0.57735026919f

Definition at line 73 of file irlock.cpp.

◆ IRLOCK_TAN_HALF_FOV_Y

#define IRLOCK_TAN_HALF_FOV_Y   0.31529878887f

Definition at line 74 of file irlock.cpp.

Function Documentation

◆ irlock_main()

int irlock_main ( int  argc,
char *  argv[] 
)

start driver

instantiate global instance

initialise global instance

need the driver past this point

stop the driver

Print driver information

test driver

display usage info

Definition at line 441 of file irlock.cpp.

References command, errx, IRLOCK::IRLOCK(), IRLOCK_I2C_ADDRESS, IRLOCK_I2C_BUS, irlock_usage(), OK, and warnx.

Here is the call graph for this function:

◆ irlock_usage()

void irlock_usage ( )

Definition at line 434 of file irlock.cpp.

References IRLOCK_I2C_BUS, and warnx.

Referenced by irlock_main().

Here is the caller graph for this function: