Subversion Repositories NaviCtrl

Rev

Rev 789 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 789 Rev 807
1
#ifndef _UART1_H
1
#ifndef _UART1_H
2
#define _UART1_H
2
#define _UART1_H
3
 
3
 
4
#define UART_FLIGHTCTRL 0
4
#define UART_FLIGHTCTRL 0
5
#define UART_MK3MAG     1
5
#define UART_MK3MAG     1
6
#define UART_MKGPS      2
6
#define UART_MKGPS      2
7
 
7
 
8
#include "ubx.h"
8
#include "ubx.h"
9
#include "waypoints.h"
9
#include "waypoints.h"
10
 
10
 
11
#define NC_ERROR0_SPI_RX                                0x01
11
#define NC_ERROR0_SPI_RX                                0x01
12
#define NC_ERROR0_COMPASS_RX                    0x02
12
#define NC_ERROR0_COMPASS_RX                    0x02
13
#define NC_ERROR0_FC_INCOMPATIBLE               0x04
13
#define NC_ERROR0_FC_INCOMPATIBLE               0x04
14
#define NC_ERROR0_COMPASS_INCOMPATIBLE  0x08
14
#define NC_ERROR0_COMPASS_INCOMPATIBLE  0x08
15
#define NC_ERROR0_GPS_RX                                0x10
15
#define NC_ERROR0_GPS_RX                                0x10
16
#define NC_ERROR0_COMPASS_VALUE                 0x20
16
#define NC_ERROR0_COMPASS_VALUE                 0x20
17
 
17
 
18
#define DISABLE_FC_UART GPIO_WriteBit(GPIO3, GPIO_Pin_7, Bit_SET);
18
#define DISABLE_FC_UART GPIO_WriteBit(GPIO3, GPIO_Pin_7, Bit_SET);
19
#define  ENABLE_FC_UART GPIO_WriteBit(GPIO3, GPIO_Pin_7, Bit_RESET);
19
#define  ENABLE_FC_UART GPIO_WriteBit(GPIO3, GPIO_Pin_7, Bit_RESET);
20
 
20
 
21
typedef struct
21
typedef struct
22
{
22
{
23
        u8 SWMajor;
23
        u8 SWMajor;
24
        u8 SWMinor;
24
        u8 SWMinor;
25
        u8 ProtoMajor;
25
        u8 ProtoMajor;
26
        u8 LabelTextCRC;
26
        u8 LabelTextCRC;
27
        u8 SWPatch;
27
        u8 SWPatch;
28
    u8 HardwareError[2];
28
    u8 HardwareError[2];
29
    u8 HWMajor;
29
    u8 HWMajor;
30
    u8 BL_Firmware;  
30
    u8 BL_Firmware;  
31
    u8 Flags;
31
    u8 Flags;
32
} __attribute__((packed)) UART_VersionInfo_t;
32
} __attribute__((packed)) UART_VersionInfo_t;
33
 
33
 
34
extern UART_VersionInfo_t UART_VersionInfo;
34
extern UART_VersionInfo_t UART_VersionInfo;
35
 
35
 
36
//VersionInfo.Flags
36
//VersionInfo.Flags
37
#define NC_VERSION_FLAG_MK3MAG_PRESENT      0x01
37
#define NC_VERSION_FLAG_MK3MAG_PRESENT      0x01
38
#define NC_VERSION_FLAG_GPS_PRESENT             0x02
38
#define NC_VERSION_FLAG_GPS_PRESENT             0x02
39
 
39
 
40
typedef struct
40
typedef struct
41
{
41
{
42
        s16 AngleNick;  // in 0.1 deg
42
        s16 AngleNick;  // in 0.1 deg
43
        s16 AngleRoll;   // in 0.1 deg
43
        s16 AngleRoll;   // in 0.1 deg
44
        s16 Heading;    // in 0.1 deg
44
        s16 Heading;    // in 0.1 deg
45
    u8 StickNick;
45
    u8 StickNick;
46
    u8 StickRoll;
46
    u8 StickRoll;
47
    u8 StickYaw;
47
    u8 StickYaw;
48
    u8 StickGas;
48
    u8 StickGas;
49
        s16 Altimeter_5cm; // in 5cm -> devide by 20 to get meters & multiply with 5 to get cm
49
        s16 Altimeter_5cm; // in 5cm -> devide by 20 to get meters & multiply with 5 to get cm
50
        u8 reserve[2];
50
        u8 reserve[2];
51
} __attribute__((packed)) Data3D_t;
51
} __attribute__((packed)) Data3D_t;
52
 
