Subversion Repositories NaviCtrl

Rev

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

Rev 110 Rev 112
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
 
9
 
10
typedef struct
10
typedef struct
11
{
11
{
-
 
12
        u8 SWMajor;
-
 
13
        u8 SWMinor;
-
 
14
        u8 ProtoMajor;
-
 
15
        u8 ProtoMinor;
-
 
16
        u8 SWPatch;
-
 
17
        u8 Reserved[5];
-
 
18
}  __attribute__((packed)) UART_VersionInfo_t;
-
 
19
 
-
 
20
extern UART_VersionInfo_t UART_VersionInfo;
-
 
21
 
-
 
22
 
-
 
23
typedef struct
-
 
24
{
12
   s16 AngleNick;       // in 0.1 deg
25
   s16 AngleNick;       // in 0.1 deg
13
   s16 AngleRoll;   // in 0.1 deg
26
   s16 AngleRoll;   // in 0.1 deg
14
   s16 Heading;         // in 0.1 deg
27
   s16 Heading;         // in 0.1 deg
15
   u8 reserve[8];
28
   u8 reserve[8];
16
} __attribute__((packed)) Data3D_t;
29
} __attribute__((packed)) Data3D_t;
17
 
30
 
18
extern Data3D_t Data3D;
31
extern Data3D_t Data3D;
-
 
32
 
-
 
33
 
-
 
34
extern const u8 ANALOG_LABEL[32][16];
19
 
35
 
20
typedef struct
36
typedef struct
21
{
37
{
22
        u8 Digital[2];
38
        u8 Digital[2];
23
        u16 Analog[32];    // Debugwerte
39
        u16 Analog[32];    // Debugwerte
24
} __attribute__((packed)) DebugOut_t;
40
} __attribute__((packed)) DebugOut_t;
25
 
41
 
26
extern DebugOut_t DebugOut;
42
extern DebugOut_t DebugOut;
27
 
43
 
28
typedef struct
44
typedef struct
29
{
45
{
30
        u8      Digital[2];
46
        u8      Digital[2];
31
        u8      RemoteButtons;
47
        u8      RemoteButtons;
32
        s8      Nick;
48
        s8      Nick;
33
        s8      Roll;
49
        s8      Roll;
34
        s8      Yaw;
50
        s8      Yaw;
35
        u8      Gas;
51
        u8      Gas;
36
        s8      Height;
52
        s8      Height;
37
        u8      free;
53
        u8      free;
38
        u8      Frame;
54
        u8      Frame;
39
        u8      Config;
55
        u8      Config;
40
} __attribute__((packed)) ExternControl_t;
56
} __attribute__((packed)) ExternControl_t;
41
 
57
 
42
extern ExternControl_t ExternControl;
58
extern ExternControl_t ExternControl;
43
 
59
 
44
typedef struct
60
typedef struct
45
{
61
{
46
        s16 Nick;
62
        s16 Nick;
47
        s16 Roll;
63
        s16 Roll;
48
        s16 Compass;                                    // angle between north and head of the MK
64
        s16 Compass;                                    // angle between north and head of the MK
49
}  __attribute__((packed)) Attitude_t;
65
}  __attribute__((packed)) Attitude_t;
50
 
66
 
51
typedef struct
67
typedef struct
52
{
68
{
53
        u16 Distance;                                   // distance to target in dm
69
        u16 Distance;                                   // distance to target in dm
54
        s16 Bearing;                                    // course to target in deg
70
        s16 Bearing;                                    // course to target in deg
55
}  __attribute__((packed)) GPS_PosDev_t;
71
}  __attribute__((packed)) GPS_PosDev_t;
56
 
72
 
57
#define NAVIDATA_VERSION 1
73
#define NAVIDATA_VERSION 1
58
 
74
 
