Revision 923
commented
branches/autonomous_recharging/code/projects/Test/i2c.c | ||
---|---|---|
10 | 10 |
static int xbee_wait_for_ok(void); |
11 | 11 |
static int xbee_wait_for_string(char*, int); |
12 | 12 |
|
13 |
|
|
14 |
/** |
|
15 |
* Detects whether or not an xbee is present. |
|
16 |
**/ |
|
13 | 17 |
int xbee_present(void){ |
14 | 18 |
bayboard_init(ALL_ON); |
15 | 19 |
set_orb(255,0,0); |
... | ... | |
22 | 26 |
return 1; |
23 | 27 |
} |
24 | 28 |
|
29 |
|
|
30 |
/** |
|
31 |
* Sends a string of size size to the xbee module. |
|
32 |
* |
|
33 |
* @param buf the string to send |
|
34 |
* @param size the length of the string |
|
35 |
**/ |
|
25 | 36 |
static int xbee_send(char* buf, int size) |
26 | 37 |
{ |
27 | 38 |
int i; |
... | ... | |
31 | 42 |
return 0; |
32 | 43 |
} |
33 | 44 |
|
45 |
/** |
|
46 |
* Wrapper for xbee_send. |
|
47 |
* |
|
48 |
* @param c the string to send |
|
49 |
* @param len the length of the string |
|
50 |
**/ |
|
34 | 51 |
static int xbee_send_string(char* c, int len) |
35 | 52 |
{ |
36 | 53 |
return xbee_send(c, len); |
... | ... | |
67 | 84 |
/** |
68 | 85 |
* Wait until the string "OK\r" is received from the XBee. |
69 | 86 |
**/ |
70 |
//TODO: this function is so simple, it *may* be beneficial to inline this function. testing of if |
|
71 |
// it reduces code size or not should be done to be sure. |
|
72 | 87 |
static int xbee_wait_for_ok() |
73 | 88 |
{ |
74 | 89 |
return xbee_wait_for_string("OK\r", 3); |
Also available in: Unified diff