52
 
53
extern Data3D_t Data3D;
53
extern Data3D_t Data3D;
54
 
54
 
55
 
55
 
56
extern const u8 ANALOG_LABEL[32][16];
56
extern const u8 ANALOG_LABEL[32][16];
57
 
57
 
58
#define AMPEL_FC                0x01
58
#define AMPEL_FC                0x01
59
#define AMPEL_BL                0x02
59
#define AMPEL_BL                0x02
60
#define AMPEL_NC                0x04
60
#define AMPEL_NC                0x04
61
#define AMPEL_COMPASS   0x08
61
#define AMPEL_COMPASS   0x08
62
 
62
 
63
typedef struct
63
typedef struct
64
{
64
{
65
        u8 StatusGreen;
65
        u8 StatusGreen;
66
        u8 StatusRed;
66
        u8 StatusRed;
67
        u16 Analog[32];    // Debugwerte
67
        u16 Analog[32];    // Debugwerte
68
} __attribute__((packed)) DebugOut_t;
68
} __attribute__((packed)) DebugOut_t;
69
 
69
 
70
extern DebugOut_t DebugOut;
70
extern DebugOut_t DebugOut;
71
 
71
 
72
/*
72
/*
73
typedef struct
73
typedef struct
74
{
74
{
75
        u8      Digital[2];
75
        u8      Digital[2];
76
        u8      RemoteButtons;
76
        u8      RemoteButtons;
77
        s8      Nick;
77
        s8      Nick;
78
        s8      Roll;
78
        s8      Roll;
79
        s8      Yaw;
79
        s8      Yaw;
80
        u8      Gas;
80
        u8      Gas;
81
        s8      Height;
81
        s8      Height;
82
        u8      free;
82
        u8      free;
83
        u8      Frame;
83
        u8      Frame;
84
        u8      Config;
84
        u8      Config;
85
} __attribute__((packed)) ExternControl_t;
85
} __attribute__((packed)) ExternControl_t;
86
*/
86
*/
87
 
87
 
88
#define EC_VALID                        0x01 // only valid if this is 1
88
#define EC_VALID                        0x01 // only valid if this is 1
89
#define EC_GAS_ADD                      0x02 // if 1 -> use the GAS Value not as MAX
89
#define EC_GAS_ADD                      0x02 // if 1 -> use the GAS Value not as MAX
90
#define EC_USE_SWITCH           0x20 // if 1 -> use the Switches for further control
90
#define EC_USE_SWITCH           0x20 // if 1 -> use the Switches for further control
91
#define EC_IGNORE_RC_STICK      0x40 // direct control (do nor add to RC-Stick)
91
#define EC_IGNORE_RC_STICK      0x40 // direct control (do nor add to RC-Stick)
92
#define EC_IGNORE_RC_LOST       0x80 // if 1 -> for Flying without RC-Control 
92
#define EC_IGNORE_RC_LOST       0x80 // if 1 -> for Flying without RC-Control 
93
 
93
 
94
// defines for ExternalControl.Switches -> control GPS Modes etc. if(Config & EC_USE_SWITCH)
94
// defines for ExternalControl.Switches -> control GPS Modes etc. if(Config & EC_USE_SWITCH)
95
#define EC2_PH                          0x01 // GPS-Mode: PH
95
#define EC2_PH                          0x01 // GPS-Mode: PH
96
#define EC2_CH                          0x02 // GPS-Mode: CH
96
#define EC2_CH                          0x02 // GPS-Mode: CH
97
#define EC2_CAREFREE            0x10 // 
97
#define EC2_CAREFREE            0x10 // 
98
#define EC2_ALTITUDE            0x20 // 
98
#define EC2_ALTITUDE            0x20 // 
99
#define EC2_AUTOSTART           0x40 // 
99
#define EC2_AUTOSTART           0x40 // 
100
#define EC2_AUTOLAND            0x80 // 
100
#define EC2_AUTOLAND            0x80 // 
101
 
