Project

General

Profile

Revision 1617

wl: clean up unit tests

View differences:

wl_defs.h
1 1
/**
2
 * Copyright (c) 2007 Colony Project
2
 * Copyright (c) 2009 Colony Project
3 3
 * 
4 4
 * Permission is hereby granted, free of charge, to any person
5 5
 * obtaining a copy of this software and associated documentation
......
27 27
 * @file wl_defs.h
28 28
 * @brief Definitions for Wireless
29 29
 *
30
 * Contains definitions for wireless packet groups, packet types,
31
 * debugging information, etc.
30
 * Contains definitions for wireless, debugging information, etc.
32 31
 *
33
 * @author Brian Coltin, Colony Project, CMU Robotics Club
32
 * @author Colony Project, CMU Robotics Club
34 33
 **/
35 34

  
36 35
#ifndef WL_DEFS_H
37 36
#define WL_DEFS_H
38 37

  
38
// create main wireless page documentation
39

  
40
/** @mainpage The Wireless Library
41
 * 
42
 * This is the documentation for the Colony wireless library.\n\n
43
 * Xbee documentation can be found under @ref xbee \n
44
 * Higher level wireless documentation can be found under @ref wireless \n
45
 **/
46

  
47

  
48
// need this for C99 int types
49
#ifndef STDINT_H
50
#define STDINT_H
51
#include <stdint.h>
52
#endif
53

  
54
// ***** TODO: these next two defines should be moved to makefile options
55

  
39 56
//comment out this line if using a computer hooked up to an xbee
40 57
//#define ROBOT
41 58

  
42 59
//uncomment this line for debug information
43 60
//#define WL_DEBUG
44 61

  
45
//return value definitions
62
/**@addtogroup wireless 
63
 * @{ **/
64
 
65
/**@defgroup wl_error Error Codes
66
 * @{ **/
67
 
68
/** @brief Success **/
69
#define WL_SUCCESS INT8_C(0)
70

  
46 71
/** @brief Error code for init failure **/
47
#define WL_ERROR_INIT_FAILED 1
72
#define WL_ERROR_INIT_FAILED INT8_C(-1) 
73

  
48 74
/** @brief Error code for duplicate init calls **/
49
#define WL_ERROR_INIT_ALREADY_INITD 2
75
#define WL_ERROR_INIT_ALREADY_INITD INT8_C(-2) 
76

  
50 77
/** @brief Error code for not calling init **/
51
#define WL_ERROR_LIBRARY_NOT_INITD 3
78
#define WL_ERROR_LIBRARY_NOT_INITD INT8_C(-3) 
52 79

  
53
// Packet Groups and Types
80
/** @brief Error code for failed termination **/
81
#define WL_ERROR_TERMINATION_FAILED INT8_C(-4)
54 82

  
55
// Error group
56
#define WL_ERROR_GROUP 1
83
/** @brief Error code for failed packet group registration **/
84
#define WL_ERROR_FAILED_REGISTRATION INT8_C(-5)
57 85

  
58
#define WL_ERROR_STRING_TYPE 1
86
/** @brief Error code for failed packet group registration **/
87
#define WL_ERROR_FAILED_UNREGISTRATION INT8_C(-6)
59 88

  
60
// Token Ring group
61
#define WL_TOKEN_RING_GROUP 2
89
/** @brief Error in arguments **/
90
#define WL_ERROR_ARGUMENT INT8_C(-7)
62 91

  
63
#define WL_TOKEN_PASS 1
64
#define WL_TOKEN_SENSOR_MATRIX 2
65
#define WL_TOKEN_BOM_ON 3
66
#define WL_TOKEN_JOIN 4
67
#define WL_TOKEN_JOIN_ACCEPT 5
92
/** @brief Error code for send failure **/
93
#define WL_ERROR_SEND INT8_C(-10)
68 94

  
69
// timing constants
70
#ifndef FIREFLY
71
#define BOM_DELAY 100
72
#else
73
#define BOM_DELAY 200
74
#endif
95
/** @brief Error code for a bad group number **/
96
#define WL_ERROR_BAD_GROUP INT8_C(-11)
75 97

  
76
#define DEATH_DELAY 4
77
#define JOIN_DELAY 8
98
/** @brief Error code for a bad scope **/
99
#define WL_ERROR_SCOPE INT8_C(-12)
78 100

  
101
/** @brief Error code for a bad robot address **/
102
#define WL_ERROR_ADDRESS INT8_C(-13)
103

  
104
/** @brief Error code for a bad mode **/
105
#define WL_ERROR_MODE INT8_C(-14)
106

  
107
/** @brief Error code for received paacket destination too small for received packet **/
108
#define WL_ERROR_TOO_SMALL INT8_C(-15)
109

  
110
/** @brief Error code for sending buffer full (the packet was sent, but no retries will be made). **/
111
#define WL_ERROR_SENDING_BUFFER_FULL INT8_C(-16)
112

  
113
/** @brief Error code for failed xbee command **/
114
#define WL_ERROR_XBEE_COMMAND INT8_C(-17)
115

  
116
/** @brief Error code for failed 16bit xbee command **/
117
#define WL_ERROR_XBEE_COMMAND_16BIT 0xFEFE
118

  
119
/** @brief Error code for bad baud rate **/
120
#define WL_ERROR_BAUD INT8_C(-18)
121

  
122
/**@} */ // end error group
123

  
124
// TODO: is this a good size?
125
/*Buffer sizes*/
126
#define PACKET_BUFFER_SIZE	128
127

  
128
/**@} */ // end wireless group
129

  
79 130
#ifdef WL_DEBUG
80 131

  
81 132
#ifdef ROBOT
82 133
#include <serial.h>
83
#endif
84

  
85
#ifdef ROBOT
86 134
#define WL_DEBUG_PRINT( s ) usb_puts( s )
135
#define WL_DEBUG_PRINT_CHAR( c ) usb_putc( c )
136
#define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
87 137
#else
88 138
#define WL_DEBUG_PRINT( s ) printf( s )
89
#endif
90

  
91
#ifdef ROBOT
92
#define WL_DEBUG_PRINT_INT( i ) usb_puti(i)
93
#else
139
#define WL_DEBUG_PRINT_CHAR( c ) printf("%c", c)
94 140
#define WL_DEBUG_PRINT_INT( i ) printf("%i", i)
95 141
#endif
96 142

  
97 143
#else
98 144

  
99 145
#define WL_DEBUG_PRINT( s )
146
#define WL_DEBUG_PRINT_CHAR( c )
100 147
#define WL_DEBUG_PRINT_INT( i )
101 148

  
102 149
#endif
103 150

  
104 151
#endif
105

  

Also available in: Unified diff