microb 2010
[aversive.git] / projects / microb2010 / mechboard / arm_highlevel.h
1 /*  
2  *  Copyright Droids Corporation (2009)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: arm_highlevel.h,v 1.4 2009-11-08 17:25:00 zer0 Exp $
19  *
20  */
21
22 #define ARM_LEFT_NUM 0
23 #define ARM_RIGHT_NUM 1
24
25 #define PUMP_LEFT1_NUM  0
26 #define PUMP_RIGHT1_NUM 1
27 #define PUMP_LEFT2_NUM  2
28 #define PUMP_RIGHT2_NUM 3
29
30 struct arm *arm_num2ptr(uint8_t arm_num);
31
32 void arm_goto_straight(uint8_t arm_num, uint8_t pump_num);
33 void arm_goto_get_column(uint8_t arm_num, uint8_t pump_num);
34 void arm_goto_prepare_get(uint8_t arm_num, uint8_t pump_num);
35 void arm_goto_intermediate_get(uint8_t arm_num, uint8_t pump_num);
36 void arm_goto_intermediate_front_get(uint8_t arm_num, uint8_t pump_num);
37 void arm_goto_prepare_eject(uint8_t arm_num, uint8_t pump_num);
38 void arm_goto_eject(uint8_t arm_num, uint8_t pump_num);
39 void arm_goto_loaded(uint8_t arm_num);
40 void arm_goto_prepare_build_inside(uint8_t arm_num, uint8_t pump_num,
41                                    uint8_t level);
42 void arm_goto_prepare_autobuild_inside(uint8_t arm_num, uint8_t pump_num,
43                                        uint8_t level);
44 void arm_goto_prepare_autobuild_outside(uint8_t arm_num, uint8_t pump_num,
45                                         uint8_t level, uint8_t dist);
46 void arm_goto_autobuild(uint8_t arm_num, uint8_t pump_num,
47                                         uint8_t level, uint8_t dist);
48
49 void arm_goto_prepare_get_lintel_inside1(void);
50 void arm_goto_prepare_get_lintel_inside2(uint8_t lintel_count);
51 void arm_goto_get_lintel_inside(uint8_t lintel_count);
52 void arm_goto_prepare_build_lintel1(void);
53 void arm_goto_prepare_build_lintel2(uint8_t level);
54 void arm_goto_prepare_build_lintel3(uint8_t level);
55 void arm_goto_build_lintel(uint8_t level);
56
57 void arm_goto_prepare_get_lintel_disp(void);
58 void arm_goto_get_lintel_disp(void);
59
60 void arm_goto_prepare_put_lintel(void);
61 void arm_goto_put_lintel(uint8_t lintel_count);
62 void arm_goto_prepare_push_temple(uint8_t arm_num);
63 void arm_goto_push_temple(uint8_t arm_num, uint8_t level);
64 void arm_goto_prepare_push_temple_disc(uint8_t arm_num);
65 void arm_goto_push_temple_disc(uint8_t arm_num);
66
67 void arm_prepare_free_pumps(void);
68 uint8_t arm_wait_both(uint8_t mask);
69 uint8_t arm_wait_select(uint8_t left, uint8_t right, uint8_t mask);
70
71 /* return the id of the free pump for the arm, or return -1 */
72 int8_t arm_get_free_pump(uint8_t arm_num);
73 int8_t arm_get_busy_pump(uint8_t arm_num);
74
75 #define PUMP_ON      3400
76 #define PUMP_OFF     0
77 #define PUMP_REVERSE -3400
78
79 void pump_set(uint8_t pump_num, int16_t val);
80 int16_t pump_num2angle(uint8_t pump_num);
81 void pump_mark_busy(uint8_t pump_num);
82 void pump_mark_free(uint8_t pump_num);
83 uint8_t pump_is_free(uint8_t pump_num);
84 uint8_t pump_is_busy(uint8_t pump_num);