Revision 241
Updated libdragonfly documentation.
dragonfly_lib.c | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (c) 2007 Colony Project |
|
3 |
* |
|
4 |
* Permission is hereby granted, free of charge, to any person |
|
5 |
* obtaining a copy of this software and associated documentation |
|
6 |
* files (the "Software"), to deal in the Software without |
|
7 |
* restriction, including without limitation the rights to use, |
|
8 |
* copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9 |
* copies of the Software, and to permit persons to whom the |
|
10 |
* Software is furnished to do so, subject to the following |
|
11 |
* conditions: |
|
12 |
* |
|
13 |
* The above copyright notice and this permission notice shall be |
|
14 |
* included in all copies or substantial portions of the Software. |
|
15 |
* |
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
17 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
18 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
19 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
20 |
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
21 |
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
23 |
* OTHER DEALINGS IN THE SOFTWARE. |
|
24 |
**/ |
|
25 |
|
|
26 |
|
|
27 |
/** |
|
28 |
* @file dragonfly_lib.c |
|
29 |
* @brief Dragonfly initialization |
|
30 |
* |
|
31 |
* Contains implementation of dragonfly_init. |
|
32 |
* |
|
33 |
* @author Colony Project, CMU Robotics Club |
|
34 |
**/ |
|
35 |
|
|
1 | 36 |
#include <dragonfly_lib.h> |
2 | 37 |
|
3 | 38 |
/* init_dragonfly - Initializes functions based on configuration parameters |
... | ... | |
33 | 68 |
DDRG &= ~(_BV(PING0)|_BV(PING1)); |
34 | 69 |
PORTG |= _BV(PING0)|_BV(PING1); |
35 | 70 |
|
36 |
if(config & ANALOG) {
|
|
71 |
if(config & ANALOG) |
|
37 | 72 |
analog_init(); |
38 |
} |
|
39 | 73 |
|
40 |
if(config & COMM) { |
|
41 |
//Defaults to 115200. Check serial.h for more information. |
|
42 |
sei(); |
|
43 |
usb_init(); |
|
44 |
xbee_init(); |
|
74 |
if(config & COMM) |
|
75 |
{ |
|
76 |
//Defaults to 115200. Check serial.h for more information. |
|
77 |
sei(); |
|
78 |
usb_init(); |
|
79 |
xbee_init(); |
|
45 | 80 |
} |
46 | 81 |
|
47 |
if(config & BUZZER) { |
|
48 |
sei(); |
|
82 |
if(config & BUZZER) |
|
83 |
{ |
|
84 |
sei(); |
|
49 | 85 |
buzzer_init(); |
50 | 86 |
} |
51 | 87 |
|
52 |
if(config & ORB) { |
|
53 |
sei(); |
|
88 |
if(config & ORB) |
|
89 |
{ |
|
90 |
sei(); |
|
54 | 91 |
orb_init(); |
55 | 92 |
} |
56 | 93 |
|
57 |
if(config & MOTORS) {
|
|
94 |
if(config & MOTORS) |
|
58 | 95 |
motors_init(); |
59 |
} |
|
60 |
|
|
61 |
if(config & SERVOS) { |
|
62 |
sei(); |
|
63 |
//Servos not yet implemented |
|
64 |
//servo_init(); |
|
65 |
} |
|
66 | 96 |
|
67 |
if(config & LCD) {
|
|
97 |
if(config & LCD) |
|
68 | 98 |
lcd_init(); |
69 |
} |
|
70 | 99 |
|
71 |
if(config & (SERVOS | ORB)) {
|
|
72 |
sei();
|
|
73 |
orb_init();
|
|
74 |
//Servos not yet implemented
|
|
100 |
if(config & ORB)
|
|
101 |
{
|
|
102 |
sei();
|
|
103 |
orb_init();
|
|
75 | 104 |
} |
76 | 105 |
|
77 | 106 |
// delay a bit for stability |
Also available in: Unified diff