Rev 250 | Rev 255 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 250 | Rev 254 | ||
---|---|---|---|
1 | #ifndef _MAIN_H |
1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
2 | #define _MAIN_H |
3 | 3 | ||
4 | //----------------------- |
4 | //----------------------- |
5 | //#define DEBUG 1 |
5 | //#define DEBUG 1 |
6 | //----------------------- |
6 | //----------------------- |
7 | - | ||
8 | 7 | ||
9 | #define VERSION_MAJOR 0 |
8 | #define VERSION_MAJOR 0 |
10 | #define VERSION_MINOR 21 |
9 | #define VERSION_MINOR 21 |
11 | #define VERSION_PATCH 0 |
10 | #define VERSION_PATCH 0 |
12 | 11 | ||
13 | #define VERSION_SERIAL_MAJOR 11 |
12 | #define VERSION_SERIAL_MAJOR 11 |
14 | #define VERSION_SERIAL_MINOR 0 |
13 | #define VERSION_SERIAL_MINOR 0 |
15 | 14 | ||
16 | #define FC_SPI_COMPATIBLE 14 |
15 | #define FC_SPI_COMPATIBLE 14 |
17 | #define MK3MAG_I2C_COMPATIBLE 3 |
16 | #define MK3MAG_I2C_COMPATIBLE 3 |
18 | 17 | ||
19 | // FC FLAGS |
18 | // FC FLAGS |
- | 19 | // tbd: Trennen in Error Flags und Status Flags!!! |
|
- | 20 | // aufnehmen. |
|
20 | #define FCFLAG_MOTOR_RUN 0x01 |
21 | #define FCFLAG_MOTOR_RUN 0x01 |
21 | #define FCFLAG_FLY 0x02 |
22 | #define FCFLAG_FLY 0x02 |
22 | #define FCFLAG_CALIBRATE 0x04 |
23 | #define FCFLAG_CALIBRATE 0x04 |
23 | #define FCFLAG_START 0x08 |
24 | #define FCFLAG_START 0x08 |
24 | #define FCFLAG_EMERGENCY_LANDING 0x10 |
25 | #define FCFLAG_EMERGENCY_LANDING 0x10 |
25 | #define FCFLAG_LOWBAT 0x20 |
26 | #define FCFLAG_LOWBAT 0x20 |
26 | #define FCFLAG_SPI_RX_ERR 0x40 |
27 | #define FCFLAG_SPI_RX_ERR 0x40 |
27 | #define FCFLAG_RESERVE1 0x80 |
28 | #define FCFLAG_I2CERR 0x80 |
28 | 29 | ||
29 | // NC Errors |
30 | // NC Errors |
30 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
31 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
31 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
32 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
32 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
33 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
33 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
34 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
34 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
35 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
35 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
36 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
36 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
37 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
37 | 38 | ||
38 | 39 | ||
39 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
40 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
40 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
41 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
41 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
42 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
42 | 43 | ||
43 | extern u8 BoardRelease; |
44 | extern u8 BoardRelease; |
44 | extern u16 BeepTime; |
45 | extern u16 BeepTime; |
45 | extern u8 NCFlags; |
46 | extern u8 NCFlags; |
46 | extern u8 ClearFCFlags; |
47 | extern u8 ClearFCFlags; |
47 | void Interrupt_Init(void); |
48 | void Interrupt_Init(void); |
48 | extern s16 GeoMagDec; |
49 | extern s16 GeoMagDec; |
49 | 50 | ||
50 | 51 | ||
51 | typedef struct |
52 | typedef struct |
52 | { |
53 | { |
53 | u8 ActiveSetting; |
54 | u8 ActiveSetting; |
54 | u8 User1; |
55 | u8 User1; |
55 | u8 User2; |
56 | u8 User2; |
56 | u8 User3; |
57 | u8 User3; |
57 | u8 User4; |
58 | u8 User4; |
58 | u8 User5; |
59 | u8 User5; |
59 | u8 User6; |
60 | u8 User6; |
60 | u8 User7; |
61 | u8 User7; |
61 | u8 User8; |
62 | u8 User8; |
62 | u8 NaviGpsModeControl; |
63 | u8 NaviGpsModeControl; |
63 | u8 NaviGpsGain; |
64 | u8 NaviGpsGain; |
64 | u8 NaviGpsP; |
65 | u8 NaviGpsP; |
65 | u8 NaviGpsI; |
66 | u8 NaviGpsI; |
66 | u8 NaviGpsD; |
67 | u8 NaviGpsD; |
67 | u8 NaviGpsPLimit; |
68 | u8 NaviGpsPLimit; |
68 | u8 NaviGpsILimit; |
69 | u8 NaviGpsILimit; |
69 | u8 NaviGpsDLimit; |
70 | u8 NaviGpsDLimit; |
70 | u8 NaviGpsACC; |
71 | u8 NaviGpsACC; |
71 | u8 NaviGpsMinSat; |
72 | u8 NaviGpsMinSat; |
72 | u8 NaviStickThreshold; |
73 | u8 NaviStickThreshold; |
73 | u8 NaviOperatingRadius; |
74 | u8 NaviOperatingRadius; |
74 | u8 NaviWindCorrection; |
75 | u8 NaviWindCorrection; |
75 | u8 NaviSpeedCompensation; |
76 | u8 NaviSpeedCompensation; |
76 | u8 LowVoltageWarning; |
77 | u8 LowVoltageWarning; |
77 | u8 NaviAngleLimitation; |
78 | u8 NaviAngleLimitation; |
78 | u8 NaviPH_LoginTime; |
79 | u8 NaviPH_LoginTime; |
79 | } __attribute__((packed)) Param_t; |
80 | } __attribute__((packed)) Param_t; |
80 | 81 | ||
81 | typedef struct |
82 | typedef struct |
82 | { |
83 | { |
83 | s8 StickNick; |
84 | s8 StickNick; |
84 | s8 StickRoll; |
85 | s8 StickRoll; |
85 | s8 StickYaw; |
86 | s8 StickYaw; |
86 | s8 StickGas; |
87 | s8 StickGas; |
87 | u8 Poti[8]; |
88 | u8 Poti[8]; |
88 | u8 Poti5; |
89 | u8 Poti5; |
89 | u8 Poti6; |
90 | u8 Poti6; |
90 | u8 Poti7; |
91 | u8 Poti7; |
91 | u8 Poti8; |
92 | u8 Poti8; |
92 | u8 RC_Quality; |
93 | u8 RC_Quality; |
93 | u8 RC_RSSI; |
94 | u8 RC_RSSI; |
94 | u8 BAT_Voltage; |
95 | u8 BAT_Voltage; |
95 | u16 BAT_Current; |
96 | u16 BAT_Current; |
96 | u16 BAT_UsedCapacity; |
97 | u16 BAT_UsedCapacity; |
97 | u8 Flags; |
98 | u8 Flags; |
98 | } __attribute__((packed)) FC_t; |
99 | } __attribute__((packed)) FC_t; |
99 | 100 | ||
100 | 101 | ||
101 | extern Param_t Parameter; |
102 | extern Param_t Parameter; |
102 | extern volatile FC_t FC; |
103 | extern volatile FC_t FC; |
103 | extern s8 ErrorMSG[25]; |
104 | extern s8 ErrorMSG[25]; |
104 | extern u8 ErrorCode; |
105 | extern u8 ErrorCode; |
105 | extern u8 StopNavigation; |
106 | extern u8 StopNavigation; |
106 | #endif // _MAIN_H |
107 | #endif // _MAIN_H |
107 | 108 |