2 * Copyright Droids Corporation (2007)
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.
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.
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
18 * Revision : $Id: i2c_commands.h,v 1.9 2009-05-27 20:04:06 zer0 Exp $
22 #ifndef _I2C_COMMANDS_H_
23 #define _I2C_COMMANDS_H_
25 #define I2C_OPPONENT_NOT_THERE -1000
27 #define I2C_MAINBOARD_ADDR 1
28 #define I2C_COBBOARD_ADDR 2
29 #define I2C_BALLBOARD_ADDR 3
31 #define I2C_LEFT_SIDE 0
32 #define I2C_RIGHT_SIDE 1
33 #define I2C_AUTO_SIDE 2
34 #define I2C_CENTER_SIDE 3
36 #define I2C_COLOR_RED 0
37 #define I2C_COLOR_GREEN 1
44 /* commands that do not need and answer */
47 #define I2C_CMD_GENERIC_LED_CONTROL 0x00
49 struct i2c_cmd_led_control {
50 struct i2c_cmd_hdr hdr;
57 #define I2C_CMD_GENERIC_SET_COLOR 0x01
59 struct i2c_cmd_generic_color {
60 struct i2c_cmd_hdr hdr;
66 #define I2C_CMD_COBBOARD_SET_MODE 0x02
68 struct i2c_cmd_cobboard_set_mode {
69 struct i2c_cmd_hdr hdr;
70 #define I2C_COBBOARD_MODE_INIT 0x00
71 #define I2C_COBBOARD_MODE_MANUAL 0x01
72 #define I2C_COBBOARD_MODE_HARVEST 0x02
73 #define I2C_COBBOARD_MODE_EXIT 0xFF
85 /* requests and their answers */
89 #define I2C_REQ_COBBOARD_STATUS 0x80
91 struct i2c_req_cobboard_status {
92 struct i2c_cmd_hdr hdr;
93 int16_t sickle_left1_current;
96 #define I2C_ANS_COBBOARD_STATUS 0x81
98 struct i2c_ans_cobboard_status {
99 struct i2c_cmd_hdr hdr;
100 /* mode type are defined above: I2C_COBBOARD_MODE_xxx */
103 #define I2C_COBBOARD_STATUS_F_READY 0x00
104 #define I2C_COBBOARD_STATUS_F_BUSY 0x01
105 #define I2C_COBBOARD_STATUS_F_EXCPT 0x02
111 #define I2C_REQ_BALLBOARD_STATUS 0x82
113 struct i2c_req_ballboard_status {
114 struct i2c_cmd_hdr hdr;
117 #define I2C_ANS_BALLBOARD_STATUS 0x83
119 struct i2c_ans_ballboard_status {
120 struct i2c_cmd_hdr hdr;
123 #define I2C_BALLBOARD_STATUS_F_READY 0x00
124 #define I2C_BALLBOARD_STATUS_F_BUSY 0x01
125 #define I2C_BALLBOARD_STATUS_F_EXCPT 0x02
131 #endif /* _I2C_PROTOCOL_H_ */