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