|
HiTechnic IR Link Sensor driver
#define BUF_DATASIZE 11 |
max size of encoded buffer
Definition at line 58 of file hitechnic-irlink.h.
#define BUF_HEADSIZE 3 |
I2C buff size, address and register
Definition at line 57 of file hitechnic-irlink.h.
#define BUF_TAILSIZE 3 |
IR data length, IR Link mode and start transmission
Definition at line 59 of file hitechnic-irlink.h.
#define PFCHAN | ( | X ) | (X % 8) / 2 |
Definition at line 65 of file hitechnic-irlink.h.
#define PFMOT | ( | X ) | X % 2 |
Definition at line 66 of file hitechnic-irlink.h.
#define PFSPORT | ( | X ) | X / 8 |
Definition at line 64 of file hitechnic-irlink.h.
#define START_DATA 3 |
index of start of data payload
Definition at line 61 of file hitechnic-irlink.h.
#define START_HEAD 0 |
index of start of header
Definition at line 60 of file hitechnic-irlink.h.
#define START_TAIL 15 |
index of start of tail
Definition at line 62 of file hitechnic-irlink.h.
enum eCDMMotorCommand |
CDM_MOTOR_FLOAT |
Float the motor |
CDM_MOTOR_FWD |
Forward |
CDM_MOTOR_BAK |
Reverse |
CDM_MOTOR_BRAKE |
Brake the motor |
Definition at line 128 of file hitechnic-irlink.h.
enum ePWMMotorCommand |
Definition at line 108 of file hitechnic-irlink.h.
enum tPFmotor |
Definition at line 71 of file hitechnic-irlink.h.
void debugIR | ( | tByteArray & | data ) |
Print out the buffer in question to the screen using the following format:
<index> <binary reprentation> <hex representation>
0 11001100 0xCC
It pauses for 10 seconds between each screenful, accompanied by a beep.
Note: this function is only available when driver is compiled with _DEBUG_DRIVER_ defined.
data | the data to be displayed as binary/hex numbers |
Definition at line 179 of file hitechnic-irlink.h.
void decToBin | ( | int | number, |
int | length, | ||
string & | output | ||
) |
Returns a binary representation in a string of an int with specified length
Note: this function is only available when driver is compiled with _DEBUG_DRIVER_ defined.
number | the number to be converted to a binary representation |
length | number of bits to convert |
output | the number converted to binary representation |
Definition at line 156 of file hitechnic-irlink.h.
void encodeBuffer | ( | tByteArray & | iBuffer, |
tByteArray & | oBuffer | ||
) |
Encode the input buffer into a special format for the IRLink.
Note: this is an internal function and should not be called directly.
iBuffer | the data that is be encoded |
oBuffer | output buffer for encoded data |
Definition at line 344 of file hitechnic-irlink.h.
void PFcomboDirectMode | ( | tSensors | link, |
int | channel, | ||
eCDMMotorCommand | _motorB, | ||
eCDMMotorCommand | _motorA | ||
) |
Control two motors using the ComboDirectMode. This mode does not allow for fine grained speed control.
link | the sensor port number |
channel | the channel of the receiver we wish to communicate with, numbered 0-3 |
_motorB | the command to be sent to Motor B |
_motorA | the command to be sent to Motor A |
Definition at line 204 of file hitechnic-irlink.h.
void PFcomboPwmMode | ( | tSensors | link, |
int | channel, | ||
ePWMMotorCommand | _motorB, | ||
ePWMMotorCommand | _motorA | ||
) |
Control two motors using the ComboPWMMode. This mode allows for fine grained speed control.
link | the sensor port number |
channel | the channel of the receiver we wish to communicate with, numbered 0-3 |
_motorB | the command to be sent to Motor B |
_motorA | the command to be sent to Motor A |
Definition at line 249 of file hitechnic-irlink.h.
void PFMotor | ( | tPFmotor | pfmotor, |
ePWMMotorCommand | _motorCmd | ||
) |
Control one motor with no timeout. This mode allows for fine grained speed control.
pfmotor | the motor to which to send the command |
_motorCmd | the command to send to the motor, 0-15 |
Definition at line 332 of file hitechnic-irlink.h.
void PFsinglePinOutputMode | ( | tSensors | link, |
ubyte | channel, | ||
ubyte | _motor, | ||
ePWMMotorCommand | _motorCmd | ||
) |
Control one motor with no timeout. This mode allows for fine grained speed control.
link | the sensor port number |
channel | the channel of the receiver we wish to communicate with, numbered 0-3 |
_motor | the motor to be controlled, 0 or 1, for A or B |
_motorCmd | the command to send to the motor, 0-15 |
Definition at line 295 of file hitechnic-irlink.h.
void transmitIR | ( | tSensors | link, |
tByteArray & | oBuffer, | ||
int | channel | ||
) |
Send the command to the IRLink Sensor for transmission.
Note: this is an internal function and should not be called directly. If the driver is compiled with _DEBUG_DRIVER_, this function will call debugIR() prior to transmitting the data for debugging purposes.
link | the sensor port number |
oBuffer | the data that is be transmitted |
channel | the channel number of the receiver |
Definition at line 391 of file hitechnic-irlink.h.
byte toggle[4] = {0, 0, 0, 0} |
Motor connections
Definition at line 68 of file hitechnic-irlink.h.