Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
595 | hbuss | 1 | #ifndef _UART_H |
1 | ingob | 2 | #define _UART_H |
3 | |||
1444 | ingob | 4 | #define printf_P(format, args...) _printf_P(&uart_putchar, format , ## args) |
5 | #define printf(format, args...) _printf_P(&uart_putchar, PSTR(format) , ## args) |
||
1 | ingob | 6 | |
304 | ingob | 7 | void BearbeiteRxDaten(void); |
8 | |||
1 | ingob | 9 | extern unsigned char DebugGetAnforderung; |
1942 | holgerb | 10 | extern unsigned volatile char ReceiverUpdateModeActive; |
1 | ingob | 11 | extern unsigned volatile char UebertragungAbgeschlossen; |
12 | extern unsigned volatile char PC_DebugTimeout; |
||
13 | extern unsigned volatile char NeueKoordinateEmpfangen; |
||
1212 | hbuss | 14 | extern unsigned volatile char PC_MotortestActive; |
1 | ingob | 15 | extern unsigned char MeineSlaveAdresse; |
16 | extern unsigned char PcZugriff; |
||
499 | hbuss | 17 | extern unsigned char RemotePollDisplayLine; |
1782 | ingob | 18 | extern unsigned volatile char RxdBuffer[]; |
693 | hbuss | 19 | extern int Debug_Timer,Kompass_Timer; |
1 | ingob | 20 | extern void UART_Init (void); |
1444 | ingob | 21 | extern void uart_putchar (char c); |
2008 | holgerb | 22 | //extern void boot_program_page (uint32_t page, uint8_t *buf); |
1 | ingob | 23 | extern void DatenUebertragung(void); |
1211 | hbuss | 24 | extern void Uart1Init(void); |
395 | hbuss | 25 | extern void BearbeiteRxDaten(void); |
1212 | hbuss | 26 | extern unsigned char MotorTest[16]; |
2620 | holgerb | 27 | extern unsigned char SwitchMultiplexerToUpdate; // the Uart-Multiplexer on the FC V3.0 |
2627 | holgerb | 28 | extern unsigned char SerialChannelDataOkay; // timeout |
2620 | holgerb | 29 | |
1 | ingob | 30 | struct str_DebugOut |
31 | { |
||
1702 | holgerb | 32 | unsigned char Status[2]; |
805 | hbuss | 33 | signed int Analog[32]; // Debugwerte |
1 | ingob | 34 | }; |
35 | |||
36 | extern struct str_DebugOut DebugOut; |
||
37 | |||
693 | hbuss | 38 | struct str_WinkelOut |
39 | { |
||
849 | hbuss | 40 | signed int Winkel[2]; |
819 | hbuss | 41 | unsigned char UserParameter[2]; |
1051 | killagreg | 42 | unsigned char CalcState; |
819 | hbuss | 43 | unsigned char Orientation; |
693 | hbuss | 44 | }; |
45 | extern struct str_WinkelOut WinkelOut; |
||
46 | |||
1171 | hbuss | 47 | struct str_Data3D |
1561 | killagreg | 48 | { |
1171 | hbuss | 49 | signed int Winkel[3]; // nick, roll, compass in 0,1° |
1685 | holgerb | 50 | signed char Centroid[3]; |
2518 | holgerb | 51 | // signed char reserve[5]; |
52 | unsigned int AccZ; |
||
53 | signed char reserve[3]; |
||
1171 | hbuss | 54 | }; |
55 | extern struct str_Data3D Data3D; |
||
56 | |||
2496 | holgerb | 57 | /* |
595 | hbuss | 58 | struct str_ExternControl |
1 | ingob | 59 | { |
60 | unsigned char Digital[2]; |
||
61 | unsigned char RemoteTasten; |
||
595 | hbuss | 62 | signed char Nick; |
63 | signed char Roll; |
||
64 | signed char Gier; |
||
65 | unsigned char Gas; |
||
66 | signed char Hight; |
||
67 | unsigned char free; |
||
68 | unsigned char Frame; |
||
69 | unsigned char Config; |
||
1051 | killagreg | 70 | }; |
595 | hbuss | 71 | extern struct str_ExternControl ExternControl; |
2496 | holgerb | 72 | */ |
1 | ingob | 73 | |
2594 | holgerb | 74 | #define EC_VALID 0x01 // only valid if this is 1 |
75 | #define EC_GAS_ADD 0x02 // if 1 -> use the GAS Value not as MAX |
||
76 | #define EC_USE_SWITCH 0x20 // if 1 -> use the Switches for further control |
||
77 | #define EC_IGNORE_RC_STICK 0x40 // direct control (do nor add to RC-Stick) |
||
2595 | holgerb | 78 | #define EC_IGNORE_RC_LOST 0x80 // if 1 -> for Flying without RC-Control |
2496 | holgerb | 79 | |
2594 | holgerb | 80 | // defines for ExternalControl.Switches -> control GPS Modes etc. if(Config & EC_USE_SWITCH) |
81 | #define EC2_PH 0x01 // GPS-Mode: PH |
||
82 | #define EC2_CH 0x02 // GPS-Mode: CH |
||
83 | #define EC2_CAREFREE 0x10 // |
||
84 | #define EC2_ALTITUDE 0x20 // |
||
85 | #define EC2_AUTOSTART 0x40 // |
||
86 | #define EC2_AUTOLAND 0x80 // |
||
87 | |||
2496 | holgerb | 88 | struct str_ExternControl |
89 | { |
||
2594 | holgerb | 90 | signed char Nick; |
91 | signed char Roll; |
||
92 | signed char Gier; |
||
93 | signed char Gas; |
||
94 | unsigned char Frame; // will return a confirm frame with this value |
||
2496 | holgerb | 95 | unsigned char Config; |
2594 | holgerb | 96 | unsigned char Switches; |
97 | unsigned char Free1; // these two don't need capacity in the ASCII data string |
||
98 | unsigned char Free2; |
||
2496 | holgerb | 99 | }; |
100 | extern struct str_ExternControl ExternalControl; |
||
101 | extern unsigned char ExternalControlTimeout; |
||
102 | |||
1765 | killagreg | 103 | // FC hardware errors |
104 | |||
2611 | holgerb | 105 | // bitmask for VersionInfo.HardwareError[0] |
1765 | killagreg | 106 | #define FC_ERROR0_GYRO_NICK 0x01 |
107 | #define FC_ERROR0_GYRO_ROLL 0x02 |
||
108 | #define FC_ERROR0_GYRO_YAW 0x04 |
||
109 | #define FC_ERROR0_ACC_NICK 0x08 |
||
110 | #define FC_ERROR0_ACC_ROLL 0x10 |
||
111 | #define FC_ERROR0_ACC_TOP 0x20 |
||
112 | #define FC_ERROR0_PRESSURE 0x40 |
||
113 | #define FC_ERROR0_CAREFREE 0x80 |
||
2611 | holgerb | 114 | // bitmask for VersionInfo.HardwareError[1] |
1765 | killagreg | 115 | #define FC_ERROR1_I2C 0x01 |
116 | #define FC_ERROR1_BL_MISSING 0x02 |
||
117 | #define FC_ERROR1_SPI_RX 0x04 |
||
118 | #define FC_ERROR1_PPM 0x08 |
||
119 | #define FC_ERROR1_MIXER 0x10 |
||
2611 | holgerb | 120 | #define FC_ERROR1_RC_VOLTAGE 0x20 |
121 | #define FC_ERROR1_ACC_NOT_CAL 0x40 |
||
1765 | killagreg | 122 | #define FC_ERROR1_RES3 0x80 |
123 | |||
2342 | holgerb | 124 | // for FlightCtrl |
125 | //VersionInfo.Flags |
||
126 | #define FC_VERSION_FLAG_NC_PRESENT 0x01 |
||
127 | // for NaviCtrl |
||
128 | #define NC_VERSION_FLAG_MK3MAG_PRESENT 0x01 |
||
129 | |||
1 | ingob | 130 | struct str_VersionInfo |
131 | { |
||
1058 | killagreg | 132 | unsigned char SWMajor; |
133 | unsigned char SWMinor; |
||
134 | unsigned char ProtoMajor; |
||
2518 | holgerb | 135 | unsigned char LabelTextCRC; |
1058 | killagreg | 136 | unsigned char SWPatch; |
2342 | holgerb | 137 | unsigned char HardwareError[2]; |
138 | unsigned char HWMajor; |
||
2466 | holgerb | 139 | unsigned char BL_Firmware; |
2342 | holgerb | 140 | unsigned char Flags; |
1051 | killagreg | 141 | }; |
1702 | holgerb | 142 | |
1 | ingob | 143 | extern struct str_VersionInfo VersionInfo; |
144 | |||
1561 | killagreg | 145 | //#define USART0_BAUD 9600 |
146 | //#define USART0_BAUD 14400 |
||
147 | //#define USART0_BAUD 28800 |
||
148 | //#define USART0_BAUD 38400 |
||
149 | #define USART0_BAUD 57600 |
||
1 | ingob | 150 | |
151 | |||
152 | #endif //_UART_H |