Revision 1462
moved dragonfly definitions to separate header file
dragonfly_lib.h | ||
---|---|---|
41 | 41 |
* @{ |
42 | 42 |
**/ |
43 | 43 |
|
44 |
//return value definitions |
|
45 |
#define ERROR_INIT_FAILED 1 |
|
46 |
#define ERROR_INIT_ALREADY_INITD 2 |
|
47 |
|
|
48 |
#define ERROR_LIBRARY_NOT_INITD 3 |
|
49 |
|
|
50 |
// Configuration definitions |
|
51 |
/** @brief Initialize analog **/ |
|
52 |
#define ANALOG 0x01 |
|
53 |
/** @brief Initialize serial communications **/ |
|
54 |
#define SERIAL 0x02 |
|
55 |
/** @brief Initialize USB communications **/ |
|
56 |
#define USB 0x02 |
|
57 |
/** @brief Initialize communications **/ |
|
58 |
#define COMM 0x02 |
|
59 |
/** @brief Initialize the orb **/ |
|
60 |
#define ORB 0x04 |
|
61 |
/** @brief Initialize the motors **/ |
|
62 |
#define MOTORS 0x08 |
|
63 |
/** @brief Initialize I2C **/ |
|
64 |
#define I2C 0x20 |
|
65 |
/** @brief Initialize the buzzer **/ |
|
66 |
#define BUZZER 0x40 |
|
67 |
/** @brief Initialize the LCD screen **/ |
|
68 |
#define LCD 0x80 |
|
69 |
/** @brief Initialize the rangefinders **/ |
|
70 |
#define RANGE 0x0100 |
|
71 |
/** @brief Initialize the BOM **/ |
|
72 |
#define BOM 0x0200 |
|
73 |
/** @brief Initilize encoders **/ |
|
74 |
#define ENCODERS 0x400 |
|
75 |
/** @brief Initialize everything **/ |
|
76 |
#define ALL_ON 0x07FF |
|
77 |
|
|
78 | 44 |
/** @brief Initialize the board **/ |
79 | 45 |
void dragonfly_init(int config); |
80 | 46 |
|
... | ... | |
90 | 56 |
// missing from the AVR libc distribution. |
91 | 57 |
#include "atomic.h" |
92 | 58 |
|
59 |
#include "dragonfly_defs.h" |
|
93 | 60 |
#include "analog.h" |
94 | 61 |
#include "dio.h" |
95 | 62 |
#include "time.h" |
... | ... | |
109 | 76 |
#include <stddef.h> |
110 | 77 |
#include <stdbool.h> |
111 | 78 |
|
112 |
/** @brief shortcut for ATOMIC_BLOCK(ATOMIC_RESTORESTATE) **/ |
|
113 |
#define SYNC ATOMIC_BLOCK(ATOMIC_RESTORESTATE) |
|
114 |
|
|
115 |
/** @brief atomically grab a lock if it is free, return otherwise **/ |
|
116 |
#define REQUIRE_LOCK_OR_RETURN(LOCK) do { SYNC { if (LOCK) return; LOCK=1; } } while (0) |
|
117 |
|
|
118 |
/** @brief atomically release a lock **/ |
|
119 |
#define RELEASE_LOCK(LOCK) do { LOCK=0; } while (0) |
|
120 |
|
|
121 |
|
|
122 |
|
|
123 | 79 |
#endif |
124 | 80 |
|
Also available in: Unified diff