aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/tacle-bench-lift/liftlibcontrol.h
blob: 2c6669e83ec4168d46af73c69c4469af03d92613 (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
#ifndef LIFTLIBCONTROL_H
#define LIFTLIBCONTROL_H

enum lift_Direction {
  lift_GO_LOAD = 8,
  lift_GO_TOP = 6,
  lift_GO_BOTTOM = 7,
  lift_GO_UP = 4,
  lift_GO_DOWN = 5
};

enum lift_Sensor {
  lift_SENS_IMPULS = 0,
  lift_SENS_TOP = 1,
  lift_SENS_BOTTOM = 2,
  lift_SENS_LOAD = 3
};

enum lift_Motor {
  lift_MOTOR_ON = 0,
  lift_MOTOR_UP = 1
};

enum lift_Command {
  lift_CMD_NONE = 0,
  lift_CMD_TOP = 1,
  lift_CMD_BOTTOM = 2,
  lift_CMD_UP = 3,
  lift_CMD_DOWN = 4
};

/* Global variables */
extern int lift_levelPos[16];
extern int lift_one_level;
extern int lift_cntValid;
extern int lift_cnt;
extern int lift_level;
extern int lift_loadLevel;
extern int lift_loadPending;
extern int lift_loadSensor;
extern int lift_cmd;
extern int lift_timMotor;
extern int lift_timImp;
extern int lift_directionUp;
extern int lift_lastImp;
extern int lift_dbgCnt;
extern int lift_endCnt;

/* Checksum */
extern int lift_checksum;

/* prototypes */
void lift_ctrl_init(void); /* DM prototype */
void lift_ctrl_loop(void); /* DM prototype */

/* internal prototypes */
int lift_check_run(void);
void lift_wait_for_motor_start(void);
void lift_do_cmd(void);
void lift_do_impulse( int val, int motor, int reset );
void lift_check_cmd(void);
void lift_check_level(void);

#endif