root / trunk / code / lib / include / libdragonfly / dragonfly_lib.h @ 1429
History | View | Annotate | Download (3.22 KB)
1 | 241 | bcoltin | /**
|
---|---|---|---|
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.h
|
||
29 | * @brief Contains other include files
|
||
30 | *
|
||
31 | * Include this file for all the functionality of libdragonfly.
|
||
32 | *
|
||
33 | * @author Colony Project, CMU Robotics Club
|
||
34 | **/
|
||
35 | |||
36 | #ifndef _DRAGONFLY_LIB_H_
|
||
37 | #define _DRAGONFLY_LIB_H_
|
||
38 | |||
39 | /**
|
||
40 | * @addtogroup dragonfly
|
||
41 | * @{
|
||
42 | **/
|
||
43 | |||
44 | // Configuration definitions
|
||
45 | /** @brief Initialize analog **/
|
||
46 | #define ANALOG 0x01 |
||
47 | /** @brief Initialize serial communications **/
|
||
48 | #define SERIAL 0x02 |
||
49 | /** @brief Initialize USB communications **/
|
||
50 | #define USB 0x02 |
||
51 | /** @brief Initialize communications **/
|
||
52 | #define COMM 0x02 |
||
53 | /** @brief Initialize the orb **/
|
||
54 | #define ORB 0x04 |
||
55 | /** @brief Initialize the motors **/
|
||
56 | #define MOTORS 0x08 |
||
57 | 946 | abuchan | /** @brief Initialize I2C **/
|
58 | #define I2C 0x20 |
||
59 | 241 | bcoltin | /** @brief Initialize the buzzer **/
|
60 | 946 | abuchan | #define BUZZER 0x40 |
61 | 241 | bcoltin | /** @brief Initialize the LCD screen **/
|
62 | 946 | abuchan | #define LCD 0x80 |
63 | /** @brief Initialize the rangefinders **/
|
||
64 | #define RANGE 0x0100 |
||
65 | /** @brief Initialize the BOM **/
|
||
66 | #define BOM 0x0200 |
||
67 | 1429 | dsschult | /** @brief Initilize encoders **/
|
68 | #define ENCODERS 0x400 |
||
69 | 946 | abuchan | /** @brief Initialize everything **/
|
70 | 1429 | dsschult | #define ALL_ON 0x07FF |
71 | 241 | bcoltin | |
72 | /** @brief Initialize the board **/
|
||
73 | void dragonfly_init(int config); |
||
74 | |||
75 | /** @} **/ //end addtogroup |
||
76 | |||
77 | #include <inttypes.h> |
||
78 | #include <stdio.h> |
||
79 | #include <stdlib.h> |
||
80 | #include <avr/io.h> |
||
81 | #include <avr/interrupt.h> |
||
82 | #include <util/delay.h> |
||
83 | #include <util/twi.h> |
||
84 | |||
85 | 1142 | deffi | // This file is included from the libdragonfly directory because it seems to be
|
86 | // missing from the AVR libc distribution.
|
||
87 | #include "atomic.h" |
||
88 | |||
89 | 241 | bcoltin | #include <analog.h> |
90 | #include <dio.h> |
||
91 | #include <time.h> |
||
92 | #include <lcd.h> |
||
93 | #include <lights.h> |
||
94 | #include <motor.h> |
||
95 | #include <serial.h> |
||
96 | #include <buzzer.h> |
||
97 | #include <rangefinder.h> |
||
98 | #include <bom.h> |
||
99 | 1429 | dsschult | #include <encoders.h> |
100 | 241 | bcoltin | #include <move.h> |
101 | #include <reset.h> |
||
102 | 946 | abuchan | #include <math.h> |
103 | #include <eeprom.h> |
||
104 | 1142 | deffi | #include <stdbool.h> |
105 | 241 | bcoltin | |
106 | 1142 | deffi | /** @brief shortcut for ATOMIC_BLOCK(ATOMIC_RESTORESTATE) **/
|
107 | #define SYNC ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||
108 | |||
109 | /** @brief atomically grab a lock if it is free, return otherwise **/
|
||
110 | #define REQUIRE_LOCK_OR_RETURN(LOCK) do { SYNC { if (LOCK) return; LOCK=1; } } while (0) |
||
111 | |||
112 | /** @brief atomically release a lock **/
|
||
113 | #define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0) |
||
114 | |||
115 | |||
116 | |||
117 | 241 | bcoltin | #endif
|