Project

General

Profile

Revision 1169

Added server_comm.c/server_comm.h
Added tests.c/tests.h

View differences:

trunk/code/projects/diagnostic_station/station/tests.c
1
#include "tests.h"
2

  
3
#include <dragonfly_lib.h>
4
#include "global.h"
5

  
6
bool communication_ok=false;
7

  
8
bool require_comm (void)
9
{
10
	if (!communication_ok)
11
		communication_ok=test_comm ();
12

  
13
	if (!communication_ok)
14
		usb_puts ("# Communications required. Stop." NL);
15

  
16
	return communication_ok;
17
}
18

  
19
void test_all (void)
20
{
21
	// test_all tests comm itself because we want to test comm, even if it
22
	// succeeded before (that's what test_all means).
23
	if (!test_comm ())
24
	{
25
		usb_puts ("# Communications required. Stop." NL);
26
		return;
27
	}
28
	
29
	test_bom (true, true);
30
	test_rangefinders ();
31
	test_encoders ();
32
	test_motors ();
33
}
34

  
35

  
36

  
37

  
trunk/code/projects/diagnostic_station/station/tests.h
1
#ifndef _tests_h
2
#define _tests_h
3

  
4
#include "test_comm.h"
5
#include "test_bom.h"
6
#include "test_rangefinders.h"
7
#include "test_motors.h"
8
#include "test_encoders.h"
9

  
10

  
11
bool require_comm (void);
12
void test_all (void);
13

  
14

  
15

  
16

  
17

  
18

  
19

  
20

  
21

  
22

  
23

  
24

  
25

  
26
#endif
trunk/code/projects/diagnostic_station/station/server_comm.c
1
#include "server_comm.h"
2

  
3
void server_comm_init ()
4
{
5
	usb_init ();
6
	
7
}
8

  
9
void server_send_finished ()
10
{
11
	usb_puts ("finished");
12
}
13

  
trunk/code/projects/diagnostic_station/station/main.c
6 6

  
7 7
#include "global.h"
8 8
#include "station_hardware.h"
9
#include "tests.h"
9 10

  
10
#include "test_comm.h"
11
#include "test_bom.h"
12
#include "test_rangefinders.h"
13
#include "test_motors.h"
14
#include "test_encoders.h"
15

  
16
bool communication_ok=false;
17

  
18
bool require_comm (void)
19
{
20
	if (!communication_ok)
21
		communication_ok=test_comm ();
22

  
23
	if (!communication_ok)
24
		usb_puts ("# Communications required. Stop." NL);
25

  
26
	return communication_ok;
27
}
28

  
29
void test_all (void)
30
{
31
	// test_all tests comm itself because we want to test comm, even if it
32
	// succeeded before (that's what test_all means).
33
	if (!test_comm ())
34
	{
35
		usb_puts ("# Communications required. Stop." NL);
36
		return;
37
	}
38
	
39
	test_bom (true, true);
40
	test_rangefinders ();
41
	test_encoders ();
42
	test_motors ();
43
}
44

  
45 11
void interactive_main (void)
46 12
{
47 13
	while (1)
......
89 55

  
90 56
    orb_init_pwm ();
91 57
	hardware_init ();
58
	server_comm_init ();
92 59

  
93 60
	orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL);
94 61
	xbee_init ();
trunk/code/projects/diagnostic_station/station/server_comm.h
1
#ifndef _server_comm_h
2
#define _server_comm_h
3

  
4
#include <dragonfly_lib.h>
5

  
6

  
7

  
8
void server_comm_init (void);
9
void server_send_finished ();
10

  
11

  
12

  
13

  
14

  
15

  
16

  
17

  
18

  
19
#endif

Also available in: Unified diff