Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Enumerations | Functions | Variables

IR Seeker V2
[HiTechnic]

Files

file  hitechnic-irseeker-v2.h
 

HiTechnic IR Seeker V2 driver.


Defines

#define HTIRS2_I2C_ADDR   0x10
#define HTIRS2_DSP_MODE   0x41
#define HTIRS2_OFFSET   0x42
#define HTIRS2_DC_DIR   0x00
#define HTIRS2_DC_SSTR1   0x01
#define HTIRS2_DC_SSTR2   0x02
#define HTIRS2_DC_SSTR3   0x03
#define HTIRS2_DC_SSTR4   0x04
#define HTIRS2_DC_SSTR5   0x05
#define HTIRS2_DC_SAVG   0x06
#define HTIRS2_AC_DIR   0x07
#define HTIRS2_AC_SSTR1   0x08
#define HTIRS2_AC_SSTR2   0x09
#define HTIRS2_AC_SSTR3   0x0A
#define HTIRS2_AC_SSTR4   0x0B
#define HTIRS2_AC_SSTR5   0x0C

Enumerations

enum  tHTIRS2DSPMode { DSP_1200 = 0, DSP_600 = 1 }

Functions

int HTIRS2readDCDir (tSensors link)
bool HTIRS2readAllDCStrength (tSensors link, int &dcS1, int &dcS2, int &dcS3, int &dcS4, int &dcS5)
int HTIRS2readDCAverage (tSensors link)
bool HTIRS2setDSPMode (tSensors link, tHTIRS2DSPMode mode)
int HTIRS2readACDir (tSensors link)
bool HTIRS2readAllACStrength (tSensors link, int &acS1, int &acS2, int &acS3, int &acS4, int &acS5)
bool HTIRS2readEnhanced (tSensors link, int &dir, int &strength)
int HTIRS2readDCDir (tMUXSensor muxsensor)
bool HTIRS2readAllDCStrength (tMUXSensor muxsensor, int &dcS1, int &dcS2, int &dcS3, int &dcS4, int &dcS5)
int HTIRS2readDCAverage (tMUXSensor muxsensor)
int HTIRS2readACDir (tMUXSensor muxsensor)
bool HTIRS2readAllACStrength (tMUXSensor muxsensor, int &acS1, int &acS2, int &acS3, int &acS4, int &acS5)
bool HTIRS2readEnhanced (tMUXSensor muxsensor, int &dir, int &strength)

Variables

tConfigParams HTIRS2_config = {HTSMUX_CHAN_I2C, 13, 0x10, 0x42}
tByteArray HTIRS2_I2CRequest
tByteArray HTIRS2_I2CReply

Detailed Description

HiTechnic IR Seeker V2


Define Documentation

#define HTIRS2_AC_DIR   0x07

DC Direction data

Definition at line 60 of file hitechnic-irseeker-v2.h.

#define HTIRS2_AC_SSTR1   0x08

AC Sensor 0 signal strength above average

Definition at line 61 of file hitechnic-irseeker-v2.h.

#define HTIRS2_AC_SSTR2   0x09

AC Sensor 1 signal strength above average

Definition at line 62 of file hitechnic-irseeker-v2.h.

#define HTIRS2_AC_SSTR3   0x0A

AC Sensor 2 signal strength above average

Definition at line 63 of file hitechnic-irseeker-v2.h.

#define HTIRS2_AC_SSTR4   0x0B

AC Sensor 3 signal strength above average

Definition at line 64 of file hitechnic-irseeker-v2.h.

#define HTIRS2_AC_SSTR5   0x0C

AC Sensor 4 signal strength above average AC DSP modes

Definition at line 65 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_DIR   0x00

DC Direction data

Definition at line 53 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SAVG   0x06

DC sensor signal strength average

Definition at line 59 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SSTR1   0x01

DC Sensor 0 signal strength above average

Definition at line 54 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SSTR2   0x02

DC Sensor 1 signal strength above average