101
 
102
typedef struct
102
typedef struct
103
{
103
{
104
 signed char Nick;
104
 signed char Nick;
105
 signed char Roll;
105
 signed char Roll;
106
 signed char Gier;
106
 signed char Gier;
107
 signed char Gas;
107
 signed char Gas;
108
 unsigned char Frame; // will return a confirm frame with this value
108
 unsigned char Frame; // will return a confirm frame with this value
109
 unsigned char Config;
109
 unsigned char Config;
110
 unsigned char Switches;
110
 unsigned char Switches;
111
 unsigned char Free1; // these two don't need capacity in the ASCII data string
111
 unsigned char Free1; // these two don't need capacity in the ASCII data string
112
 unsigned char Free2;
112
 unsigned char Free2;
113
} __attribute__((packed)) ExternControl_t;
113
} __attribute__((packed)) ExternControl_t;
114
extern ExternControl_t ExternControl;
114
extern ExternControl_t ExternControl;
115
extern u8 NewExternalControlFrame; // flag that sends the Frame to FC
115
extern u8 NewExternalControlFrame; // flag that sends the Frame to FC
116
 
116
 
117
#define SERIAL_POTI_START 17
117
#define SERIAL_POTI_START 17
118
#define WP_EVENT_PPM_IN   29
118
#define WP_EVENT_PPM_IN   29
119
#define PPM_IN_OFF        30
119
#define PPM_IN_OFF        30
120
#define PPM_IN_MAX        31
120
#define PPM_IN_MAX        31
121
#define PPM_IN_MID        32
121
#define PPM_IN_MID        32
122
typedef struct
122
typedef struct
123
{
123
{
124
 signed char   Ch[12];
124
 signed char   Ch[12];
125
} __attribute__((packed)) SerialChannel_t;
125
} __attribute__((packed)) SerialChannel_t;
126
extern SerialChannel_t SerialChannel;
126
extern SerialChannel_t SerialChannel;
127
extern u8 NewSerialChannelFrame; // flag that sends the Frame to FC
127
extern u8 NewSerialChannelFrame; // flag that sends the Frame to FC
128
 
128
 
129
typedef struct
129
typedef struct
130
{
130
{
131
        s16 Nick;
131
        s16 Nick;
132
        s16 Roll;
132
        s16 Roll;
133
        s16 Compass;                                    // angle between north and head of the MK
133
        s16 Compass;                                    // angle between north and head of the MK
134
} __attribute__((packed)) Attitude_t;
134
} __attribute__((packed)) Attitude_t;
135
 
135
 
136
 
136
 
137
typedef struct
137
typedef struct
138
{
138
{
139
        u16 Distance_dm;                                        // distance to target in dm
139
        u16 Distance_dm;                                        // distance to target in dm
140
        s16 Bearing;                                    // course to target in deg
140
        s16 Bearing;                                    // course to target in deg
141
} __attribute__((packed)) GPS_PosDev_t;
141
} __attribute__((packed)) GPS_PosDev_t;
142
 
142
 
143
#define NAVIDATA_VERSION 5
143
#define NAVIDATA_VERSION 5
144
 
144
 
