summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/elevator_cb.c
blob: 7fc880c6e0591d3bf5417e9fce55bb375c51585c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* filterbridge_cb.c - filterbridge FSM callbacks. */
/*  {{{
 *
 * Copyright (C) 2009 Nicolas Haller
 *
 * APBTeam:
 *        Web: http://apbteam.org/
 *      Email: team AT apbteam DOT org
 *
 * 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 "common.h"
#include "fsm.h"
#include "elevator_cb.h"

/*
 * OPEN_DOORS =doors_opened=>
 *  => WAIT_FOR_CLOSE_ORDER
 *   wait for close order
 */
fsm_branch_t
elevator__OPEN_DOORS__doors_opened (void)
{
    return elevator_next (OPEN_DOORS, doors_opened);
}

/*
 * WAIT_FOR_CLOSE_ORDER =order_received=>
 *  => CLOSE_DOORS
 *   closing doors
 */
fsm_branch_t
elevator__WAIT_FOR_CLOSE_ORDER__order_received (void)
{
    return elevator_next (WAIT_FOR_CLOSE_ORDER, order_received);
}

/*
 * CLOSE_DOORS =doors_closed=>
 *  => GO_TO_POS_X
 *   pucks are released and elevator is ready to make a new column
 */
fsm_branch_t
elevator__CLOSE_DOORS__doors_closed (void)
{
    return elevator_next (CLOSE_DOORS, doors_closed);
}

/*
 * WAIT_A_PUCK =time_up=>
 *  => WAIT_POS_ORDER
 *   no more time to wait a new puck
 */
fsm_branch_t
elevator__WAIT_A_PUCK__time_up (void)
{
    return elevator_next (WAIT_A_PUCK, time_up);
}

/*
 * WAIT_A_PUCK =new_puck=>
 *  => BLAH
 *   incrementing nb_puck var
 */
fsm_branch_t
elevator__WAIT_A_PUCK__new_puck (void)
{
    return elevator_next (WAIT_A_PUCK, new_puck);
}

/*
 * GO_TO_POX_Y =in_position=>
 *  => WAIT_FOR_RELEASE_ORDER
 *   ready to release pucks at altitude Y
 */
fsm_branch_t
elevator__GO_TO_POX_Y__in_position (void)
{
    return elevator_next (GO_TO_POX_Y, in_position);
}

/*
 * GO_TO_POS_X =in_position=>
 *  => WAIT_A_PUCK
 *   in position and ready to get a new puck
 */
fsm_branch_t
elevator__GO_TO_POS_X__in_position (void)
{
    return elevator_next (GO_TO_POS_X, in_position);
}

/*
 * WAIT_FOR_RELEASE_ORDER =order_received=>
 *  => OPEN_DOORS
 *   release pucks to the target position (I hope)
 */
fsm_branch_t
elevator__WAIT_FOR_RELEASE_ORDER__order_received (void)
{
    return elevator_next (WAIT_FOR_RELEASE_ORDER, order_received);
}

/*
 * BLAH =not_ok_for_other_pucks=>
 *  => WAIT_POS_ORDER
 *   no more puck, going next step
 */
fsm_branch_t
elevator__BLAH__not_ok_for_other_pucks (void)
{
    return elevator_next (BLAH, not_ok_for_other_pucks);
}

/*
 * BLAH =ok_for_other_pucks=>
 *  => GO_TO_POS_X
 *   update elevator position to get a new puck
 */
fsm_branch_t
elevator__BLAH__ok_for_other_pucks (void)
{
    return elevator_next (BLAH, ok_for_other_pucks);
}

/*
 * IDLE =started=>
 *  => GO_TO_POS_X
 *   match begin, we're going to be ready to get a new puck
 */
fsm_branch_t
elevator__IDLE__started (void)
{
    return elevator_next (IDLE, started);
}

/*
 * WAIT_POS_ORDER =order_received=>
 *  => GO_TO_POX_Y
 *   go to position Y
 */
fsm_branch_t
elevator__WAIT_POS_ORDER__order_received (void)
{
    return elevator_next (WAIT_POS_ORDER, order_received);
}