Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / diagnostic_station / station / main.c @ 1281

History | View | Annotate | Download (2.7 KB)

1
#include <dragonfly_lib.h>
2
#include <wireless.h>
3
#include <xbee.h>
4

    
5
#include "../common/comm_station_robot.h"
6

    
7
#include "global.h"
8
#include "hardware.h"
9
#include "tests.h"
10
#include "self_test.h"
11
#include "comm_server.h"
12
#include "comm_robot.h"
13
#include "comm_interactive.h"
14

    
15
int main_default (void)
16
{
17
    dragonfly_init(0);
18

    
19
        // Initialize before using USB
20
        comm_server_init ();
21

    
22
        usb_puts(NL NL NL);
23
        usb_puts("# Diagnostic station version " version_string " starting" NL);
24

    
25
    orb_init_pwm ();
26
        hardware_init ();
27

    
28
        orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL);
29
        comm_robot_init ();
30
        orb2_set (255, 0, 0); usb_puts("# Done" NL);
31

    
32
        // If button 1 is pressed after initialization of the wireless (which takes about 1s), run all tests.
33
        if (button1_read ())
34
                test_all ();
35

    
36
        // If button 2 is pressed, go to interactive mode (green/green). If not, go to server mode (green/yellow).
37
        if (button2_read ())
38
                interactive_main ();
39
        else
40
                server_main ();
41

    
42
        while (1);
43
        return 0;
44
}
45

    
46
int main_martin (void)
47
{
48
        dragonfly_init (0);
49
        orb_init ();
50

    
51
        if (!button2_read ())
52
        {
53
                // Initialize before using USB
54
                // Do something else
55
        }
56
        else
57
        {
58
                delay_ms (1000);
59
                main_default ();
60
        }
61
        
62
        while (1);
63
        return 0;
64
}
65

    
66
int main_john (void)
67
{
68
    dragonfly_init(0);
69

    
70
        // Initialize before using USB
71
        comm_server_init ();
72

    
73
        usb_puts(NL NL NL);
74
        usb_puts("# Diagnostic station version " version_string " starting" NL);
75

    
76
    orb_init_pwm ();
77
        hardware_init ();
78

    
79
        orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL);
80
        comm_robot_init ();
81
        orb2_set (255, 0, 0); usb_puts("# Done" NL);
82

    
83
        interactive_main ();
84

    
85
        while (1);
86
        return 0;
87
}
88

    
89

    
90
int main_evan (void)
91
{
92
    dragonfly_init(0);
93

    
94
    usb_init ();
95

    
96
        usb_puts(NL NL NL);
97
        usb_puts("# Diagnostic station version " version_string " starting" NL);
98

    
99
    orb_init_pwm ();
100
        
101
        hardware_init ();
102
        comm_server_init ();
103
        comm_robot_init ();
104

    
105
        orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL);
106
        xbee_init ();
107
        wl_init();
108
        orb2_set (255, 0, 0); usb_puts("# Done" NL);
109

    
110

    
111
        // If button 1 is pressed after initialization of the wireless (which takes about 1s), run all tests.
112
        if (button1_read ())
113
                        test_all ();
114

    
115
        // If button 2 is pressed, go to interactive mode (green/green). If not, go to server mode (green/yellow).
116
        if (button2_read ())
117
                interactive_main ();
118
        else
119
        {
120
                // Set the orbs to green/yellow
121
                orbs_set (0,255,0, 255,127,0);
122

    
123
                server_main ();
124
        }
125

    
126
        while (1);
127
        return 0;
128
}
129

    
130
int main_kwoo (void)
131
{
132
    dragonfly_init(0);
133
    orb_init_pwm();
134
    
135
    usb_init ();
136

    
137
        usb_puts(NL NL NL);
138
        usb_puts("# Diagnostic station version " version_string " starting" NL);
139

    
140
    wall_init();
141
        while (1) {
142
        if (PINF & _BV(PINF0)) {
143
            orbs_set(0,0,255,0,0,0);
144
        }
145

    
146
    }
147
        
148
        return 0;
149
}