Rev 761 | Rev 783 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
331 | cascade | 1 | /**************************************************************************** |
728 | cascade | 2 | * Copyright (C) 2009-2010 by Claas Anders "CaScAdE" Rathje * |
331 | cascade | 3 | * admiralcascade@gmail.com * |
4 | * Project-URL: http://www.mylifesucks.de/oss/c-osd/ * |
||
5 | * * |
||
6 | * This program is free software; you can redistribute it and/or modify * |
||
7 | * it under the terms of the GNU General Public License as published by * |
||
8 | * the Free Software Foundation; either version 2 of the License. * |
||
9 | * * |
||
10 | * This program is distributed in the hope that it will be useful, * |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
13 | * GNU General Public License for more details. * |
||
14 | * * |
||
15 | * You should have received a copy of the GNU General Public License * |
||
16 | * along with this program; if not, write to the * |
||
17 | * Free Software Foundation, Inc., * |
||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
19 | ****************************************************************************/ |
||
20 | |||
762 | - | 21 | #ifndef _MK_DATA_STRUCTS_H |
22 | #define _MK_DATA_STRUCTS_H |
||
23 | |||
331 | cascade | 24 | /* ########################################################################## |
25 | * gain some fake arm compat :) |
||
26 | * ##########################################################################*/ |
||
27 | #define u8 uint8_t |
||
28 | #define s8 int8_t |
||
29 | #define u16 uint16_t |
||
30 | #define s16 int16_t |
||
31 | #define u32 uint32_t |
||
32 | #define s32 int32_t |
||
33 | |||
34 | /* |
||
35 | * FC Debug Struct |
||
36 | * portions taken and adapted from |
||
37 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.72p%2Fuart.h |
||
38 | */ |
||
39 | typedef struct { |
||
40 | uint8_t Digital[2]; |
||
41 | uint16_t Analog[32]; // Debugvalues |
||
42 | } __attribute__((packed)) DebugOut_t; |
||
43 | |||
677 | cascade | 44 | typedef struct { |
761 | - | 45 | unsigned char SWMajor; |
46 | unsigned char SWMinor; |
||
47 | unsigned char ProtoMajor; |
||
48 | unsigned char ProtoMinor; |
||
49 | unsigned char SWPatch; |
||
50 | unsigned char Reserved[5]; |
||
677 | cascade | 51 | } str_VersionInfo; |
52 | |||
331 | cascade | 53 | /* |
54 | * NaviCtrl OSD Structs |
||
761 | - | 55 | * portions taken and adapted from |
728 | cascade | 56 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.18c%2Fuart1.h |
331 | cascade | 57 | */ |
58 | typedef struct { |
||
59 | s32 Longitude; // in 1E-7 deg |
||
60 | s32 Latitude; // in 1E-7 deg |
||
61 | s32 Altitude; // in mm |
||
62 | u8 Status; // validity of data |
||
761 | - | 63 | } __attribute__((packed)) GPS_Pos_t; |
64 | #define INVALID 0x00 |
||
65 | #define NEWDATA 0x01 |
||
66 | #define PROCESSED 0x02 |
||
331 | cascade | 67 | |
761 | - | 68 | typedef struct { |
69 | u16 Distance; // distance to target in cm |
||
70 | s16 Bearing; // course to target in deg |
||
331 | cascade | 71 | } __attribute__((packed)) GPS_PosDev_t; |
72 | |||
73 | typedef struct { |
||
761 | - | 74 | u8 Version; // version of the data structure |
75 | GPS_Pos_t CurrentPosition; // see ubx.h for details |
||
76 | GPS_Pos_t TargetPosition; |
||
77 | GPS_PosDev_t TargetPositionDeviation; |
||
78 | GPS_Pos_t HomePosition; |
||
79 | GPS_PosDev_t HomePositionDeviation; |
||
80 | u8 WaypointIndex; // index of current waypoints running from 0 to WaypointNumber-1 |
||
81 | u8 WaypointNumber; // number of stored waypoints |
||
82 | u8 SatsInUse; // number of satellites used for position solution |
||
83 | s16 Altimeter; // hight according to air pressure |
||
84 | s16 Variometer; // climb(+) and sink(-) rate |
||
85 | u16 FlyingTime; // in seconds |
||
86 | u8 UBat; // Battery Voltage in 0.1 Volts |
||
87 | u16 GroundSpeed; // speed over ground in cm/s (2D) |
||
88 | s16 Heading; // current flight direction in � as angle to north |
||
89 | s16 CompassHeading; // current compass value in � |
||
90 | s8 AngleNick; // current Nick angle in 1� |
||
91 | s8 AngleRoll; // current Rick angle in 1� |
||
92 | u8 RC_Quality; // RC_Quality |
||
93 | u8 FCFlags; // Flags from FC |
||
94 | u8 NCFlags; // Flags from NC |
||
95 | u8 Errorcode; // 0 --> okay |
||
96 | u8 OperatingRadius; // current operation radius around the Home Position in m |
||
97 | s16 TopSpeed; // velocity in vertical direction in cm/s |
||
98 | u8 TargetHoldTime; // time in s to stay at the given target, counts down to 0 if target has been reached |
||
99 | u8 RC_RSSI; // Receiver signal strength (since version 2 added) |
||
100 | s16 SetpointAltitude; // setpoint for altitude |
||
101 | u8 Gas; // for future use |
||
102 | u16 Current; // actual current in 0.1A steps |
||
103 | u16 UsedCapacity; // used capacity in mAh |
||
331 | cascade | 104 | } __attribute__((packed)) NaviData_t; |
105 | |||
728 | cascade | 106 | |
331 | cascade | 107 | /* |
108 | * MikroKopter Flags |
||
407 | cascade | 109 | * taken from |
734 | cascade | 110 | * http://svn.mikrokopter.de/mikrowebsvn/filedetails.php?repname=FlightCtrl&path=%2Ftags%2FV0.78b%2Ffc.h |
331 | cascade | 111 | */ |
734 | cascade | 112 | #define FCFLAG_MOTOR_RUN 0x01 |
113 | #define FCFLAG_FLY 0x02 |
||
114 | #define FCFLAG_CALIBRATE 0x04 |
||
115 | #define FCFLAG_START 0x08 |
||
116 | #define FCFLAG_NOTLANDUNG 0x10 |
||
117 | #define FCFLAG_LOWBAT 0x20 |
||
118 | #define FCFLAG_SPI_RX_ERR 0x40 |
||
119 | #define FCFLAG_I2CERR 0x80 |
||
407 | cascade | 120 | |
734 | cascade | 121 | // backward compat |
122 | #define FLAG_MOTOR_RUN FCFLAG_MOTOR_RUN |
||
123 | #define FLAG_FLY FCFLAG_FLY |
||
124 | #define FLAG_CALIBRATE FCFLAG_CALIBRATE |
||
125 | #define FLAG_START FCFLAG_START |
||
126 | |||
407 | cascade | 127 | /* |
128 | * NaviCtrl Flags |
||
129 | * taken from |
||
675 | cascade | 130 | * http://mikrocontroller.cco-ev.de/mikrowebsvn/filedetails.php?repname=NaviCtrl&path=%2Ftags%2FV0.17e%2Fuart1.h |
407 | cascade | 131 | */ |
132 | #define NC_FLAG_FREE 0x01 |
||
133 | #define NC_FLAG_PH 0x02 |
||
134 | #define NC_FLAG_CH 0x04 |
||
135 | #define NC_FLAG_RANGE_LIMIT 0x08 |
||
136 | #define NC_FLAG_NOSERIALLINK 0x10 |
||
137 | #define NC_FLAG_TARGET_REACHED 0x20 |
||
138 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
||
139 | #define NC_FLAG_8 0x80 |
||
140 | |||
141 | |||
762 | - | 142 | #endif |