145
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
146
//+ old protocol
146
//+ old protocol
147
//+ start abbo communication with: 'O' + Interval [10ms] 
147
//+ start abbo communication with: 'O' + Interval [10ms] 
148
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
148
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
149
typedef struct   // 84 Bytes    (note: this is the old protocol)
149
typedef struct   // 84 Bytes    (note: this is the old protocol)
150
{
150
{
151
        u8 Version;                                             // version of the data structure = 5 
151
        u8 Version;                                             // version of the data structure = 5 
152
        GPS_Pos_t CurrentPosition;              // see gpspos.h for details
152
        GPS_Pos_t CurrentPosition;              // see gpspos.h for details
153
        GPS_Pos_t TargetPosition;
153
        GPS_Pos_t TargetPosition;
154
        GPS_PosDev_t TargetPositionDeviation;
154
        GPS_PosDev_t TargetPositionDeviation;
155
        GPS_Pos_t HomePosition;
155
        GPS_Pos_t HomePosition;
156
        GPS_PosDev_t HomePositionDeviation;
156
        GPS_PosDev_t HomePositionDeviation;
157
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
157
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
158
        u8  WaypointNumber;                             // number of stored waypoints
158
        u8  WaypointNumber;                             // number of stored waypoints
159
        u8  SatsInUse;                                  // number of satellites used for position solution
159
        u8  SatsInUse;                                  // number of satellites used for position solution
160
        s16 Altimeter_5cm;                              // hight according to air pressure
160
        s16 Altimeter_5cm;                              // hight according to air pressure
161
        s16 Variometer;                                 // climb(+) and sink(-) rate
161
        s16 Variometer;                                 // climb(+) and sink(-) rate
162
        u16 FlyingTime;                                 // in seconds
162
        u16 FlyingTime;                                 // in seconds
163
        u8  UBat;                                               // Battery Voltage in 0.1 Volts
163
        u8  UBat;                                               // Battery Voltage in 0.1 Volts
164
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
164
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
165
        s16 Heading;                                    // current flight direction in ° as angle to north
165
        s16 Heading;                                    // current flight direction in ° as angle to north
166
        s16     CompassHeading;                         // current compass value in °
166
        s16     CompassHeading;                         // current compass value in °
167
        s8  AngleNick;                                  // current Nick angle in 1°
167
        s8  AngleNick;                                  // current Nick angle in 1°
168
        s8  AngleRoll;                                  // current Rick angle in 1°
168
        s8  AngleRoll;                                  // current Rick angle in 1°
169
        u8  RC_Quality;                                 // RC_Quality
169
        u8  RC_Quality;                                 // RC_Quality
170
        u8  FCStatusFlags;                              // Flags from FC see main.c FC_STATUS_xxx
170
        u8  FCStatusFlags;                              // Flags from FC see main.c FC_STATUS_xxx
171
        u8  NCFlags;                                    // Flags from NC see main.h NC_FLAG_xxx
171
        u8  NCFlags;                                    // Flags from NC see main.h NC_FLAG_xxx
172
        u8  Errorcode;                                  // 0 --> okay
172
        u8  Errorcode;                                  // 0 --> okay
173
        u8  WP_OperatingRadius;                 // current WP operation radius around the Home Position in m
173
        u8  WP_OperatingRadius;                 // current WP operation radius around the Home Position in m
174
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
174
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
175
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
175
        u8  TargetHoldTime;                             // time in s to stay at the given target, counts down to 0 if target has been reached
176
        u8  FCStatusFlags2;                             // StatusFlags2 (since version 5 added)
176
        u8  FCStatusFlags2;                             // StatusFlags2 (since version 5 added)
177
        s16 SetpointAltitude;                   // setpoint for altitude
177
        s16 SetpointAltitude;                   // setpoint for altitude
178
        u8  Gas;                                                // current gas (thrust)
178
        u8  Gas;                                                // current gas (thrust)
179
        u16 Current;                                    // actual current in 0.1A steps
179
        u16 Current;                                    // actual current in 0.1A steps
180
        u16 UsedCapacity;                               // used capacity in mAh
180
        u16 UsedCapacity;                               // used capacity in mAh
181
        u8 reserve1;                                    // to fit into 84 bytes (must be divisible by 3) 
181
        u8 reserve1;                                    // to fit into 84 bytes (must be divisible by 3) 
182
        u8 reserve2;                                    // to fit into 84 bytes (must be divisible by 3)
182
        u8 reserve2;                                    // to fit into 84 bytes (must be divisible by 3)
183
} __attribute__((packed)) NaviData_t;
183
} __attribute__((packed)) NaviData_t;
184
extern NaviData_t NaviData;
184
extern NaviData_t NaviData;
185
 
185
 
186
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
186
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
187
//+ New protocol
187
//+ New protocol
188
//+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes)
188
//+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes)
189
//+ i.e. 'O'+10+1024
189
//+ i.e. 'O'+10+1024
190
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
190
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
191
 
191
 
