Revision 709
lbom library doesn't work
branches/autonomous_recharging/code/projects/libbayboard/lbom.c | ||
---|---|---|
54 | 54 |
* |
55 | 55 |
* The Bearing and Orientation Module / Barrel of Monkeys / BOM |
56 | 56 |
* is a custom sensor designed and built by the Colony Project. |
57 |
* It consists of a ring of 16 IR emitters and 16 IR detectors.
|
|
57 |
* It consists of 4 IR emitters.
|
|
58 | 58 |
* The BOM is most often use to determine the direction of other |
59 | 59 |
* robots. This module contains functions for controlling the BOM. |
60 | 60 |
* |
... | ... | |
65 | 65 |
|
66 | 66 |
/** @brief Sets up the LBOM to be used. **/ |
67 | 67 |
void bom_init(char type){ |
68 |
set_leds(ALL_ON); |
|
69 |
DDRD |= _BV(DDD7); //sets bom carrier to write |
|
68 |
//set_leds(ALL_ON); |
|
69 |
DDRC |= _BV(BOM0)|_BV(BOM1)|_BV(BOM2)|_BV(BOM3); |
|
70 |
//DDRD |= _BV(DDD7); //sets bom carrier to write |
|
70 | 71 |
bom_mode = type; |
71 | 72 |
bom_on(); |
72 | 73 |
} |
73 | 74 |
/** @brief Turns the LBOM on. **/ |
74 | 75 |
void bom_on(void){ |
75 | 76 |
//start timer 2 if not already started |
76 |
TCCR2A = _BV(COM2A1)|_BV(COM2A0)|_BV(WGM21)|_BV(WGM20);
|
|
77 |
TCCR2A = _BV(COM2A1)|_BV(WGM21)|_BV(WGM20); |
|
77 | 78 |
TCCR2B = _BV(CS20); |
78 | 79 |
switch(bom_mode){ |
79 | 80 |
case BOM: |
... | ... | |
90 | 91 |
void bom_off(void){ |
91 | 92 |
OCR2A = 0; |
92 | 93 |
} |
93 |
/** @brief Sets which LEDs are in use. **/
|
|
94 |
/** @brief Sets which emitters are in use. **/
|
|
94 | 95 |
void set_leds(int bit_field){ |
95 | 96 |
DDRC |= (bit_field << 4); |
96 | 97 |
} |
Also available in: Unified diff