ec_stoeber.h 1.87 KB
Newer Older
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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
/*
	Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2008
	Copyright Stichting C.A. Muller Radioastronomiestation, 2008

	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 3 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, see <http://www.gnu.org/licenses/>.

 */

#ifndef _INCLUDE_EC_STOEBER_H_
#define _INCLUDE_EC_STOEBER_H_

#include "ec.h"
#include "canopen.h"

26
27
28
29
#define STOEBER_PARAM2INDEX(group, nr) (0x2000 + ((group) - 'A') * 0x200 + nr)

#define STOEBER_PDO_MAP(g,nr,s,l) \
    htole32((STOEBER_PARAM2INDEX(g,nr)<<16)|((s)<<8)|l)
Jeroen Vreeken's avatar
Jeroen Vreeken committed
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

#define STOEBER_PDO_A180	0
#define STOEBER_PDO_F210	1
#define STOEBER_PDO_I210	2
#define STOEBER_PDO_I213	4
#define STOEBER_PDO_I215	8
#define STOEBER_PDO_C230	10

#define STOEBER_PDO_I80		0
#define STOEBER_PDO_E91		4
#define STOEBER_PDO_E90		8
#define STOEBER_PDO_E19		10
#define STOEBER_PDO_E10		12

struct ec_stoeber {
	char *dev;
	struct ec_dgram_addr addr;
	float max_speed;
	float max_accel;
	float max_torque;

	float standstill_torque;
	float brake_resistor;
	float brake_power;
	
	/* rx pdo */
	unsigned char *rx_buffer; /* 14 */
	uint32_t *rx_I80;
	uint32_t *rx_E91;
	uint16_t *rx_E90;
	uint16_t *rx_E19;
	uint16_t *rx_E10;
	
	/* tx pdo */
	unsigned char *tx_buffer; /* 12 */;
	uint8_t *tx_A180;
	uint8_t *tx_F210;
	uint16_t *tx_I210;
	uint32_t *tx_I213;
	uint16_t *tx_I215;
	uint16_t *tx_C230;
};

int ec_stoeber_init(struct ec_stoeber *stbr);

#endif /* _INCLUDE_EC_STOEBER_H_ */