Subversion Repositories shark

Rev

Rev 1284 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1284 giacomo 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *
6
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
7
 *
8
 * http://www.sssup.it
9
 * http://retis.sssup.it
10
 * http://shark.sssup.it
11
 */
12
 
13
/*
14
 * Copyright (C) 2000 Paolo Gai
15
 *
16
 * This program is free software; you can redistribute it and/or modify
17
 * it under the terms of the GNU General Public License as published by
18
 * the Free Software Foundation; either version 2 of the License, or
19
 * (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
 *
30
 */
31
 
32
#include "kernel/kern.h"
33
#include "drivers/keyb.h"
34
 
35
#include "servo.h"
36
 
37
int main () {
38
 
39
  int res;
40
  char ch;
41
 
1306 giacomo 42
  servo_open(COM2, 19200);
1284 giacomo 43
 
44
  /*cprintf("servo_set_RS232_baudrate\n");
45
  res = servo_set_RS232_baudrate(COM2, 115200);
46
  cprintf("Res = %d\n",res);*/
47
 
48
  cprintf("servo_get_RS232_baudrate\n");
49
  res = servo_get_RS232_baudrate(COM2);
50
  cprintf("Res = %d\n",res);
51
 
52
  /*cprintf("servo_store_RS232_baudrate\n");
53
  res = servo_store_RS232_baudrate(COM2);
54
  cprintf("Res = %d\n\n",res);*/
55
 
56
  ch = keyb_getch(BLOCK);
57
 
58
 
59
  cprintf("servo_set_period\n");
60
  res = servo_set_period(COM2, 20000);
61
  cprintf("Res = %d\n",res);
62
 
63
  cprintf("servo_get_period\n");
64
  res = servo_get_period(COM2);
65
  cprintf("Res = %d\n",res);
66
 
67
  /*cprintf("servo_store_period\n");
68
  res = servo_store_period(COM2);
69
  cprintf("Res = %d\n\n",res);*/
70
 
71
  ch = keyb_getch(BLOCK);
72
 
73
 
74
  cprintf("servo_get_setup_switch\n");
75
  res = servo_get_setup_switch(COM2);
76
  cprintf("Res = %d\n",res);
77
 
78
  cprintf("servo_set_RC5_switch\n");
79
  res = servo_set_RC5_switch(COM2, 1);
80
  cprintf("Res = %d\n\n",res);
81
 
82
  ch = keyb_getch(BLOCK);
83
 
84
 
85
  cprintf("servo_set_levels\n");
86
  res = servo_set_levels(COM2, 0x00,0x01);
87
  cprintf("Res = %d\n",res);
88
 
89
  cprintf("servo_get_levels\n");
90
  res = servo_get_levels(COM2, 1);
91
  cprintf("Res = %d\n\n",res);
92
 
93
  ch = keyb_getch(BLOCK);
94
 
95
  cprintf("servo_turn_off\n");
96
  res = servo_turn_off(COM2, 1);
97
  cprintf("Res = %d\n\n",res);
98
 
99
  ch = keyb_getch(BLOCK);
100
 
101
  cprintf("servo_turn_on\n");
102
  res = servo_turn_on(COM2, 1);
103
  cprintf("Res = %d\n\n",res);
104
 
105
  ch = keyb_getch(BLOCK);
106
 
107
  cprintf("servo_turn_off_all\n");
108
  res = servo_turn_off_all(COM2);
109
  cprintf("Res = %d\n\n",res);
110
 
111
  ch = keyb_getch(BLOCK);
112
 
113
  cprintf("servo_turn_on_all\n");
114
  res = servo_turn_on_all(COM2);
115
  cprintf("Res = %d\n\n",res);
116
 
117
  ch = keyb_getch(BLOCK);
118
 
119
  /*cprintf("servo_store_levels\n");
120
  res = servo_store_levels(COM2);
121
  cprintf("Res = %d\n\n",res);
122
 
123
  ch = keyb_getch(BLOCK);*/
124
 
125
 
126
  cprintf("servo_get_analog\n");
127
  res = servo_get_analog(COM2, 0);
128
  cprintf("Res = %d\n\n",res);
129
 
130
  ch = keyb_getch(BLOCK);
131
 
132
 
133
  cprintf("servo_set_angle_sec\n");
134
  res = servo_set_angle_sec(COM2, 0,ANGLE2SEC(45,0,0));
135
  cprintf("Res = %d\n",res);
136
 
137
  cprintf("servo_get_angle_sec\n");
138
  res = servo_get_angle_sec(COM2, 0);
139
  cprintf("Res = %d\n\n",res);
140
 
141
  ch = keyb_getch(BLOCK);
142
 
143
/*----------------------------------------- */
144
 
145
  cprintf("servo_set_angle_sec\n");
146
  res = servo_set_angle_sec(COM2, 0,ANGLE2SEC(0,0,0));
147
  cprintf("Res = %d\n",res);
148
  /*cprintf("servo_store_default_position\n");
149
  res = servo_store_default_position(COM2, 0);
150
  cprintf("Res = %d\n",res);
151
 
152
  ch = keyb_getch(BLOCK); */
153
 
154
  cprintf("servo_set_angle_sec\n");
155
  res = servo_set_angle_sec(COM2, 1,ANGLE2SEC(0,0,0));
156
  cprintf("Res = %d\n",res);
157
  /*cprintf("servo_store_default_position\n");
158
  res = servo_store_default_position(COM2, 0);
159
  cprintf("Res = %d\n",res);
160
 
161
  ch = keyb_getch(BLOCK); */
162
 
163
  cprintf("servo_set_angle_sec\n");
164
  res = servo_set_angle_sec(COM2, 2,ANGLE2SEC(0,0,0));
165
  cprintf("Res = %d\n",res);
166
  /*cprintf("servo_store_default_position\n");
167
  res = servo_store_default_position(COM2, 2);
168
  cprintf("Res = %d\n",res);
169
 
170
  ch = keyb_getch(BLOCK); */
171
 
172
  cprintf("servo_set_angle_sec\n");
173
  res = servo_set_angle_sec(COM2, 3,ANGLE2SEC(0,0,0));
174
  cprintf("Res = %d\n",res);
175
  /*cprintf("servo_store_default_position\n");
176
  res = servo_store_default_position(COM2, 3);
177
  cprintf("Res = %d\n",res);
178
 
179
  ch = keyb_getch(BLOCK); */
180
 
181
  cprintf("servo_set_angle_sec\n");
182
  res = servo_set_angle_sec(COM2, 4,ANGLE2SEC(0,0,0));
183
  cprintf("Res = %d\n",res);
184
  /*cprintf("servo_store_default_position\n");
185
  res = servo_store_default_position(COM2, 4);
186
  cprintf("Res = %d\n",res);
187
 
188
  ch = keyb_getch(BLOCK); */
189
 
190
  cprintf("servo_set_angle_sec\n");
191
  res = servo_set_angle_sec(COM2, 5,ANGLE2SEC(0,0,0));
192
  cprintf("Res = %d\n",res);
193
  /*cprintf("servo_store_default_position\n");
194
  res = servo_store_default_position(COM2, 5);
195
  cprintf("Res = %d\n",res);
196
 
197
  ch = keyb_getch(BLOCK); */
198
 
199
  cprintf("servo_set_angle_sec\n");
200
  res = servo_set_angle_sec(COM2, 6,ANGLE2SEC(0,0,0));
201
  cprintf("Res = %d\n",res);
202
  /*cprintf("servo_store_default_position\n");
203
  res = servo_store_default_position(COM2, 6);
204
  cprintf("Res = %d\n",res);
205
 
206
  ch = keyb_getch(BLOCK); */
207
 
208
  cprintf("servo_set_angle_sec\n");
209
  res = servo_set_angle_sec(COM2, 7,ANGLE2SEC(0,0,0));
210
  cprintf("Res = %d\n",res);
211
  /*cprintf("servo_store_default_position\n");
212
  res = servo_store_default_position(COM2, 7);
213
  cprintf("Res = %d\n",res);
214
 
215
  ch = keyb_getch(BLOCK);*/
216
 
217
  cprintf("servo_set_angle_sec\n");
218
  res = servo_set_angle_sec(COM2, 8,ANGLE2SEC(0,0,0));
219
  cprintf("Res = %d\n",res);
220
  /*cprintf("servo_store_default_position\n");
221
  res = servo_store_default_position(COM2, 8);
222
  cprintf("Res = %d\n",res);
223
 
224
  ch = keyb_getch(BLOCK);*/
225
 
226
  cprintf("servo_set_angle_sec\n");
227
  res = servo_set_angle_sec(COM2, 9,ANGLE2SEC(0,0,0));
228
  cprintf("Res = %d\n",res);
229
  /*cprintf("servo_store_default_position\n");
230
  res = servo_store_default_position(COM2, 9);
231
  cprintf("Res = %d\n",res);
232
 
233
  ch = keyb_getch(BLOCK);*/
234
 
235
  cprintf("servo_set_angle_sec\n");
236
  res = servo_set_angle_sec(COM2, 10,ANGLE2SEC(0,0,0));
237
  cprintf("Res = %d\n",res);
238
  /*cprintf("servo_store_default_position\n");
239
  res = servo_store_default_position(COM2, 10);
240
  cprintf("Res = %d\n",res);
241
 
242
  ch = keyb_getch(BLOCK);*/
243
 
244
  cprintf("servo_set_angle_sec\n");
245
  res = servo_set_angle_sec(COM2, 11,ANGLE2SEC(0,0,0));
246
  cprintf("Res = %d\n",res);
247
  /*cprintf("servo_store_default_position\n");
248
  res = servo_store_default_position(COM2, 11);
249
  cprintf("Res = %d\n",res);
250
 
251
  ch = keyb_getch(BLOCK);*/
252
 
253
  cprintf("servo_set_angle_sec\n");
254
  res = servo_set_angle_sec(COM2, 12,ANGLE2SEC(0,0,0));
255
  cprintf("Res = %d\n",res);
256
  /*cprintf("servo_store_default_position\n");
257
  res = servo_store_default_position(COM2, 12);
258
  cprintf("Res = %d\n",res);
259
 
260
  ch = keyb_getch(BLOCK);*/
261
 
262
  cprintf("servo_set_angle_sec\n");
263
  res = servo_set_angle_sec(COM2, 13,ANGLE2SEC(0,0,0));
264
  cprintf("Res = %d\n",res);
265
  /*cprintf("servo_store_default_position\n");
266
  res = servo_store_default_position(COM2, 13);
267
  cprintf("Res = %d\n",res);
268
 
269
  ch = keyb_getch(BLOCK);*/
270
 
271
  cprintf("servo_set_angle_sec\n");
272
  res = servo_set_angle_sec(COM2, 14,ANGLE2SEC(0,0,0));
273
  cprintf("Res = %d\n",res);
274
  /*cprintf("servo_store_default_position\n");
275
  res = servo_store_default_position(COM2, 14);
276
  cprintf("Res = %d\n",res);
277
 
278
  ch = keyb_getch(BLOCK);*/
279
 
280
  cprintf("servo_set_angle_sec\n");
281
  res = servo_set_angle_sec(COM2, 15,ANGLE2SEC(0,0,0));
282
  cprintf("Res = %d\n",res);
283
  /*cprintf("servo_store_default_position\n");
284
  res = servo_store_default_position(COM2, 15);
285
  cprintf("Res = %d\n",res);
286
 
287
  ch = keyb_getch(BLOCK);*/
288
 
289
  servo_close(COM2);
290
 
291
  return 0;
292
 
293
}
294