Subversion Repositories shark

Rev

Rev 316 | Rev 381 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef __SERVO_H__
#define __SERVO_H__

#define SERVO_COM1 0
#define SERVO_COM2 1
#define SERVO_COM3 2
#define SERVO_COM4 3

int servo_open(int port);
int servo_close(void);

/* Setup */

int servo_set_RS232_baudrate(int baud); /* BaudRate */
int servo_get_RS232_baudrate(void);
int servo_store_RS232_baudrate(void);

int servo_set_period(int period); /* Servo period in us */
int servo_get_period(void);
int servo_store_period(void);

int servo_get_setup_switch(void); /* RC0 RC1 RC2 */
int servo_set_RC5_switch(int data);

/* Servo control */

/* Convert angle (degree, minute, second -> second) */
#define ANGLE2SEC(deg,min,sec) ((deg)*3600 + (min)*60 + (sec))

int servo_turn_off(int servo);
int servo_turn_on(int servo);
int servo_turn_off_all(void);
int servo_turn_on_all(void);

int servo_set_levels(int bank, int mask);
int servo_get_levels();
int servo_store_levels();

int servo_set_max_angle_sec(int servo, int angle_sec);
int servo_set_min_angle_sec(int servo, int angle_sec);

int servo_set_angle_sec(int servo, int angle_sec);
int servo_get_angle_sec(int servo);

int servo_store_default_position(int servo);

/* Analog control */

#define MAX_ANALOG 0x03FF

int servo_get_analog(int port);

#endif