Definition at line 55 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SSTR3   0x03

DC Sensor 2 signal strength above average

Definition at line 56 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SSTR4   0x04

DC Sensor 3 signal strength above average

Definition at line 57 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DC_SSTR5   0x05

DC Sensor 4 signal strength above average

Definition at line 58 of file hitechnic-irseeker-v2.h.

#define HTIRS2_DSP_MODE   0x41

AC DSP mode - 0 = 1200Hz, 1 = 600Hz

Definition at line 51 of file hitechnic-irseeker-v2.h.

#define HTIRS2_I2C_ADDR   0x10

IR Seeker I2C device address

Definition at line 50 of file hitechnic-irseeker-v2.h.

#define HTIRS2_OFFSET   0x42

Offset for data registers

Definition at line 52 of file hitechnic-irseeker-v2.h.


Enumeration Type Documentation

Enumerator:
DSP_1200 
DSP_600 

Definition at line 69 of file hitechnic-irseeker-v2.h.


Function Documentation

int HTIRS2readACDir ( tSensors  link )

Read the value of the AC Direction data register and return it.

Parameters:
linkthe HTIRS2 port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.
Examples:
hitechnic-irseeker-v2-enhanced-SMUX-test1.c, hitechnic-irseeker-v2-enhanced-test1.c, hitechnic-irseeker-v2-SMUX-test1.c, and hitechnic-irseeker-v2-test1.c.

Definition at line 277 of file hitechnic-irseeker-v2.h.

int HTIRS2readACDir ( tMUXSensor  muxsensor )

Read the value of the AC Direction data register and return it.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.

Definition at line 297 of file hitechnic-irseeker-v2.h.

bool HTIRS2readAllACStrength ( tSensors  link,
int &  acS1,
int &  acS2,
int &  acS3,
int &  acS4,
int &  acS5 
)

Read the value of the all of the internal AC sensors and copy into specified buffer.

Parameters:
linkthe HTIRS2 port number
acS1data from internal sensor nr 1
acS2data from internal sensor nr 2
acS3data from internal sensor nr 3
acS4data from internal sensor nr 4
acS5data from internal sensor nr 5
Returns:
true if no error occured, false if it did
Examples:
hitechnic-irseeker-v2-enhanced-SMUX-test1.c, hitechnic-irseeker-v2-enhanced-test1.c, hitechnic-irseeker-v2-SMUX-test1.c, and hitechnic-irseeker-v2-test1.c.

Definition at line 322 of file hitechnic-irseeker-v2.h.

bool HTIRS2readAllACStrength ( tMUXSensor  muxsensor,
int &  acS1,
int &  acS2,
int &  acS3,
int &  acS4,
int &  acS5 
)

Read the value of the all of the internal AC sensors and copy into specified buffer.

Parameters:
muxsensorthe SMUX sensor port number
acS1data from internal sensor nr 1
acS2data from internal sensor nr 2
acS3data from internal sensor nr 3
acS4data from internal sensor nr 4
acS5data from internal sensor nr 5
Returns:
true if no error occured, false if it did

Definition at line 353 of file hitechnic-irseeker-v2.h.

bool HTIRS2readAllDCStrength ( tMUXSensor  muxsensor,
int &  dcS1,
int &  dcS2,
int &  dcS3,
int &  dcS4,
int &  dcS5 
)

Read the value of the all of the internal DC sensors above average.

Parameters:
muxsensorthe SMUX sensor port number
dcS1data from internal sensor nr 1
dcS2data from internal sensor nr 2
dcS3data from internal sensor nr 3
dcS4data from internal sensor nr 4
dcS5data from internal sensor nr 5
Returns:
true if no error occured, false if it did

Definition at line 188 of file hitechnic-irseeker-v2.h.

bool HTIRS2readAllDCStrength ( tSensors  link,
int &  dcS1,
int &  dcS2,
int &  dcS3,
int &  dcS4,
int &  dcS5 
)

