Rev 186 | Rev 193 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 186 | Rev 190 | ||
---|---|---|---|
1 | #ifndef _MAIN_H |
1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
2 | #define _MAIN_H |
3 | 3 | ||
4 | 4 | ||
5 | #define VERSION_MAJOR 0 |
5 | #define VERSION_MAJOR 0 |
6 | #define VERSION_MINOR 17 |
6 | #define VERSION_MINOR 18 |
7 | #define VERSION_PATCH 4 |
7 | #define VERSION_PATCH 0 |
8 | 8 | ||
9 | #define VERSION_SERIAL_MAJOR 10 |
9 | #define VERSION_SERIAL_MAJOR 10 |
10 | #define VERSION_SERIAL_MINOR 1 |
10 | #define VERSION_SERIAL_MINOR 1 |
11 | 11 | ||
12 | #define FC_SPI_COMPATIBLE 10 |
12 | #define FC_SPI_COMPATIBLE 11 |
13 | #define MK3MAG_I2C_COMPATIBLE 3 |
13 | #define MK3MAG_I2C_COMPATIBLE 3 |
14 | 14 | ||
15 | // FC FLAGS |
15 | // FC FLAGS |
16 | #define MKFLAG_MOTOR_RUN 0x01 |
16 | #define MKFLAG_MOTOR_RUN 0x01 |
17 | #define MKFLAG_FLY 0x02 |
17 | #define MKFLAG_FLY 0x02 |
18 | #define MKFLAG_CALIBRATE 0x04 |
18 | #define MKFLAG_CALIBRATE 0x04 |
19 | #define MKFLAG_START 0x08 |
19 | #define MKFLAG_START 0x08 |
20 | #define MKFLAG_EMERGENCY_LANDING 0x10 |
20 | #define MKFLAG_EMERGENCY_LANDING 0x10 |
21 | #define MKFLAG_RESERVE1 0x20 |
21 | #define MKFLAG_RESERVE1 0x20 |
22 | #define MKFLAG_RESERVE2 0x40 |
22 | #define MKFLAG_RESERVE2 0x40 |
23 | #define MKFLAG_RESERVE3 0x80 |
23 | #define MKFLAG_RESERVE3 0x80 |
24 | 24 | ||
25 | // NC Errors |
25 | // NC Errors |
26 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
26 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
27 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
27 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
28 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
28 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
29 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
29 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
30 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
30 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
31 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
31 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
32 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
32 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
- | 33 | ||
- | 34 | ||
- | 35 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
|
- | 36 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
|
- | 37 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
|
- | 38 | ||
33 | 39 | ||
34 | extern u16 BeepTime; |
40 | extern u16 BeepTime; |
35 | extern u8 NCFlags; |
41 | extern u8 NCFlags; |
36 | extern u8 ClearMKFlags; |
42 | extern u8 ClearMKFlags; |
37 | void Interrupt_Init(void); |
43 | void Interrupt_Init(void); |
38 | extern s16 GeoMagDec; |
44 | extern s16 GeoMagDec; |
39 | 45 | ||
40 | 46 | ||
41 | typedef struct |
47 | typedef struct |
42 | { |
48 | { |
43 | u8 ActiveSetting; |
49 | u8 ActiveSetting; |
44 | u8 User1; |
50 | u8 User1; |
45 | u8 User2; |
51 | u8 User2; |
46 | u8 User3; |
52 | u8 User3; |
47 | u8 User4; |
53 | u8 User4; |
48 | u8 User5; |
54 | u8 User5; |
49 | u8 User6; |
55 | u8 User6; |
50 | u8 User7; |
56 | u8 User7; |
51 | u8 User8; |
57 | u8 User8; |
52 | u8 NaviGpsModeControl; |
58 | u8 NaviGpsModeControl; |
53 | u8 NaviGpsGain; |
59 | u8 NaviGpsGain; |
54 | u8 NaviGpsP; |
60 | u8 NaviGpsP; |
55 | u8 NaviGpsI; |
61 | u8 NaviGpsI; |
56 | u8 NaviGpsD; |
62 | u8 NaviGpsD; |
57 | u8 NaviGpsPLimit; |
63 | u8 NaviGpsPLimit; |
58 | u8 NaviGpsILimit; |
64 | u8 NaviGpsILimit; |
59 | u8 NaviGpsDLimit; |
65 | u8 NaviGpsDLimit; |
60 | u8 NaviGpsACC; |
66 | u8 NaviGpsACC; |
61 | u8 NaviGpsMinSat; |
67 | u8 NaviGpsMinSat; |
62 | u8 NaviStickThreshold; |
68 | u8 NaviStickThreshold; |
63 | u8 NaviOperatingRadius; |
69 | u8 NaviOperatingRadius; |
64 | u8 NaviWindCorrection; |
70 | u8 NaviWindCorrection; |
65 | u8 NaviSpeedCompensation; |
71 | u8 NaviSpeedCompensation; |
66 | u8 LowVoltageWarning; |
72 | u8 LowVoltageWarning; |
67 | u8 NaviAngleLimitation; |
73 | u8 NaviAngleLimitation; |
68 | u8 NaviPH_LoginTime; |
74 | u8 NaviPH_LoginTime; |
69 | } __attribute__((packed)) Param_t; |
75 | } __attribute__((packed)) Param_t; |
70 | 76 | ||
71 | typedef struct |
77 | typedef struct |
72 | { |
78 | { |
73 | s8 StickNick; |
79 | s8 StickNick; |
74 | s8 StickRoll; |
80 | s8 StickRoll; |
75 | s8 StickYaw; |
81 | s8 StickYaw; |
76 | s8 StickGas; |
82 | s8 StickGas; |
77 | u8 Poti1; |
- | |
78 | u8 Poti2; |
- | |
79 | u8 Poti3; |
- | |
80 | u8 Poti4; |
83 | u8 Poti[8]; |
81 | u8 RC_Quality; |
84 | u8 RC_Quality; |
82 | u8 RC_RSSI; |
85 | u8 RC_RSSI; |
83 | u8 UBat; |
86 | u8 UBat; |
84 | u8 MKFlags; |
87 | u8 MKFlags; |
85 | } __attribute__((packed)) FC_t; |
88 | } __attribute__((packed)) FC_t; |
86 | 89 | ||
87 | 90 | ||
88 | extern Param_t Parameter; |
91 | extern Param_t Parameter; |
89 | extern volatile FC_t FC; |
92 | extern volatile FC_t FC; |
90 | extern s8 ErrorMSG[25]; |
93 | extern s8 ErrorMSG[25]; |
91 | extern u32 ErrorCode; |
94 | extern u32 ErrorCode; |
92 | extern u8 StopNavigation; |
95 | extern u8 StopNavigation; |
93 | #endif // _MAIN_H |
96 | #endif // _MAIN_H |
94 | 97 |