Subversion Repositories NaviCtrl

Rev

Rev 54 | Rev 62 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 ingob 1
#ifndef _UART1_H
2
#define _UART1_H
3
 
4
#define UART_FLIGHTCTRL 0
5
#define UART_MK3MAG     1
6
#define UART_MKGPS      2
7
 
8
#define TXD_BUFFER_LEN  150
9
#define RXD_BUFFER_LEN  150
10
#define BAUD_RATE 57600         //Baud Rate for the serial interfaces
11
 
12
#include "ubx.h" 
13
 
61 holgerb 14
typedef struct str_Data3D
15
{
16
   s16 Winkel[3]; // nick, roll, compass in 0,1°
17
   u8 reserve[8];
18
} __attribute__((packed)) Data3D_t;
19
 
20
extern Data3D_t Data3D;
21
 
41 ingob 22
typedef struct
23
{
24
        u8 Digital[2];
25
        u16 Analog[32];    // Debugwerte
26
} __attribute__((packed)) DebugOut_t;
27
 
28
extern DebugOut_t DebugOut;
29
 
30
typedef struct
31
{
32
        u8      Digital[2];
33
        u8      RemoteButtons;
34
        s8      Nick;
35
        s8      Roll;
36
        s8      Yaw;
37
        u8      Gas;
38
        s8      Height;
39
        u8      free;
40
        u8      Frame;
41
        u8      Config;
42
} __attribute__((packed)) ExternControl_t;
43
 
44
extern ExternControl_t ExternControl;
45
 
46
typedef struct
47
{
48
        s16 Nick;
49
        s16 Roll;
50
        s16 Compass;                                    // angle between north and head of the MK
51
}  __attribute__((packed)) Attitude_t;
52
 
53
typedef struct
54
{
55
        s16 Distance;                                   // distance to target in cm
56
        s16 Bearing;                                    // course to target in deg      
57
}  __attribute__((packed)) GPS_PosDev_t;
58
 
59
typedef struct
60
{
61
        GPS_Pos_t CurrentPosition;              // see ubx.h for details
62
        GPS_Pos_t TargetPosition;
63
        GPS_PosDev_t TargetPositionDeviation;
64
        GPS_Pos_t HomePosition;
65
        GPS_PosDev_t HomePositionDeviation;
66
        u8  WaypointIndex;                              // index of current waypoints running from 0 to WaypointNumber-1
67
        u8  WaypointNumber;                             // number of stored waypoints
68
        u8  SatsInUse;                                  // no of satellites used for position solution
69
        s16 Altimeter;                                  // hight according to air pressure
70
        s16 Variometer;                                 // climb(+) and sink(-) rate
71
        u16 FlyingTime;                                 // in seconds
72
        u8  UBat;                                               // Battery Voltage in 0.1 Volts
73
        u16 GroundSpeed;                                // speed over ground in cm/s (2D)
74
        s16 Heading;                                    // current flight direction in deg as angle to north
75
        s16     CompassHeading;                         // current compass value
76
        s8  AngleNick;                                  // current Nick angle in 1°
77
        s8  AngleRoll;                                  // current Rick angle in 1°
78
        u8  RC_Quality;                                 // RC_Quality
79
        u8  MKFlags;                                    // Flags from FC
80
        u8  NCFlags;                                    // Flags from NC
81
        u8  Errorcode;                                  // 0 --> okay
82
        u8  Reserve[8];                                 // for future use
83
} __attribute__((packed)) NaviData_t;
84
 
85
extern NaviData_t NaviData;
86
extern u8 Request_NaviData;
87
 
88
#define NC_FLAG_FREE                    1
89
#define NC_FLAG_PH                              2
90
#define NC_FLAG_CH                              4
91
#define NC_FLAG_RANGE_LIMIT             8
92
 
93
typedef struct
94
{
95
        u8 SWMajor;
96
        u8 SWMinor;
97
        u8 ProtoMajor;
98
        u8 ProtoMinor;
99
        u8 SWPatch;
100
        u8 Reserved[5];
101
}  __attribute__((packed)) UART_VersionInfo_t;
102
 
103
extern volatile u8 rxd_buffer[RXD_BUFFER_LEN];
104
extern volatile u8 ReceivedBytes;
105
extern volatile u8 rxd_buffer_locked;
106
extern UART_TypeDef *DebugUART;
107
 
108
 
109
void UART1_Init(void);
110
void UART1_Transmit(void);
111
void UART1_TransmitTxData(void);
112
void UART1_ProcessRxData(void);
113
 
114
s16 uart_putchar (char c);
115
void SerialPutString(u8 *s);
116
extern u8 text[100];
54 killagreg 117
extern u32 Request_NaviData_Intervall; // in ms
41 ingob 118
extern u8 Request_SendFollowMe;
119
#endif //_UART1_H