BOM (Bearing and Orientation Module)

Functions for dealing with the BOM. More...

Defines

#define BOM_ALL   0xFFFF
 Include all elements in the 16-bit bitfield.
#define BOM   0
 Original BOM - No Range, No Individual LED control.
#define BOM15   1
 BOM 1.5 - No Range, Individual LED control.
#define RBOM   2
 RBOM - Range, Individual LED control.

Functions

void bom_init (char type)
 Initialize the bom according to bom type.
void bom_refresh (int bit_field)
 Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work.
int bom_get (int which)
 Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values.
int bom_get_max (void)
 Compares all the values in bom_val[] and returns the index to the highest value element.
void bom_leds_on (int bit_field)
 Turns on the selected bom leds. Only works with BOM_ALL if using the original bom.
void bom_leds_off (int bit_field)
 Turns off the selected bom leds. Only works with BOM_ALL if using the original bom.
int get_max_bom (void)
 (DEPRECATED) Wrapper function. See bom_refresh and bom_get_max
void bom_on (void)
 (DEPRECATED) Wrapper function. See bom_leds_on.
void bom_off (void)
 (DEPRECATED) Wrapper function. See bom_leds_off.

Detailed Description

Functions for dealing with the BOM.

The Bearing and Orientation Module / Barrel of Monkeys / BOM is a custom sensor designed and built by the Colony Project. It consists of a ring of 16 IR emitters and 16 IR detectors. The BOM is most often use to determine the direction of other robots. This module contains functions for controlling the BOM.

Include bom.h to access these functions.


Function Documentation

int bom_get ( int  which  ) 

Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values.

Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values.

Parameters:
which which bom value to return
Returns:
the bom value
See also:
bom_refresh

int bom_get_max ( void   ) 

Compares all the values in bom_val[] and returns the index to the highest value element.

Compares all the values in bom_val[] and returns the index to the lowest (max) value element. Returns the direction of the maximum BOM reading,as an integer in the range 0-15. 0 indicates to the robot's right, while the rest of the sensors are numbered counterclockwise.

Returns:
index to the lowest (max) bom value element. -1 if no value is lower than BOM_VALUE_THRESHOLD

void bom_init ( char  type  ) 

Initialize the bom according to bom type.

Initializes the BOM. Call bom_init before reading bom values or turning bom leds.

INCOMPLETE - need to fill in init routine for BOM15

See also:
bom_refresh, bom_leds_on, bom_leds_off

void bom_leds_off ( int  bit_field  ) 

Turns off the selected bom leds. Only works with BOM_ALL if using the original bom.

Iterates through each bit in the bit_field. For each set bit, turns off the corresponding bom led. bom_init must be called for this to work. Only works with BOM_ALL if using the original bom.

Parameters:
bit_field specifies which leds should be turned off. Use BOM_ALL to turn off all bom leds. Ex. if 0x000B is passed, leds 0 and 3 will be turned off.

void bom_leds_on ( int  bit_field  ) 

Turns on the selected bom leds. Only works with BOM_ALL if using the original bom.

Iterates through each bit in the bit_field. For each set bit, turns on the corresponding bom led. bom_init must be called for this to work. Only works with BOM_ALL if using the original bom.

Parameters:
bit_field specifies which leds should be turned on. Use BOM_ALL to turn on all bom leds. Ex. if 0x0005 is passed, leds 0 and 2 will be turned on.

void bom_off ( void   ) 

(DEPRECATED) Wrapper function. See bom_leds_off.

(DEPRECATED) Turns off all bom leds.

See also:
bom_on

void bom_on ( void   ) 

(DEPRECATED) Wrapper function. See bom_leds_on.

(DEPRECATED) Turns on all bom leds.

See also:
bom_off

void bom_refresh ( int  bit_field  ) 

Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work.

Iterates through each bit in the bit_field. For each set bit, sets the corresponding bom select bits and updates the corresponding bom value with an analog_get8 reading. analog_init and bom_init must be called for this to work.

Parameters:
bit_field specifies which elements in bom_val[] should be updated. Use BOM_ALL to refresh all values. Ex. if 0x0003 is passed, bom_val[0] and bom_val[1] will be updated.
See also:
bom_get

int get_max_bom ( void   ) 

(DEPRECATED) Wrapper function. See bom_refresh and bom_get_max

(DEPRECATED) Wrapper function for new BOM code. Refreshes buffer and returns the max bom value.

Returns:
the direction of the maximum BOM reading
See also:
bom_refresh, bom_get_max


Generated on Wed Nov 5 19:59:43 2008 for libdragonfly by  doxygen 1.5.3