roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
ir_comms.h File Reference

Handles IR communication between robots using the ring of IR transmitters/receivers. More...

Go to the source code of this file.

Data Structures

struct  IRCommsMessage
 Message received over IR ring (contains the sending transmitter ID and receiving ID) More...
 

Typedefs

typedef struct IRCommsMessage irCommsMessage
 Message received over IR ring (contains the sending transmitter ID and receiving ID) More...
 

Functions

void irCommsSetSize (uint8 size)
 Sets the size, in bits, of the IR comms message. More...
 
void irCommsSetXmitPower (uint16 power)
 Sets IR Comms xmit power. More...
 
boolean irCommsSendMessage (irCommsMessage *irMessagePtr)
 Sends out a message through IR transmitters if RC mode isn't active. Message is 1-5 bytes of data, first byte is robot ID. More...
 
boolean irCommsGetMessage (irCommsMessage *irMessagePtr)
 Gets a message through IR transmitters if RC mode not engaged. More...
 
void irCommsOrientationBitMatrixPrint (uint8 *orientationBitsMatrixPtr, uint8 *rangeBitsMatrixPtr)
 Prints orientation bit matrix. More...
 
void irCommsInit (void)
 Initializes IRComms. More...
 

Detailed Description

Handles IR communication between robots using the ring of IR transmitters/receivers.

Since
April 12, 2012
Author
James McLurkin

Typedef Documentation

Message received over IR ring (contains the sending transmitter ID and receiving ID)

Warning
If you are using the neighbor system, you have 7 less bits than this says.

Function Documentation

boolean irCommsGetMessage ( irCommsMessage irMessagePtr)

Gets a message through IR transmitters if RC mode not engaged.

Parameters
irMessagePtrpointer to the irCommsMessage struct that contains receiver information
Returns
TRUE if there is a message, FALSE if not
void irCommsInit ( void  )

Initializes IRComms.

Creates the OS message queues. Initializes IR port for GPIO and set it as input. Sets PWM pins; computes and sets pwm period based on system clock. Enables PWM generators and output state. Enables a 1250hz (800us) interrupt.

Returns
void
void irCommsOrientationBitMatrixPrint ( uint8 *  orientationBitsMatrixPtr,
uint8 *  rangeBitsMatrixPtr 
)

Prints orientation bit matrix.

Parameters
orientationBitsMatrixPtris the pointer to an orientation bit matrix
rangeBitsMatrixPtr
Returns
void
boolean irCommsSendMessage ( irCommsMessage irMessagePtr)

Sends out a message through IR transmitters if RC mode isn't active. Message is 1-5 bytes of data, first byte is robot ID.

Parameters
irMessagePtrpointer to the irCommsMessage struct that contains the message to be sent
Returns
whether the message is sent (TRUE/FALSE)
void irCommsSetSize ( uint8  size)

Sets the size, in bits, of the IR comms message.

Parameters
sizethe size of the data portion of the ir message.
void irCommsSetXmitPower ( uint16  power)

Sets IR Comms xmit power.

Parameters
powerrange from 0-256 changes duty cycle from 0-100%
Returns
void