root / branches / autonomous_recharging / code / projects / colonet / utilities / robot_wireless_relay / robotWirelessRelay.c @ 1390
History | View | Annotate | Download (1005 Bytes)
1 | 13 | emarinel | /* robotWirelessRelay
|
---|---|---|---|
2 | *
|
||
3 | * Eugene Marinelli
|
||
4 | * 1/25/07
|
||
5 | */
|
||
6 | |||
7 | /* Includes */
|
||
8 | #include <stdio.h> |
||
9 | #include <string.h> |
||
10 | |||
11 | #include <firefly+_lib.h> |
||
12 | #include "pindefs_ff.h" |
||
13 | //#include "wl_adhoc.h"
|
||
14 | |||
15 | void init_hardware(void); |
||
16 | |||
17 | int main(void){ |
||
18 | char wl_buf = 0; |
||
19 | char serial_buf = 0; |
||
20 | |||
21 | init_hardware(); |
||
22 | |||
23 | orb_set_color(GREEN); |
||
24 | |||
25 | UCSR0B |= _BV(RXCIE); |
||
26 | sei(); |
||
27 | |||
28 | while (1) { |
||
29 | /* Relay serial data to wireless */
|
||
30 | serial_buf = serial1_getchar(); |
||
31 | serial_putchar(serial_buf); |
||
32 | //lcd_putchar(serial_buf);
|
||
33 | orb_set_color(YELLOW); |
||
34 | //serial_buf = 0;
|
||
35 | } |
||
36 | |||
37 | return 0; |
||
38 | } |
||
39 | |||
40 | void init_hardware(){
|
||
41 | motors_init(); |
||
42 | orb_init(); |
||
43 | led_init(); |
||
44 | analog_init(); |
||
45 | |||
46 | serial_init(BAUD115200); |
||
47 | serial1_init(BAUD115200); |
||
48 | //serial1_init(BAUD9600);
|
||
49 | lcd_init(); |
||
50 | |||
51 | fdevopen(&serial1_putchar, &serial1_getchar); |
||
52 | } |
||
53 | |||
54 | ISR(USART0_RX_vect) |
||
55 | { |
||
56 | char wl_buf;
|
||
57 | wl_buf = UDR0; |
||
58 | |||
59 | /* Received wireless byte - relay to computer */
|
||
60 | //printf("%c", wl_buf);
|
||
61 | serial1_putchar(wl_buf); |
||
62 | orb_set_color(RED); |
||
63 | } |