Subversion Repositories shark

Rev

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

Rev Author Line No. Line
1063 tullio 1
 
2
/*
3
 * This program is free software; you can redistribute it and/or modify
4
 * it under the terms of the GNU General Public License as published by
5
 * the Free Software Foundation; either version 2 of the License, or
6
 * (at your option) any later version.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program; if not, write to the Free Software
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 *
17
 */
281 giacomo 18
#ifndef __SERVO_H__
19
#define __SERVO_H__
20
 
358 giacomo 21
#ifndef COM1
22
#define COM1 0
23
#define COM2 1
24
#define COM3 2
25
#define COM4 3
26
#endif
292 giacomo 27
 
358 giacomo 28
int servo_open(int port, int speed);
29
int servo_close(int port);
291 giacomo 30
 
281 giacomo 31
/* Setup */
32
 
358 giacomo 33
int servo_set_RS232_baudrate(int port, int baud); /* BaudRate */
34
int servo_get_RS232_baudrate(int port);
35
int servo_store_RS232_baudrate(int port);
281 giacomo 36
 
358 giacomo 37
int servo_set_period(int port, int period); /* Servo period in us */
38
int servo_get_period(int port);
39
int servo_store_period(int port);
281 giacomo 40
 
358 giacomo 41
int servo_get_setup_switch(int port); /* RC0 RC1 RC2 */
42
int servo_set_RC5_switch(int port, int data);
281 giacomo 43
 
44
/* Servo control */
45
 
290 giacomo 46
/* Convert angle (degree, minute, second -> second) */
47
#define ANGLE2SEC(deg,min,sec) ((deg)*3600 + (min)*60 + (sec))
281 giacomo 48
 
358 giacomo 49
int servo_turn_off(int port, int servo);
50
int servo_turn_on(int port, int servo);
51
int servo_turn_off_all(int port);
52
int servo_turn_on_all(int port);
281 giacomo 53
 
358 giacomo 54
int servo_set_levels(int port, int bank, int mask);
55
int servo_get_levels(int port, int bank);
56
int servo_store_levels(int port);
315 giacomo 57
 
358 giacomo 58
int servo_set_max_angle_sec(int port, int servo, int angle_sec);
59
int servo_set_min_angle_sec(int port, int servo, int angle_sec);
381 giacomo 60
int servo_set_servo_tick(int port, int servo, int zero_tick, int delta_tick);
281 giacomo 61
 
358 giacomo 62
int servo_set_angle_sec(int port, int servo, int angle_sec);
63
int servo_get_angle_sec(int port, int servo);
290 giacomo 64
 
358 giacomo 65
int servo_store_default_position(int port, int servo);
290 giacomo 66
 
281 giacomo 67
/* Analog control */
68
 
772 mauro 69
#define MAX_ANALOG_10 0x03FF
70
#define MAX_ANALOG_8  0x00FF
316 giacomo 71
 
772 mauro 72
int servo_get_analog(int port, int adport, int nbit);
281 giacomo 73
 
74
#endif
75