rename i2c imuboard status flags defines
[fpv.git] / common / i2c_commands.h
1 /*
2  *  Copyright Droids Corporation (2010)
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: i2c_commands.h,v 1.9 2009-05-27 20:04:06 zer0 Exp $
19  *
20  */
21
22 #ifndef _I2C_COMMANDS_H_
23 #define _I2C_COMMANDS_H_
24
25 #define I2C_MAINBOARD_ADDR   1
26 #define I2C_IMUBOARD_ADDR    2
27
28 struct i2c_cmd_hdr {
29         uint8_t cmd;
30 };
31
32 /****/
33 /* commands that do not need and answer */
34 /****/
35
36 #define I2C_CMD_GENERIC_LED_CONTROL 0x00
37
38 struct i2c_cmd_led_control {
39         struct i2c_cmd_hdr hdr;
40         uint8_t led_num:7;
41         uint8_t state:1;
42 };
43
44 /****/
45 /* requests and their answers */
46 /****/
47
48
49 #define I2C_REQ_IMUBOARD_STATUS 0x80
50
51 struct i2c_req_imuboard_status {
52         struct i2c_cmd_hdr hdr;
53         /* add data in request if any */
54 };
55
56 #define I2C_ANS_IMUBOARD_STATUS 0x81
57
58 struct i2c_ans_imuboard_status {
59         struct i2c_cmd_hdr hdr;
60
61 #define I2C_IMUBOARD_STATUS_GPS_OK 0x01
62 #define I2C_IMUBOARD_STATUS_IMU_OK 0x02
63         uint8_t flags;
64
65         int32_t latitude;  /* between -90e7 and 90e7, in 1/1e-7 degrees,
66                             * positive means north hemisphere */
67         int32_t longitude; /* between -180e7 and 180e7, in 1/1e-7 degrees,
68                             * positive means east */
69         uint32_t altitude; /* altitude from elipsoid, in 1/100 meters */
70
71         uint16_t roll;     /* XXX unit ? */
72         uint16_t pitch;
73         uint16_t yaw;
74 };
75
76 #endif /* _I2C_PROTOCOL_H_ */