192
typedef struct // Index:10 (15 Bytes need 27 ASCII-characters)
192
typedef struct // Index:10 (15 Bytes need 27 ASCII-characters)
193
{
193
{
194
        u8 Index;                               // Index to identify this data set
194
        u8 Index;                               // Index to identify this data set
195
        s32 ActualLongitude;    // 
195
        s32 ActualLongitude;    // 
196
        s32 ActualLatitude;             // 
196
        s32 ActualLatitude;             // 
197
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
197
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
198
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
198
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
199
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
199
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
200
        u8 CamCtrlChar;                 // Status from a connected CamCtrl unit: 'R' = REC  'c' = Ready  '!' = Error  ...etc
200
        u8 CamCtrlChar;                 // Status from a connected CamCtrl unit: 'R' = REC  'c' = Ready  '!' = Error  ...etc
201
u8 reserve1;                     
201
u8 reserve1;                     
202
} __attribute__((packed)) NaviData_Tiny_t;
202
} __attribute__((packed)) NaviData_Tiny_t;
203
extern NaviData_Tiny_t NaviData_Tiny;
203
extern NaviData_Tiny_t NaviData_Tiny;
204
 
204
 
205
#define START_PAYLOAD_DATA  13  // 
205
#define START_PAYLOAD_DATA  13  // 
206
 
206
 
207
typedef struct  // Index:11 (24 Bytes need 39 ASCII-characters)
207
typedef struct  // Index:11 (24 Bytes need 39 ASCII-characters)
208
{
208
{
209
        u8 Index;                               // Index to identify this data set
209
        u8 Index;                               // Index to identify this data set
210
        s32 ActualLongitude;    // 
210
        s32 ActualLongitude;    // 
211
        s32 ActualLatitude;             // 
211
        s32 ActualLatitude;             // 
212
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm 
212
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm 
213
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
213
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
214
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
214
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
215
        u8 OSDStatusFlags2;             // see main.h for definitions OSD_FLAG2_xxx
215
        u8 OSDStatusFlags2;             // see main.h for definitions OSD_FLAG2_xxx
216
        u8  NCFlags;                    // Flags from NC
216
        u8  NCFlags;                    // Flags from NC
217
u8 ReserveFlags;
217
u8 ReserveFlags;
218
        u8  Errorcode;                  // 0 --> okay  see http://wiki.mikrokopter.de/ErrorCodes
218
        u8  Errorcode;                  // 0 --> okay  see http://wiki.mikrokopter.de/ErrorCodes
219
        u8 SpeakHoTT;                   // voice output SPEAK_xxx (see spi_slave.h)
219
        u8 SpeakHoTT;                   // voice output SPEAK_xxx (see spi_slave.h)
220
        u8 VarioCharacter;              // display as ascii character ('+' = 'climb' etc)
220
        u8 VarioCharacter;              // display as ascii character ('+' = 'climb' etc)
221
        u8 GPS_ModeCharacter;   // display as ascii character ('H' = 'Home' etc)
221
        u8 GPS_ModeCharacter;   // display as ascii character ('H' = 'Home' etc)
222
        u8 BL_MinOfMaxPWM;              // status byte of the BL-Ctrls
222
        u8 BL_MinOfMaxPWM;              // status byte of the BL-Ctrls
223
} __attribute__((packed)) NaviData_Flags_t;
223
} __attribute__((packed)) NaviData_Flags_t;
224
extern NaviData_Flags_t NaviData_Flags;
224
extern NaviData_Flags_t NaviData_Flags;
225
 
225
 
226
typedef struct  // Index:12  (27 Bytes need 43 ASCII-characters)
226
typedef struct  // Index:12  (27 Bytes need 43 ASCII-characters)
227
{
227
{
228
        u8 Index;                               // Index to identify this data set
228
        u8 Index;                               // Index to identify this data set
229
        s32 ActualLongitude;    // 
229
        s32 ActualLongitude;    // 
230
        s32 ActualLatitude;             // 
230
        s32 ActualLatitude;             // 
231
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
231
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
232
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
232
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
233
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
233
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
234
        s32 TargetLongitude;    // 
234
        s32 TargetLongitude;    // 
235
        s32 TargetLatitude;             // 
235
        s32 TargetLatitude;             // 
236
        s16 TargetAltitude;     // hight according to air pressure
236
        s16 TargetAltitude;     // hight according to air pressure
237
        u8  RC_Quality;                 // RC_Quality
237
        u8  RC_Quality;                 // RC_Quality
238
} __attribute__((packed)) NaviData_Target_t;
238
} __attribute__((packed)) NaviData_Target_t;
239
extern NaviData_Target_t NaviData_Target;
239
extern NaviData_Target_t NaviData_Target;
240
 