59
typedef struct
75
typedef struct
60
{
76
{
61
        u8 Version;                                             // version of the data structure
77
        u8 Version;                                             // version of the data structure
62
        GPS_Pos_t CurrentPosition;              // see ubx.h for details
78
        GPS_Pos_t CurrentPosition;              // see ubx.h for details
63
        GPS_Pos_t TargetPosition;
79
        GPS_Pos_t TargetPosition;
64
        GPS_PosDev_t TargetPositionDeviation;
80
        GPS_PosDev_t TargetPositionDeviation;
65
        GPS_Pos_t HomePosition;
81
        GPS_Pos_t HomePosition;
66
        GPS_PosDev_t HomePositionDeviation;
82
        GPS_PosDev_t HomePositionDeviation;
67
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
83
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
68
        u8  WaypointNumber;                             // number of stored waypoints
84
        u8  WaypointNumber;                             // number of stored waypoints
69
        u8  SatsInUse;                                  // number of satellites used for position solution
85
        u8  SatsInUse;                                  // number of satellites used for position solution
70
        s16 Altimeter;                                  // hight according to air pressure
86
        s16 Altimeter;                                  // hight according to air pressure
71
        s16 Variometer;                                 // climb(+) and sink(-) rate
87
        s16 Variometer;                                 // climb(+) and sink(-) rate
72
        u16 FlyingTime;                                 // in seconds
88
        u16 FlyingTime;                                 // in seconds
73
        u8  UBat;                                               // Battery Voltage in 0.1 Volts
89
        u8  UBat;                                               // Battery Voltage in 0.1 Volts
74
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
90
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
75
        s16 Heading;                                    // current flight direction in ° as angle to north
91
        s16 Heading;                                    // current flight direction in ° as angle to north
76
        s16     CompassHeading;                         // current compass value in °
92
        s16     CompassHeading;                         // current compass value in °
77
        s8  AngleNick;                                  // current Nick angle in 1°
93
        s8  AngleNick;                                  // current Nick angle in 1°
78
        s8  AngleRoll;                                  // current Rick angle in 1°
94
        s8  AngleRoll;                                  // current Rick angle in 1°
79
        u8  RC_Quality;                                 // RC_Quality
95
        u8  RC_Quality;                                 // RC_Quality
80
        u8  MKFlags;                                    // Flags from FC
96
        u8  MKFlags;                                    // Flags from FC
81
        u8  NCFlags;                                    // Flags from NC
97
        u8  NCFlags;                                    // Flags from NC
82
        u8  Errorcode;                                  // 0 --> okay
98
        u8  Errorcode;                                  // 0 --> okay
83
    u8  OperatingRadius;                        // current operation radius around the Home Position in m
99
    u8  OperatingRadius;                        // current operation radius around the Home Position in m
84
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
100
        s16 TopSpeed;                                   // velocity in vertical direction in cm/s
85
        u8 TargetHoldTime;                              // time in s to stay at the given target, counts down to 0 if target has been reached
101
        u8 TargetHoldTime;                              // time in s to stay at the given target, counts down to 0 if target has been reached
86
        u8  Reserve[4];                                 // for future use
102
        u8  Reserve[4];                                 // for future use
87
} __attribute__((packed)) NaviData_t;
103
} __attribute__((packed)) NaviData_t;
88
 
104
 
89
extern NaviData_t NaviData;
105
extern NaviData_t NaviData;
90
extern u8 Request_NaviData;
-
 
91
 
106
 
92
#define NC_FLAG_FREE                    0x01
107
#define NC_FLAG_FREE                    0x01
93
#define NC_FLAG_PH                              0x02
108
#define NC_FLAG_PH                              0x02
94
#define NC_FLAG_CH                              0x04
109
#define NC_FLAG_CH                              0x04
95
#define NC_FLAG_RANGE_LIMIT             0x08
110
#define NC_FLAG_RANGE_LIMIT             0x08
96
#define NC_FLAG_NOSERIALLINK    0x10
111
#define NC_FLAG_NOSERIALLINK    0x10
97
#define NC_FLAG_TARGET_REACHED  0x20
112
#define NC_FLAG_TARGET_REACHED  0x20
98
#define NC_FLAG_MANUAL_CONTROL  0x40
113
#define NC_FLAG_MANUAL_CONTROL  0x40
99
#define NC_FLAG_8                               0x80
114
#define NC_FLAG_8                               0x80
100
 
115
 
101
extern UART_TypeDef *DebugUART;
116
extern UART_TypeDef *DebugUART;
102
extern volatile u8 SerialLinkOkay;
117
extern volatile u8 SerialLinkOkay;
103
 
118
 
104
 
119
 
105
void UART1_Init(void);
120
void UART1_Init(void);
106
void UART1_Transmit(void);
121
void UART1_Transmit(void);
107
void UART1_TransmitTxData(void);
122
void UART1_TransmitTxData(void);
108
void UART1_ProcessRxData(void);
123
void UART1_ProcessRxData(void);
109
 
124
 
110
s16  UART1_Putchar(char c);
125
s16  UART1_Putchar(char c);
111
void UART1_PutString(u8 *s);
126
void UART1_PutString(u8 *s);
112
extern u8 text[100]; // globally used text buffer
127
extern u8 text[100]; // globally used text buffer
113
extern u8 UART1_Request_SendFollowMe;
128
extern u8 UART1_Request_SendFollowMe;
114
#endif //_UART1_H
129
#endif //_UART1_H
115
 
130