Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed


/*
 * Project: S.Ha.R.K.
 *
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
 *
 * Authors     : Paolo Gai <pj@hartik.sssup.it>
 * (see authors.txt for full list of hartik's authors)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/*
 * Copyright (C) 2000 Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */


#include "kernel/kern.h"
#include "drivers/keyb.h"

#include "servo.h"

int main () {

  int res;
  char ch;

  servo_open(COM2, 115200);

  /*cprintf("servo_set_RS232_baudrate\n");
  res = servo_set_RS232_baudrate(COM2, 115200);
  cprintf("Res = %d\n",res);*/


  cprintf("servo_get_RS232_baudrate\n");
  res = servo_get_RS232_baudrate(COM2);
  cprintf("Res = %d\n",res);

  /*cprintf("servo_store_RS232_baudrate\n");
  res = servo_store_RS232_baudrate(COM2);
  cprintf("Res = %d\n\n",res);*/


  ch = keyb_getch(BLOCK);


  cprintf("servo_set_period\n");
  res = servo_set_period(COM2, 20000);
  cprintf("Res = %d\n",res);

  cprintf("servo_get_period\n");
  res = servo_get_period(COM2);
  cprintf("Res = %d\n",res);

  /*cprintf("servo_store_period\n");
  res = servo_store_period(COM2);
  cprintf("Res = %d\n\n",res);*/


  ch = keyb_getch(BLOCK);


  cprintf("servo_get_setup_switch\n");
  res = servo_get_setup_switch(COM2);
  cprintf("Res = %d\n",res);

  cprintf("servo_set_RC5_switch\n");
  res = servo_set_RC5_switch(COM2, 1);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);


  cprintf("servo_set_levels\n");
  res = servo_set_levels(COM2, 0x00,0x01);
  cprintf("Res = %d\n",res);

  cprintf("servo_get_levels\n");
  res = servo_get_levels(COM2, 1);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

  cprintf("servo_turn_off\n");
  res = servo_turn_off(COM2, 1);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

  cprintf("servo_turn_on\n");
  res = servo_turn_on(COM2, 1);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

  cprintf("servo_turn_off_all\n");
  res = servo_turn_off_all(COM2);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

  cprintf("servo_turn_on_all\n");
  res = servo_turn_on_all(COM2);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

  /*cprintf("servo_store_levels\n");
  res = servo_store_levels(COM2);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);*/



  cprintf("servo_get_analog\n");
  res = servo_get_analog(COM2, 0);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 0,ANGLE2SEC(45,0,0));
  cprintf("Res = %d\n",res);

  cprintf("servo_get_angle_sec\n");
  res = servo_get_angle_sec(COM2, 0);
  cprintf("Res = %d\n\n",res);

  ch = keyb_getch(BLOCK);

/*----------------------------------------- */

  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 0,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 0);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 1,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 0);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 2,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 2);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 3,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 3);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 4,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 4);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 5,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 5);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 6,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 6);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK); */


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 7,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 7);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 8,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 8);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 9,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 9);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 10,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 10);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 11,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 11);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 12,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 12);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 13,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 13);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 14,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 14);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  cprintf("servo_set_angle_sec\n");
  res = servo_set_angle_sec(COM2, 15,ANGLE2SEC(0,0,0));
  cprintf("Res = %d\n",res);
  /*cprintf("servo_store_default_position\n");
  res = servo_store_default_position(COM2, 15);
  cprintf("Res = %d\n",res);

  ch = keyb_getch(BLOCK);*/


  servo_close(COM2);

  return 0;

}