240
 
241
typedef struct  // Index:13  (30 Bytes need 47 ASCII-characters)
241
typedef struct  // Index:13  (30 Bytes need 47 ASCII-characters)
242
{                                          
242
{                                          
243
        u8 Index;                               // Index to identify this data set
243
        u8 Index;                               // Index to identify this data set
244
        s32 ActualLongitude;    // 
244
        s32 ActualLongitude;    // 
245
        s32 ActualLatitude;             // 
245
        s32 ActualLatitude;             // 
246
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
246
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
247
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
247
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
248
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
248
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
249
        s32 HomeLongitude;              // 
249
        s32 HomeLongitude;              // 
250
        s32 HomeLatitude;               // 
250
        s32 HomeLatitude;               // 
251
        s16 HomeAltitude;               // hight according to air pressure
251
        s16 HomeAltitude;               // hight according to air pressure
252
        u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m
252
        u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m
253
        u8 LipoCellCount;
253
        u8 LipoCellCount;
254
        u8 DescendRange;                // in [10m]
254
        u8 DescendRange;                // in [10m]
255
        u8 ManualFlyingRange;   // in [10m]
255
        u8 ManualFlyingRange;   // in [10m]
-
 
256
        u8 OSDStatusFlags3;
256
u8 reserve1;
257
u8 reserve1;
257
u8 reserve2;
-
 
258
} __attribute__((packed)) NaviData_Home_t;
258
} __attribute__((packed)) NaviData_Home_t;
259
extern NaviData_Home_t NaviData_Home;
259
extern NaviData_Home_t NaviData_Home;
260
 
260
 
261
typedef struct   // Index:14    (24 Bytes need 39 ASCII-characters)
261
typedef struct   // Index:14    (24 Bytes need 39 ASCII-characters)
262
{
262
{
263
        u8 Index;                               // Index to identify this data set
263
        u8 Index;                               // Index to identify this data set
264
        s32 ActualLongitude;    // 
264
        s32 ActualLongitude;    // 
265
        s32 ActualLatitude;             // 
265
        s32 ActualLatitude;             // 
266
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
266
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
267
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
267
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
268
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
268
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
269
        u16 FlyingTime;                 // in seconds
269
        u16 FlyingTime;                 // in seconds
270
        u16 DistanceToHome;             // [10cm] (100 = 10m)
270
        u16 DistanceToHome;             // [10cm] (100 = 10m)
271
        u8  HeadingToHome;              // in 2° (100 = 200°)
271
        u8  HeadingToHome;              // in 2° (100 = 200°)
272
        u16 DistanceToTarget;   // [10cm] (100 = 10m)   
272
        u16 DistanceToTarget;   // [10cm] (100 = 10m)   
273
        u8  HeadingToTarget;    // in 2° (100 = 200°)
273
        u8  HeadingToTarget;    // in 2° (100 = 200°)
274
        s8  AngleNick;                  // current Nick angle in 1°
274
        s8  AngleNick;                  // current Nick angle in 1°
275
        s8  AngleRoll;                  // current Rick angle in 1°
275
        s8  AngleRoll;                  // current Rick angle in 1°
276
        u8  SatsInUse;                  // number of satellites used for position solution
276
        u8  SatsInUse;                  // number of satellites used for position solution
277
} __attribute__((packed)) NaviData_Deviation_t;
277
} __attribute__((packed)) NaviData_Deviation_t;
278
extern NaviData_Deviation_t NaviData_Deviation;
278
extern NaviData_Deviation_t NaviData_Deviation;
279
 
279
 
