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

IR Link RCX comms
[HiTechnic]

Files

file  hitechnic-irlink-rcx.h
 

HiTechnic IR Link RCX Comms Driver.


Functions

bool HTRCXsendHeader (tSensors link)
void HTRCXencode (tSensors link, tByteArray &iBuffer, tByteArray &oBuffer)
bool HTRCXreadResp (tSensors link, tByteArray &response)
bool HTRCXplaySound (tSensors link, unsigned byte sound)
bool HTRCXsendByte (tSensors link, unsigned byte data)
bool HTRCXsendWord (tSensors link, short data)
bool HTRCXmotorOn (tSensors link, unsigned byte _motor)
bool HTRCXmotorOff (tSensors link, unsigned byte _motor)
bool HTRCXmotorFwd (tSensors link, unsigned byte _motor)
bool HTRCXmotorRev (tSensors link, unsigned byte _motor)
bool HTRCXmotorPwr (tSensors link, unsigned byte _motor, unsigned byte power)

Variables

tByteArray HTRCXI2CRequest
tByteArray HTRCXI2CReply
tByteArray HTRCXIRMsg
byte HTRCXCmdToggle = 0

Detailed Description

HiTechnic IR Link RCX Comms Driver


Function Documentation

void HTRCXencode ( tSensors  link,
tByteArray iBuffer,
tByteArray oBuffer 
)

This encodes the message into the standard RCX format with opcodes, data and their complements, followed by a checksum.
The output is an I2C message that can be sent to the IR Link.
This does NOT send the IR message header.

Note: this is an internal function and should be not be called directly.

Parameters:
linkthe sensor port number
iBufferthe IR message that is to be sent by the IR Link to the RCX
oBufferthe I2C message to be sent to the IR Link

Definition at line 99 of file hitechnic-irlink-rcx.h.

bool HTRCXmotorFwd ( tSensors  link,
unsigned byte  _motor 
)

Move the specified motor forward

NOTE: This does not currently work with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
_motorthe motor channel to move forward
Returns:
true if no error occured, false if it did

Definition at line 298 of file hitechnic-irlink-rcx.h.

bool HTRCXmotorOff ( tSensors  link,
unsigned byte  _motor 
)

Turn the specified motor off

NOTE: This does not currently work with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
_motorthe motor channel to turn off
Returns:
true if no error occured, false if it did

Definition at line 273 of file hitechnic-irlink-rcx.h.

bool HTRCXmotorOn ( tSensors  link,
unsigned byte  _motor 
)

Turn the specified motor on

NOTE: This does not currently work with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
_motorthe motor channel to turn on
Returns:
true if no error occured, false if it did

Definition at line 248 of file hitechnic-irlink-rcx.h.

bool HTRCXmotorPwr ( tSensors  link,
unsigned byte  _motor,
unsigned byte  power 
)

Set the motor power.

NOTE: This does not currently work with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
_motorthe motor channel to change the power level of
powerthe amount of power to be applied to the motor
Returns:
true if no error occured, false if it did

Definition at line 349 of file hitechnic-irlink-rcx.h.

bool HTRCXmotorRev ( tSensors  link,
unsigned byte  _motor 
)

Move the specified motor reverse

NOTE: This does not currently work with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
_motorthe motor channel to move reverse
Returns:
true if no error occured, false if it did

Definition at line 323 of file hitechnic-irlink-rcx.h.

bool HTRCXplaySound ( tSensors  link,
unsigned byte  sound 
)

Tell the RCX to play a sound. Sounds are numbered 0-5

Parameters:
linkthe sensor port number
soundthe sound to play, numbered 0-6
Returns:
true if no error occured, false if it did

Definition at line 178 of file hitechnic-irlink-rcx.h.

bool HTRCXreadResp ( tSensors  link,
tByteArray response 
)

Read a message sent by the RCX. You will need to poll frequently to check if a message has been sent. The number of bytes received is in the first element of the response array. If it is non-zero, a message was received.

Parameters:
linkthe sensor port number
responsethe IR message that was received from the RCX
Returns:
true if no error occured, false if it did

Definition at line 143 of file hitechnic-irlink-rcx.h.

bool HTRCXsendByte ( tSensors  link,
unsigned byte  data 
)

Send a single byte message to the RCX

Parameters:
linkthe sensor port number
datathe data to be sent to the RCX
Returns:
true if no error occured, false if it did

Definition at line 202 of file hitechnic-irlink-rcx.h.

bool HTRCXsendHeader ( tSensors  link )

Sends the RCX IR message header with all the trimmings.

Note: this is an internal function and should be not be called directly.

Parameters:
linkthe sensor port number
Returns:
true if no error occured, false if it did

Definition at line 70 of file hitechnic-irlink-rcx.h.

bool HTRCXsendWord ( tSensors  link,
short  data 
)

Send 2 bytes message to the RCX as a short.

NOTE: This only works with the ROBOTC firmware on the RCX

Parameters:
linkthe sensor port number
datathe data to be sent to the RCX
Returns:
true if no error occured, false if it did
Examples:
hitechnic-irlink-rcx-test1.c.

Definition at line 224 of file hitechnic-irlink-rcx.h.


Variable Documentation

byte HTRCXCmdToggle = 0

Definition at line 47 of file hitechnic-irlink-rcx.h.

Definition at line 44 of file hitechnic-irlink-rcx.h.

Definition at line 43 of file hitechnic-irlink-rcx.h.

Definition at line 45 of file hitechnic-irlink-rcx.h.