Read the value of the all of the internal DC sensors above average.

Parameters:
linkthe HTIRS2 port number
dcS1data from internal sensor nr 1
dcS2data from internal sensor nr 2
dcS3data from internal sensor nr 3
dcS4data from internal sensor nr 4
dcS5data from internal sensor nr 5
Returns:
true if no error occured, false if it did
Examples:
hitechnic-irseeker-v2-enhanced-SMUX-test1.c, hitechnic-irseeker-v2-enhanced-test1.c, hitechnic-irseeker-v2-SMUX-test1.c, and hitechnic-irseeker-v2-test1.c.

Definition at line 154 of file hitechnic-irseeker-v2.h.

int HTIRS2readDCAverage ( tMUXSensor  muxsensor )

Read the value of the average data register and return it.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.

Definition at line 234 of file hitechnic-irseeker-v2.h.

int HTIRS2readDCAverage ( tSensors  link )

Read the value of the average data register and return it.

Parameters:
linkthe HTIRS2 port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.

Definition at line 214 of file hitechnic-irseeker-v2.h.

int HTIRS2readDCDir ( tMUXSensor  muxsensor )

Read the value of the DC Direction data register and return it.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.

Definition at line 129 of file hitechnic-irseeker-v2.h.

int HTIRS2readDCDir ( tSensors  link )

Read the value of the DC Direction data register and return it.

Parameters:
linkthe HTIRS2 port number
Returns:
value of 0-9, the direction index of the detected IR signal or -1 if an error occurred.
Examples:
hitechnic-irseeker-v2-enhanced-SMUX-test1.c, hitechnic-irseeker-v2-enhanced-test1.c, hitechnic-irseeker-v2-SMUX-test1.c, and hitechnic-irseeker-v2-test1.c.

Definition at line 109 of file hitechnic-irseeker-v2.h.

bool HTIRS2readEnhanced ( tMUXSensor  muxsensor,
int &  dir,
int &  strength 
)

This function calculates the strength and direction based on both the DC and AC signal strengths.

Parameters:
muxsensorthe SMUX sensor port number
dirdirection where the ball is detected, value of 0-9 (0 when no ball is detected)
strengththe strength (and distance) of the ball's IR signal
Returns:
true if no error occured, false if it did

Definition at line 460 of file hitechnic-irseeker-v2.h.

bool HTIRS2readEnhanced ( tSensors  link,
int &  dir,
int &  strength 
)

This function calculates the strength and direction based on both the DC and AC signal strengths.

Parameters:
linkthe HTIRS2 port number
dirdirection where the ball is detected, value of 0-9 (0 when no ball is detected)
strengththe strength (and distance) of the ball's IR signal
Returns:
true if no error occured, false if it did
Examples:
hitechnic-irseeker-v2-enhanced-SMUX-test1.c, and hitechnic-irseeker-v2-enhanced-test1.c.

Definition at line 382 of file hitechnic-irseeker-v2.h.

bool HTIRS2setDSPMode ( tSensors  link,
tHTIRS2DSPMode  mode 
)

Set the DSP mode of the AC carrier wave detector.

Mode is one of: -DSP_1200 -DSP_600

Parameters:
linkthe HTIRS2 port number
modethe frequency that should be detected
Returns:
true if no error occured, false if it did
Examples:
hitechnic-irseeker-v2-enhanced-test1.c, and hitechnic-irseeker-v2-test1.c.

Definition at line 261 of file hitechnic-irseeker-v2.h.


Variable Documentation

tConfigParams HTIRS2_config = {HTSMUX_CHAN_I2C, 13, 0x10, 0x42}

Array to hold SMUX config data for sensor

Definition at line 96 of file hitechnic-irseeker-v2.h.

Array to hold I2C reply data

Definition at line 100 of file hitechnic-irseeker-v2.h.

Array to hold I2C command data

Definition at line 99 of file hitechnic-irseeker-v2.h.