W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.
h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Page 1
/****************************************************************************
Module
ES_Configure.h
Description
This file contains macro definitions that are edited by the user to
adapt the Events and Services framework to a particular application.
Notes
History
When
Who
-------------- --10/11/15 18:00 jec
10/21/13 20:54 jec
What/Why
-------added new event type ES_SHORT_TIMEOUT
lots of added entries to bring the number of timers
and services up to 16 each
08/06/13 14:10 jec
removed PostKeyFunc stuff since we are moving that
functionality out of the framework and putting it
explicitly into the event checking functions
01/15/12 10:03 jec
started coding
*****************************************************************************/
#ifndef CONFIGURE_H
#define CONFIGURE_H
/****************************************************************************/
// The maximum number of services sets an upper bound on the number of
// services that the framework will handle. Reasonable values are 8 and 16
// corresponding to an 8-bit(uint8_t) and 16-bit(uint16_t) Ready variable size
#define MAX_NUM_SERVICES 16
/****************************************************************************/
// This macro determines that nuber of services that are *actually* used in
// a particular application. It will vary in value from 1 to MAX_NUM_SERVICES
#define NUM_SERVICES 3
/****************************************************************************/
// These are the definitions for Service 0, the lowest priority service.
// Every Events and Services application must have a Service 0. Further
// services are added in numeric sequence (1,2,3,...) with increasing
// priorities
// the header file with the public function prototypes
#define SERV_0_HEADER "MasterSM.h"
// the name of the Init function
#define SERV_0_INIT InitMasterSM
// the name of the run function
#define SERV_0_RUN RunMasterSM
// How big should this services Queue be?
#define SERV_0_QUEUE_SIZE 5
/****************************************************************************/
// The following sections are used to define the parameters for each of the
// services. You only need to fill out as many as the number of services
// defined by NUM_SERVICES
/****************************************************************************/
// These are the definitions for Service 1
#if NUM_SERVICES > 1
// the header file with the public function prototypes
#define SERV_1_HEADER "BumperService.h"
// the name of the Init function
#define SERV_1_INIT InitBumperService
// the name of the run function
#define SERV_1_RUN RunBumperService
// How big should this services Queue be?
#define SERV_1_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 2
#if NUM_SERVICES > 2
// the header file with the public function prototypes
#define SERV_2_HEADER "WireSensingService.h"
// the name of the Init function
#define SERV_2_INIT InitWireSensingService
W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.h
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Page 2
// the name of the run function
#define SERV_2_RUN RunWireSensingService
// How big should this services Queue be?
#define SERV_2_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 3
#if NUM_SERVICES > 3
// the header file with the public function prototypes
#define SERV_3_HEADER "TestHarnessService3.h"
// the name of the Init function
#define SERV_3_INIT InitTestHarnessService3
// the name of the run function
#define SERV_3_RUN RunTestHarnessService3
// How big should this services Queue be?
#define SERV_3_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 4
#if NUM_SERVICES > 4
// the header file with the public function prototypes
#define SERV_4_HEADER "TestHarnessService4.h"
// the name of the Init function
#define SERV_4_INIT InitTestHarnessService4
// the name of the run function
#define SERV_4_RUN RunTestHarnessService4
// How big should this services Queue be?
#define SERV_4_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 5
#if NUM_SERVICES > 5
// the header file with the public function prototypes
#define SERV_5_HEADER "TestHarnessService5.h"
// the name of the Init function
#define SERV_5_INIT InitTestHarnessService5
// the name of the run function
#define SERV_5_RUN RunTestHarnessService5
// How big should this services Queue be?
#define SERV_5_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 6
#if NUM_SERVICES > 6
// the header file with the public function prototypes
#define SERV_6_HEADER "TestHarnessService6.h"
// the name of the Init function
#define SERV_6_INIT InitTestHarnessService6
// the name of the run function
#define SERV_6_RUN RunTestHarnessService6
// How big should this services Queue be?
#define SERV_6_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 7
#if NUM_SERVICES > 7
// the header file with the public function prototypes
#define SERV_7_HEADER "TestHarnessService7.h"
// the name of the Init function
#define SERV_7_INIT InitTestHarnessService7
// the name of the run function
#define SERV_7_RUN RunTestHarnessService7
// How big should this services Queue be?
#define SERV_7_QUEUE_SIZE 3
#endif
/****************************************************************************/
W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.h
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Page 3
// These are the definitions for Service 8
#if NUM_SERVICES > 8
// the header file with the public function prototypes
#define SERV_8_HEADER "TestHarnessService8.h"
// the name of the Init function
#define SERV_8_INIT InitTestHarnessService8
// the name of the run function
#define SERV_8_RUN RunTestHarnessService8
// How big should this services Queue be?
#define SERV_8_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 9
#if NUM_SERVICES > 9
// the header file with the public function prototypes
#define SERV_9_HEADER "TestHarnessService9.h"
// the name of the Init function
#define SERV_9_INIT InitTestHarnessService9
// the name of the run function
#define SERV_9_RUN RunTestHarnessService9
// How big should this services Queue be?
#define SERV_9_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 10
#if NUM_SERVICES > 10
// the header file with the public function prototypes
#define SERV_10_HEADER "TestHarnessService10.h"
// the name of the Init function
#define SERV_10_INIT InitTestHarnessService10
// the name of the run function
#define SERV_10_RUN RunTestHarnessService10
// How big should this services Queue be?
#define SERV_10_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 11
#if NUM_SERVICES > 11
// the header file with the public function prototypes
#define SERV_11_HEADER "TestHarnessService11.h"
// the name of the Init function
#define SERV_11_INIT InitTestHarnessService11
// the name of the run function
#define SERV_11_RUN RunTestHarnessService11
// How big should this services Queue be?
#define SERV_11_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 12
#if NUM_SERVICES > 12
// the header file with the public function prototypes
#define SERV_12_HEADER "TestHarnessService12.h"
// the name of the Init function
#define SERV_12_INIT InitTestHarnessService12
// the name of the run function
#define SERV_12_RUN RunTestHarnessService12
// How big should this services Queue be?
#define SERV_12_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 13
#if NUM_SERVICES > 13
// the header file with the public function prototypes
#define SERV_13_HEADER "TestHarnessService13.h"
// the name of the Init function
#define SERV_13_INIT InitTestHarnessService13
// the name of the run function
W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.h
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
Page 4
#define SERV_13_RUN RunTestHarnessService13
// How big should this services Queue be?
#define SERV_13_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 14
#if NUM_SERVICES > 14
// the header file with the public function prototypes
#define SERV_14_HEADER "TestHarnessService14.h"
// the name of the Init function
#define SERV_14_INIT InitTestHarnessService14
// the name of the run function
#define SERV_14_RUN RunTestHarnessService14
// How big should this services Queue be?
#define SERV_14_QUEUE_SIZE 3
#endif
/****************************************************************************/
// These are the definitions for Service 15
#if NUM_SERVICES > 15
// the header file with the public function prototypes
#define SERV_15_HEADER "TestHarnessService15.h"
// the name of the Init function
#define SERV_15_INIT InitTestHarnessService15
// the name of the run function
#define SERV_15_RUN RunTestHarnessService15
// How big should this services Queue be?
#define SERV_15_QUEUE_SIZE 3
#endif
/****************************************************************************/
// Name/define the events of interest
// Universal events occupy the lowest entries, followed by user-defined events
typedef enum { ES_NO_EVENT = 0,
ES_ERROR, /* used to indicate an error from the service */
ES_INIT,
/* used to transition from initial pseudo-state */
ES_TIMEOUT, /* signals that the timer has expired */
ES_SHORT_TIMEOUT, /* signals that a short timer has expired */
/* User-defined events start here */
ES_ENTRY,
ES_EXIT,
ES_ENTRY_HISTORY,
GAME_START,
CITY_ENCOUNTERED,
CITY_CAPTURED,
ATTACK_CITY,
ATTACK_LAUNCHED,
LOST_TRAIL,
BUMP,
BUMPER_DOWN,
BUMPER_UP,
ALIGNED_BEACON,
NEW_COMMAND,
WAITING,
WIRE_DETECTED,
RESPONSE_READY,
BEACON_DETECTED,
ES_NEW_KEY, /* signals a new key received from terminal */
ES_LOCK,
ES_UNLOCK} ES_EventTyp_t ;
/****************************************************************************/
// These are the definitions for the Distribution lists. Each definition
// should be a comma separated list of post functions to indicate which
// services are on that distribution list.
#define NUM_DIST_LISTS 0
#if NUM_DIST_LISTS > 0
#define DIST_LIST0 PostTestHarnessService0, PostTestHarnessService0
#endif
#if NUM_DIST_LISTS > 1
W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.h
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
Page 5
#define DIST_LIST1
#endif
#if NUM_DIST_LISTS
#define DIST_LIST2
#endif
#if NUM_DIST_LISTS
#define DIST_LIST3
#endif
#if NUM_DIST_LISTS
#define DIST_LIST4
#endif
#if NUM_DIST_LISTS
#define DIST_LIST5
#endif
#if NUM_DIST_LISTS
#define DIST_LIST6
#endif
#if NUM_DIST_LISTS
#define DIST_LIST7
#endif
PostTestHarnessService1, PostTestHarnessService1
> 2
PostTemplateFSM
> 3
PostTemplateFSM
> 4
PostTemplateFSM
> 5
PostTemplateFSM
> 6
PostTemplateFSM
> 7
PostTemplateFSM
/****************************************************************************/
// This are the name of the Event checking funcion header file.
#define EVENT_CHECK_HEADER "EventCheckers.h"
/****************************************************************************/
// This is the list of event checking functions
#define EVENT_CHECK_LIST Check4Keystroke, CheckBumperEvents
/****************************************************************************/
// These are the definitions for the post functions to be executed when the
// corresponding timer expires. All 16 must be defined. If you are not using
// a timer, then you should use TIMER_UNUSED
// Unlike services, any combination of timers may be used and there is no
// priority in servicing them
#define TIMER_UNUSED ((pPostFunc)0)
#define TIMER0_RESP_FUNC PostBumperService
#define TIMER1_RESP_FUNC PostMasterSM
#define TIMER2_RESP_FUNC PostMasterSM
#define TIMER3_RESP_FUNC PostMasterSM
#define TIMER4_RESP_FUNC PostMasterSM
#define TIMER5_RESP_FUNC PostMasterSM
#define TIMER6_RESP_FUNC PostWireSensingService
#define TIMER7_RESP_FUNC PostMasterSM
#define TIMER8_RESP_FUNC PostMasterSM
#define TIMER9_RESP_FUNC PostWireSensingService
#define TIMER10_RESP_FUNC PostMasterSM
#define TIMER11_RESP_FUNC PostMasterSM
#define TIMER12_RESP_FUNC PostMasterSM
#define TIMER13_RESP_FUNC PostMasterSM
#define TIMER14_RESP_FUNC PostMasterSM
#define TIMER15_RESP_FUNC PostMasterSM
/****************************************************************************/
// Give the timer numbers symbolc names to make it easier to move them
// to different timers if the need arises. Keep these definitions close to the
// definitions for the response functions to make it easier to check that
// the timer number matches where the timer event will be routed
// These symbolic names should be changed to be relevant to your application
//#define SERVICE0_TIMER
#define
#define
#define
#define
#define
#define
#define
#define
#define
#define
DEBOUNCE_TIMER 0
REVERSE_TIMER 1
ROTATION_TIMER 2
GAME_TIMER 3
QUERY_TIMER 4
CITY_TIMER 5
AD_TIMER 6
DETECT_TIMER 7
HALL_EFFECT_DEBOUNCE 8
ORIENT_TIMER 9
W:\_ME218bTeams\DoYouEvenStateMachine_Team17\ME218B\Final Project\CODE\Headers\ES_Configure.h
361
362
363
364
365
366
367
368
369
370
Page 6
#define
#define
#define
#define
#define
#define
HALL_EFFECT_DELAY 10
BEACON_TIMER 11
LAUNCH_TIMER 12
LAUNCH_DELAY_TIMER 13
DRIVE_FORWARD 14
ATTACK_TIMER 15
#endif /* CONFIGURE_H */