Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1358 → Rev 1359

/demos/trunk/chimera/keys.c
1,11 → 1,8
 
/*
* 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)
*
14,25 → 11,6
* 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 "chimera.h"
 
unsigned char active_leg;
43,27 → 21,21
{
switch (k->scan) {
case KEY_Z:
//sem_wait(&mx_status);
status.power ^= 1;
//sem_post(&mx_status);
break;
case KEY_Q:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x1;
//sem_post(&mx_status);
break;
case KEY_W:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x2;
//sem_post(&mx_status);
break;
case KEY_E:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x4;
//sem_post(&mx_status);
break;
case KEY_1:
active_leg = 0;
break;
case KEY_2:
active_leg = 1;
break;
81,8 → 53,8
break;
case KEY_C:
calibrate_init();
if (calibrate_init != 0) calibrate_step(100000);
if (calibrate_status != 0) calibrate_step(100000);
else calibrate_init();
break;
 
case KEY_A:
114,118 → 86,141
k.flag = 0;
k.scan = KEY_1;
k.ascii = '1';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_2;
k.ascii = '2';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_3;
k.ascii = '3';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_4;
k.ascii = '4';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_5;
k.ascii = '5';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_6;
k.ascii = '6';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
/* Leg Position */
k.flag = 0;
k.scan = KEY_J;
k.ascii = 'j';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_K;
k.ascii = 'k';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_L;
k.ascii = 'l';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_U;
k.ascii = 'u';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_I;
k.ascii = 'i';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_O;
k.ascii = 'o';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_Q;
k.ascii = 'q';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
k.flag = 0;
k.scan = KEY_W;
k.ascii = 'w';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
k.flag = 0;
k.scan = KEY_E;
k.ascii = 'e';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
k.flag = 0;
k.scan = KEY_Z;
k.ascii = 'z';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
 
k.flag = 0;
k.scan = KEY_C;
k.ascii = 'c';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_A;
k.ascii = 'a';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_S;
k.ascii = 's';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_D;
k.ascii = 'd';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
k.flag = 0;
k.scan = KEY_F;
k.ascii = 'f';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
k.flag = 0;
k.scan = KEY_G;
k.ascii = 'g';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
k.flag = 0;
k.scan = KEY_H;
k.ascii = 'h';
keyb_hook(k,pad);
k.status = KEY_PRESSED;
keyb_hook(k,pad,FALSE);
 
}