280
typedef struct // Index:15 (18 Bytes need 31 ASCII-characters)
280
typedef struct // Index:15 (18 Bytes need 31 ASCII-characters)
281
{
281
{
282
        u8 Index;                               // Index to identify this data set
282
        u8 Index;                               // Index to identify this data set
283
        s32 ActualLongitude;    // 
283
        s32 ActualLongitude;    // 
284
        s32 ActualLatitude;             // 
284
        s32 ActualLatitude;             // 
285
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
285
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
286
        u8  GroundSpeed;                // speed over ground in 10cm/s (2D) (255 = 91km/h)
286
        u8  GroundSpeed;                // speed over ground in 10cm/s (2D) (255 = 91km/h)
287
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
287
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
288
        u8  WaypointIndex;              // index of current waypoints running from 0 to WaypointNumber-1
288
        u8  WaypointIndex;              // index of current waypoints running from 0 to WaypointNumber-1
289
        u8  WaypointNumber;             // number of stored waypoints
289
        u8  WaypointNumber;             // number of stored waypoints
290
        u8  TargetHoldTime;             // time in s to stay at the given target, counts down to 0 if target has been reached
290
        u8  TargetHoldTime;             // time in s to stay at the given target, counts down to 0 if target has been reached
291
        u8 WP_Eventchannel;             // the current value of the event channel
291
        u8 WP_Eventchannel;             // the current value of the event channel
292
u8 reserve;
292
u8 reserve;
293
} __attribute__((packed)) NaviData_WP_t;
293
} __attribute__((packed)) NaviData_WP_t;
294
extern NaviData_WP_t NaviData_WP;
294
extern NaviData_WP_t NaviData_WP;
295
 
295
 
296
typedef struct // Index:16  (27 Bytes need 43 ASCII-characters)
296
typedef struct // Index:16  (27 Bytes need 43 ASCII-characters)
297
{
297
{
298
        u8 Index;                               // Index to identify this data set
298
        u8 Index;                               // Index to identify this data set
299
        s32 ActualLongitude;    // 
299
        s32 ActualLongitude;    // 
300
        s32 ActualLatitude;             // 
300
        s32 ActualLatitude;             // 
301
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
301
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
302
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
302
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
303
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
303
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
304
        u16 UBat;                               // Battery Voltage in 0.1 Volts
304
        u16 UBat;                               // Battery Voltage in 0.1 Volts
305
        u16 Current;                    // actual current in 0.1A steps
305
        u16 Current;                    // actual current in 0.1A steps
306
        u16 UsedCapacity;               // used capacity in mAh
306
        u16 UsedCapacity;               // used capacity in mAh
307
        s8  Variometer;                 // climb(+) and sink(-) rate
307
        s8  Variometer;                 // climb(+) and sink(-) rate
308
        u8  Heading;                    // Current moving direction in 2° (100 = 200°)
308
        u8  Heading;                    // Current moving direction in 2° (100 = 200°)
309
        u8      CompassHeading;         // current compass value in 2°
309
        u8      CompassHeading;         // current compass value in 2°
310
        u8  Gas;                                // current gas (thrust)
310
        u8  Gas;                                // current gas (thrust)
311
        u16 ShutterCounter;             // counts every time a Out1 was activated
311
        u16 ShutterCounter;             // counts every time a Out1 was activated
312
        s16 SetpointAltitude;   // setpoint for altitude
312
        s16 SetpointAltitude;   // setpoint for altitude
313
} __attribute__((packed)) NaviData_Volatile_t;
313
} __attribute__((packed)) NaviData_Volatile_t;
314
extern NaviData_Volatile_t NaviData_Volatile;
314
extern NaviData_Volatile_t NaviData_Volatile;
315
 
315
 
316
 
316
 
317
typedef struct  // Index:17  (21 Bytes need 35 ASCII-characters)
317
typedef struct  // Index:17  (21 Bytes need 35 ASCII-characters)
318
{
318
{
319
        u8 Index;                               // Index to identify this data set
319
        u8 Index;                               // Index to identify this data set
320
        s32 ActualLongitude;    // 
320
        s32 ActualLongitude;    // 
321
        s32 ActualLatitude;             // 
321
        s32 ActualLatitude;             // 
322
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
322
        s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
323
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
323
        u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
324
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
324
        u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
325
        s32 Longitude;                  // Failsafe-Position
325
        s32 Longitude;                  // Failsafe-Position
326
        s32 Latitude;                   // Failsafe-Position
326
        s32 Latitude;                   // Failsafe-Position
327
} __attribute__((packed)) NaviData_FS_Pos_t;
327
} __attribute__((packed)) NaviData_FS_Pos_t;
328
extern NaviData_FS_Pos_t NaviData_Failsafe;
328
extern NaviData_FS_Pos_t NaviData_Failsafe;
329
 
