Rev 358 | Rev 772 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
281 | giacomo | 1 | #ifndef __SERVO_H__ |
2 | #define __SERVO_H__ |
||
3 | |||
358 | giacomo | 4 | #ifndef COM1 |
5 | #define COM1 0 |
||
6 | #define COM2 1 |
||
7 | #define COM3 2 |
||
8 | #define COM4 3 |
||
9 | #endif |
||
292 | giacomo | 10 | |
358 | giacomo | 11 | int servo_open(int port, int speed); |
12 | int servo_close(int port); |
||
291 | giacomo | 13 | |
281 | giacomo | 14 | /* Setup */ |
15 | |||
358 | giacomo | 16 | int servo_set_RS232_baudrate(int port, int baud); /* BaudRate */ |
17 | int servo_get_RS232_baudrate(int port); |
||
18 | int servo_store_RS232_baudrate(int port); |
||
281 | giacomo | 19 | |
358 | giacomo | 20 | int servo_set_period(int port, int period); /* Servo period in us */ |
21 | int servo_get_period(int port); |
||
22 | int servo_store_period(int port); |
||
281 | giacomo | 23 | |
358 | giacomo | 24 | int servo_get_setup_switch(int port); /* RC0 RC1 RC2 */ |
25 | int servo_set_RC5_switch(int port, int data); |
||
281 | giacomo | 26 | |
27 | /* Servo control */ |
||
28 | |||
290 | giacomo | 29 | /* Convert angle (degree, minute, second -> second) */ |
30 | #define ANGLE2SEC(deg,min,sec) ((deg)*3600 + (min)*60 + (sec)) |
||
281 | giacomo | 31 | |
358 | giacomo | 32 | int servo_turn_off(int port, int servo); |
33 | int servo_turn_on(int port, int servo); |
||
34 | int servo_turn_off_all(int port); |
||
35 | int servo_turn_on_all(int port); |
||
281 | giacomo | 36 | |
358 | giacomo | 37 | int servo_set_levels(int port, int bank, int mask); |
38 | int servo_get_levels(int port, int bank); |
||
39 | int servo_store_levels(int port); |
||
315 | giacomo | 40 | |
358 | giacomo | 41 | int servo_set_max_angle_sec(int port, int servo, int angle_sec); |
42 | int servo_set_min_angle_sec(int port, int servo, int angle_sec); |
||
381 | giacomo | 43 | int servo_set_servo_tick(int port, int servo, int zero_tick, int delta_tick); |
281 | giacomo | 44 | |
358 | giacomo | 45 | int servo_set_angle_sec(int port, int servo, int angle_sec); |
46 | int servo_get_angle_sec(int port, int servo); |
||
290 | giacomo | 47 | |
358 | giacomo | 48 | int servo_store_default_position(int port, int servo); |
290 | giacomo | 49 | |
281 | giacomo | 50 | /* Analog control */ |
51 | |||
316 | giacomo | 52 | #define MAX_ANALOG 0x03FF |
53 | |||
358 | giacomo | 54 | int servo_get_analog(int port, int adport); |
281 | giacomo | 55 | |
56 | #endif |
||
57 |