/demos/trunk/chimera/initfile.c |
---|
4,7 → 4,8 |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@sssup.it> |
* |
* Authors : Paolo Gai <pj@hartik.sssup.it> |
* Authors : Mauro Marinoni <mauro.marinoni@unipv.it> |
* Giacomo Guidi <giacomo@gandalf.sssup.it> |
* (see authors.txt for full list of hartik's authors) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
14,31 → 15,17 |
* http://hartik.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" |
#include "modules/edf.h" |
#include "modules/hardcbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
#include "modules/intdrive.h" |
#include <drivers/shark_input26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_linuxc26.h> |
/*+ sysyem tick in us +*/ |
#define TICK 1000 |
45,6 → 32,9 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
#define INTDRIVE_Q 1000 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAGS 0 |
int main(int argc, char **argv); |
52,8 → 42,9 |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_T, INTDRIVE_FLAGS); |
EDF_register_level(EDF_ENABLE_ALL); |
HCBS_register_level(HCBS_ENABLE_ALL, 0); |
HCBS_register_level(HCBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
70,7 → 61,9 |
HARTPORT_init(); |
KEYB_init(&kparms); |
LINUXC26_register_module(); |
INPUT26_init(); |
KEYB26_init(&kparms); |
__call_main__(mb); |
/demos/trunk/chimera/calibrate.c |
---|
1,4 → 1,3 |
/* |
* Project: S.Ha.R.K. |
* |
12,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" |
#include <ll/i386/64bit.h> |
40,8 → 20,6 |
extern HEXAPOD_STATE status; |
extern unsigned char active_leg; |
extern sem_t mx_servo; |
struct leg_calibration { |
int side; |
int pos[6]; |
51,10 → 29,10 |
struct leg_calibration calibration_table[] = { |
{1,{0,90,-45,45,-90,0},{432001,403201,432001},{-201600,28800,241201}}, |
{-1,{0,90,-45,45,-90,0},{413949,453599,431999},{216000,50401,-215599}}, |
{1,{0,90,-45,45,-45,45},{417601,388801,424741},{-216000,-43200,82770}}, |
{-1,{0,90,-45,45,-45,45},{421199,421199,443799},{165600,-8999,30600}}, |
{1,{0,90,-45,45,0,90},{414001,424801,410401},{-162000,39600,-122400}}, |
{-1,{0,90,-45,45,-90,0},{413949,453599,431999},{216000,50401,-215599}}, |
{-1,{0,90,-45,45,-45,45},{421199,421199,443799},{165600,-8999,30600}}, |
{-1,{0,90,-45,45,0,90},{0,0,0},{0,0,0}}, |
}; |
78,25 → 56,21 |
clear(); |
sem_wait(&mx_servo); |
servo_turn_off(COM_PORT, active_leg*3+2); |
servo_turn_off(COM_PORT, active_leg*3+1); |
servo_turn_off(COM_PORT, active_leg*3); |
servo_turn_off(com(active_leg*3), pin(active_leg*3)); |
servo_turn_off(com(active_leg*3+1), pin(active_leg*3+1)); |
servo_turn_off(com(active_leg*3+2), pin(active_leg*3+2)); |
servo_count = 0; |
servo_turn_on(COM_PORT, active_leg*3+2); |
servo_turn_on(com(active_leg*3), pin(active_leg*3)); |
turn_on = 0; |
sem_post(&mx_servo); |
while (calibrate_status == 1) { |
sem_wait(&mx_servo); |
if (calibrate_exec_step == 100000) { |
angsec_temp[servo_count] = test_angle[3*active_leg+num]; |
printf_xy(0,10+servo_count,WHITE,"%08d",test_angle[3*active_leg+num]); |
servo_turn_off(COM_PORT,3*active_leg+num); |
servo_turn_off(com(3*active_leg+num),pin(3*active_leg+num)); |
servo_count++; |
if (servo_count == 6) { |
114,8 → 88,6 |
calibrate_status = 0; |
calibrate_exec_step = 0; |
sem_post(&mx_servo); |
task_kill(exec_shadow); |
task_testcancel(); |
131,7 → 103,7 |
case 0: |
case 1: |
sprintf(servo_name,"ALFA "); |
num = 2; |
num = 0; |
break; |
case 2: |
case 3: |
141,12 → 113,12 |
case 4: |
case 5: |
sprintf(servo_name,"GAMMA"); |
num = 0; |
num = 2; |
break; |
} |
if (turn_on == 1) { |
servo_turn_on(COM_PORT,3*active_leg+num); |
servo_turn_on(com(3*active_leg+num),pin(3*active_leg+num)); |
turn_on = 0; |
} |
153,22 → 125,20 |
set = calibration_table[active_leg].pos[servo_count]; |
printf_xy(10,10+servo_count,WHITE,"Set servo %s to position %d",servo_name,set); |
servo_turn_on(COM_PORT, active_leg*3+num); |
servo_turn_on(com(3*active_leg+num),pin(3*active_leg+num)); |
if (calibrate_exec_step != 0) { |
test_angle[3*active_leg+num] += calibrate_exec_step; |
printf_xy(10,20,WHITE,"Set %08d to servo %03d",test_angle[3*active_leg+num],3*active_leg+num); |
servo_set_angle_sec(COM_PORT, 3*active_leg+num, test_angle[3*active_leg+num]); |
servo_set_angle_sec(com(3*active_leg+num), pin(3*active_leg+num), test_angle[3*active_leg+num]); |
calibrate_exec_step = 0; |
} |
angsec = servo_get_angle_sec(COM_PORT, 3*active_leg+num); |
angsec = servo_get_angle_sec(com(3*active_leg+num), pin(3*active_leg+num)); |
sem_post(&mx_servo); |
printf_xy(10,21,WHITE,"Angle Seconds = %08d",angsec); |
task_endcycle(); |
/demos/trunk/chimera/chimera.c |
---|
10,25 → 10,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" |
void my_close(void *arg) |
55,9 → 36,9 |
ADDUSEC2TIMESPEC(10000000,&(e[i].time)); |
e[i].type = EVT_SET_MASK_LEG_ANGLE; |
e[i].mask = 31; |
e[i].mask = 0x3F; |
e[i].ang.a = 0 * 3600; |
e[i].ang.b = 80 * 3600; |
e[i].ang.b = 70 * 3600; |
e[i].ang.c = 0; |
e[i].pwm = 7; |
67,9 → 48,9 |
ADDUSEC2TIMESPEC(11000000,&(e[i+1].time)); |
e[i+1].type = EVT_SET_MASK_LEG_ANGLE; |
e[i+1].mask = 31; |
e[i+1].mask = 0x3F; |
e[i+1].ang.a = 90 * 3600; |
e[i+1].ang.b = 80 * 3600; |
e[i+1].ang.b = 70 * 3600; |
e[i+1].ang.c = 0; |
e[i+1].pwm = 7; |
79,7 → 60,7 |
ADDUSEC2TIMESPEC(12000000,&(e[i+2].time)); |
e[i+2].type = EVT_SET_MASK_LEG_ANGLE; |
e[i+2].mask = 31; |
e[i+2].mask = 0x3F; |
e[i+2].ang.a = 90 * 3600; |
e[i+2].ang.b = -50 * 3600; |
e[i+2].ang.c = 0; |
91,7 → 72,7 |
ADDUSEC2TIMESPEC(13000000,&(e[i+3].time)); |
e[i+3].type = EVT_SET_MASK_LEG_ANGLE; |
e[i+3].mask = 31; |
e[i+3].mask = 0x3F; |
e[i+3].ang.a = 90 * 3600; |
e[i+3].ang.b = 0 * 3600; |
e[i+3].ang.c = 0; |
103,7 → 84,7 |
ADDUSEC2TIMESPEC(15000000,&(e[i+4].time)); |
e[i+4].type = EVT_SET_MASK_LEG_ANGLE; |
e[i+4].mask = 31; |
e[i+4].mask = 0x3F; |
e[i+4].ang.a = 90 * 3600; |
e[i+4].ang.b = 0 * 3600; |
e[i+4].ang.c = 0; |
127,7 → 108,8 |
init_send(); /* Comunication */ |
init_key(); /* Keyboard */ |
action_stand_up(); |
//action_stand_up(); |
return 0; |
} |
/demos/trunk/chimera/send.c |
---|
1,4 → 1,3 |
/* |
* Project: S.Ha.R.K. |
* |
11,25 → 10,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" |
//#define DEBUG_SEND /* Print Sent Values */ |
37,18 → 17,18 |
/* Servo Tasks Constants */ |
#ifdef DUBUG_SEND |
#define SEND_TASK_WCET 6000 |
#define SEND_TASK_WCET 20000 |
#else |
#define SEND_TASK_WCET 6000 |
#define SEND_TASK_WCET 20000 |
#endif |
#define SEND_TASK_MIT 20000 |
#define SEND_TASK_MIT 40000 |
#ifdef DUBUG_SEND |
#define GET_TASK_WCET 6000 |
#define GET_TASK_WCET 5000 |
#else |
#define GET_TASK_WCET 6000 |
#define GET_TASK_WCET 5000 |
#endif |
#define GET_TASK_MIT 20000 |
#define GET_TASK_MIT 40000 |
#define LEG_A 100.0 |
#define LEG_B 66.0 |
63,7 → 43,6 |
const float todeg = 180.0 / PI; |
const float torad = PI / 180.0; |
sem_t mx_status, mx_adc_status, mx_servo; |
HEXAPOD_STATE status; |
extern struct leg_calibration calibration_table[]; |
163,10 → 142,8 |
if (e->type == EVT_SET_MASK_LEG_ANGLE) { |
for (i=0;i<6;i++) |
if ((1 << i) & e->mask) { |
if ((e->mask >> i) & 1) { |
sem_wait(&mx_status); |
status.ang[i].a = e->ang.a; |
status.ang[i].b = e->ang.b; |
status.ang[i].c = e->ang.c; |
173,8 → 150,6 |
status.cfg[i].pwm = e->pwm; |
sem_post(&mx_status); |
#ifdef DEBUG_SEND |
printf_xy(3,2,WHITE,"%8d: Update leg %2d angle",(int)kern_gettime(NULL),i); |
#endif |
194,7 → 169,7 |
{ |
HEXAPOD_STATE old_status; |
register char changes, new_pos, new_pwm, new_power; |
int n; |
int res,n; |
for (n=0; n<6;n++) { |
old_status.ang[n].a = 0; |
214,8 → 189,6 |
new_pwm = 0; |
new_power = 0; |
sem_wait(&mx_status); |
if ((status.ang[n].a != old_status.ang[n].a) || |
(status.ang[n].b != old_status.ang[n].b) || |
(status.ang[n].c != old_status.ang[n].c)) { |
234,37 → 207,32 |
old_status.power = status.power; |
new_power++; |
} |
sem_post(&mx_status); |
if (new_pos) { |
#ifdef SERIAL_ON |
sem_wait(&mx_servo); |
servo_set_angle_sec(COM_PORT, n*3+2, adjust(status.ang[n].a,n,0)); |
servo_set_angle_sec(COM_PORT, n*3+1, adjust(status.ang[n].b,n,1)); |
servo_set_angle_sec(COM_PORT, n*3 , adjust(status.ang[n].c,n,2)); |
sem_post(&mx_servo); |
res = servo_set_angle_sec(com(n*3 ), pin(n*3 ), adjust(status.ang[n].a,n,0)); |
if (res != 0) cprintf("Error send data\n"); |
res = servo_set_angle_sec(com(n*3+1), pin(n*3+1), adjust(status.ang[n].b,n,1)); |
if (res != 0) cprintf("Error send data\n"); |
res = servo_set_angle_sec(com(n*3+2), pin(n*3+2), adjust(status.ang[n].c,n,2)); |
if (res != 0) cprintf("Error send data\n"); |
#endif |
} |
if (new_pwm) { |
#ifdef SERIAL_ON |
sem_wait(&mx_servo); |
(old_status.cfg[n].pwm & 1) ? servo_turn_on(COM_PORT, n*3+2) : servo_turn_off(COM_PORT, n*3+2); |
(old_status.cfg[n].pwm & 2) ? servo_turn_on(COM_PORT, n*3+1) : servo_turn_off(COM_PORT, n*3+1); |
(old_status.cfg[n].pwm & 4) ? servo_turn_on(COM_PORT, n*3 ) : servo_turn_off(COM_PORT, n*3 ); |
sem_post(&mx_servo); |
(old_status.cfg[n].pwm & 1) ? servo_turn_on(com(n*3 ), pin(n*3 )) : servo_turn_off(com(n*3 ), pin(n*3 )); |
(old_status.cfg[n].pwm & 2) ? servo_turn_on(com(n*3+1), pin(n*3+1)) : servo_turn_off(com(n*3+1), pin(n*3+1)); |
(old_status.cfg[n].pwm & 4) ? servo_turn_on(com(n*3+2), pin(n*3+2)) : servo_turn_off(com(n*3+2), pin(n*3+2)); |
#endif |
} |
if (new_power) { |
#ifdef SERIAL_ON |
if (old_status.power) { |
sem_wait(&mx_servo); |
servo_set_RC5_switch(COM_PORT, 1); |
sem_post(&mx_servo); |
servo_set_RC5_switch(COM2, 1); |
} else { |
sem_wait(&mx_servo); |
servo_set_RC5_switch(COM_PORT, 0); |
sem_post(&mx_servo); |
servo_set_RC5_switch(COM2, 0); |
} |
#endif |
} |
288,16 → 256,12 |
while (1) { |
#ifdef SERIAL_ON |
sem_wait(&mx_adc_status); |
sem_wait(&mx_servo); |
status.cfg[i ].adc_in = servo_get_analog(COM_PORT, i ); |
status.cfg[i+1].adc_in = servo_get_analog(COM_PORT, i+1); |
sem_post(&mx_servo); |
status.cfg[i ].adc_in = servo_get_analog(COM1, i ); |
status.cfg[i+1].adc_in = servo_get_analog(COM1, i+1); |
#ifdef DEBUG_SEND |
cprintf("Leg %1d-%1d: (%4d) (%4d)\n", i, i+1, status.leg[i].adc_in, status.leg[i+1].adc_in); |
#endif |
i = (i+2)%6; |
sem_post(&mx_adc_status); |
#endif |
task_endcycle(); |
} |
308,7 → 272,9 |
int init_serial() |
{ |
int err; |
err = servo_open(COM_PORT, 19200); |
err = servo_open(COM1, COM_SPEED); |
if (!err) |
err = servo_open(COM2, COM_SPEED); |
return err; |
} |
315,19 → 281,20 |
void end_serial() |
{ |
servo_close(COM_PORT); |
servo_close(COM1); |
servo_close(COM2); |
} |
void init_send_task() |
{ |
SOFT_TASK_MODEL ms; |
HARD_TASK_MODEL ms; |
PID pid; |
soft_task_default_model(ms); |
soft_task_def_ctrl_jet(ms); |
soft_task_def_met(ms, SEND_TASK_WCET); |
soft_task_def_period(ms, SEND_TASK_MIT); |
soft_task_def_usemath(ms); |
hard_task_default_model(ms); |
hard_task_def_ctrl_jet(ms); |
hard_task_def_wcet(ms, SEND_TASK_WCET); |
hard_task_def_mit(ms, SEND_TASK_MIT); |
hard_task_def_usemath(ms); |
pid = task_create("Send_Task", servo_send, &ms, NULL); |
if (pid == NIL) { |
perror("Could not create task <Send_Task>"); |
335,17 → 302,17 |
} else |
task_activate(pid); |
soft_task_default_model(ms); |
soft_task_def_ctrl_jet(ms); |
soft_task_def_met(ms, GET_TASK_WCET); |
soft_task_def_period(ms, GET_TASK_MIT); |
soft_task_def_usemath(ms); |
hard_task_default_model(ms); |
hard_task_def_ctrl_jet(ms); |
hard_task_def_wcet(ms, GET_TASK_WCET); |
hard_task_def_mit(ms, GET_TASK_MIT); |
hard_task_def_usemath(ms); |
pid = task_create("Get_Task", servo_get, &ms, NULL); |
if (pid == NIL) { |
perror("Could not create task <Get_Task>"); |
sys_end(); |
} else |
task_activate(pid); |
} //else |
//task_activate(pid); |
} |
void init_send() |
357,10 → 324,6 |
sys_end(); |
} |
sem_init(&mx_status,0,1); |
sem_init(&mx_adc_status,0,1); |
sem_init(&mx_servo,0,1); |
for (i=0; i<6;i++) { |
status.ang[i].a = 0; |
status.ang[i].b = 0; |
375,7 → 338,5 |
void end_send() |
{ |
end_serial(); |
} |
/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); |
} |
/demos/trunk/chimera/makefile |
---|
12,5 → 12,5 |
include $(BASE)/config/example.mk |
chimera: |
make -f $(SUBMAKE) APP=chimera INIT= OTHEROBJS="initfile.o calibrate.o send.o action.o keys.o" SHARKOPT="__OLDCHAR__ __SERVO____LINUXC26__" |
make -f $(SUBMAKE) APP=chimera INIT= OTHEROBJS="initfile.o calibrate.o send.o action.o keys.o" SHARKOPT="__INPUT__ __NEWPCI__ __SERVO__ __LINUXC26__" |
/demos/trunk/chimera/action.c |
---|
1,10 → 1,8 |
/* |
* Project: S.Ha.R.K. |
* |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
12,25 → 10,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" |
struct action_event *first_action_event = NULL; |
/demos/trunk/chimera/chimera.h |
---|
4,8 → 4,6 |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* Gerardo Lamastra <gerardo@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 → 12,6 |
* http://hartik.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 <stdlib.h> |
#include <string.h> |
#include <math.h> |
41,15 → 20,15 |
#include <semaphore.h> |
#include "modules/sem.h" |
#include "modules/hartport.h" |
#include <drivers/keyb.h> |
#include <drivers/shark_keyb26.h> |
#include <servo.h> |
/* COM Port Constants */ |
#define COM_PORT COM2 |
#define COM_PORT COM1 |
#define COM_SPEED 115200 |
#define com(i) ((i) / 12) ? COM2 : COM1 |
#define com(i) ((i) / 12) ? COM1 : COM2 |
#define pin(i) (i) % 12 |
/* Angle bounds */ |