329
 
330
typedef struct // Index:18  (9 Bytes need 19 ASCII-characters)
330
typedef struct // Index:18  (9 Bytes need 19 ASCII-characters)
331
{
331
{
332
        u8 Index;                               // Index to identify this data set
332
        u8 Index;                               // Index to identify this data set
333
        s32 Longitude;                  // Trigger Position
333
        s32 Longitude;                  // Trigger Position
334
        s32 Latitude;                   // Trigger Position
334
        s32 Latitude;                   // Trigger Position
335
} __attribute__((packed)) NaviData_Out_t;
335
} __attribute__((packed)) NaviData_Out_t;
336
extern NaviData_Out_t NaviData_Out1Trigger;
336
extern NaviData_Out_t NaviData_Out1Trigger;
337
 
337
 
338
 
338
 
339
extern UART_TypeDef *DebugUART;
339
extern UART_TypeDef *DebugUART;
340
extern volatile u8 SerialLinkOkay;
340
extern volatile u8 SerialLinkOkay;
341
extern Buffer_t UART1_tx_buffer;
341
extern Buffer_t UART1_tx_buffer;
342
extern Buffer_t UART1_rx_buffer;
342
extern Buffer_t UART1_rx_buffer;
343
extern u16 UART1_BaudrateFallbackTimeout;
343
extern u16 UART1_BaudrateFallbackTimeout;
344
 
344
 
345
void UART1_Init(void);
345
void UART1_Init(void);
346
void UART1_Transmit(void);
346
void UART1_Transmit(void);
347
void UART1_TransmitTxData(void);
347
void UART1_TransmitTxData(void);
348
void UART1_ProcessRxData(void);
348
void UART1_ProcessRxData(void);
349
 
349
 
350
s16  UART1_Putchar(char c);
350
s16  UART1_Putchar(char c);
351
void UART1_PutString(u8 *s);
351
void UART1_PutString(u8 *s);
352
extern u8 text[]; // globally used text buffer
352
extern u8 text[]; // globally used text buffer
353
extern u8 UART1_Request_SendFollowMe;
353
extern u8 UART1_Request_SendFollowMe;
354
extern u8 LastTransmittedFCStatusFlags2;
354
extern u8 LastTransmittedFCStatusFlags2;
355
extern u8 UART1_Request_ReadPoint;
355
extern u8 UART1_Request_ReadPoint;
356
extern WPL_Store_t WPL_Store;
356
extern WPL_Store_t WPL_Store;
357
extern u8 CalculateDebugLableCrc(void);
357
extern u8 CalculateDebugLableCrc(void);
358
extern u8 NaviData_Flags_SpeakHoTT_Processed;
358
extern u8 NaviData_Flags_SpeakHoTT_Processed;
359
 
359
 
360
extern void UART1_Configure(u32 baudrate);
360
extern void UART1_Configure(u32 baudrate);
361
 
361
 
362
typedef struct
362
typedef struct
363
{
363
{
364
        u8 User[128];
364
        u8 User[128];
365
        u8 eMail[128];
365
        u8 eMail[128];
366
        u8 Feature[128];
366
        u8 Feature[128];
367
        u8 Expire[11];
367
        u8 Expire[11];
368
        u8 License[16];
368
        u8 License[16];
369
} __attribute__((packed)) LicenseS_t;
369
} __attribute__((packed)) LicenseS_t;
370
extern u8 *LicensePtr;
370
extern u8 *LicensePtr;
371
 
371
 
372
extern u32 NMEA_Interval;// in ms
372
extern u32 NMEA_Interval;// in ms
373
#define LICENSE_SIZE            480
373
#define LICENSE_SIZE            480
374
#define LICENSE_SIZE_TEXT       411
374
#define LICENSE_SIZE_TEXT       411
375
 
375
 
376
#endif //_UART1_H
376
#endif //_UART1_H
377
 
377