Rev 2008 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2008 | Rev 2342 | ||
---|---|---|---|
1 | #ifndef _UART_H |
1 | #ifndef _UART_H |
2 | #define _UART_H |
2 | #define _UART_H |
3 | 3 | ||
4 | #define printf_P(format, args...) _printf_P(&uart_putchar, format , ## args) |
4 | #define printf_P(format, args...) _printf_P(&uart_putchar, format , ## args) |
5 | #define printf(format, args...) _printf_P(&uart_putchar, PSTR(format) , ## args) |
5 | #define printf(format, args...) _printf_P(&uart_putchar, PSTR(format) , ## args) |
6 | 6 | ||
7 | void BearbeiteRxDaten(void); |
7 | void BearbeiteRxDaten(void); |
8 | 8 | ||
9 | extern unsigned char DebugGetAnforderung; |
9 | extern unsigned char DebugGetAnforderung; |
10 | extern unsigned volatile char ReceiverUpdateModeActive; |
10 | extern unsigned volatile char ReceiverUpdateModeActive; |
11 | extern unsigned volatile char UebertragungAbgeschlossen; |
11 | extern unsigned volatile char UebertragungAbgeschlossen; |
12 | extern unsigned volatile char PC_DebugTimeout; |
12 | extern unsigned volatile char PC_DebugTimeout; |
13 | extern unsigned volatile char NeueKoordinateEmpfangen; |
13 | extern unsigned volatile char NeueKoordinateEmpfangen; |
14 | extern unsigned volatile char PC_MotortestActive; |
14 | extern unsigned volatile char PC_MotortestActive; |
15 | extern unsigned char MeineSlaveAdresse; |
15 | extern unsigned char MeineSlaveAdresse; |
16 | extern unsigned char PcZugriff; |
16 | extern unsigned char PcZugriff; |
17 | extern unsigned char RemotePollDisplayLine; |
17 | extern unsigned char RemotePollDisplayLine; |
18 | extern unsigned volatile char RxdBuffer[]; |
18 | extern unsigned volatile char RxdBuffer[]; |
19 | extern int Debug_Timer,Kompass_Timer; |
19 | extern int Debug_Timer,Kompass_Timer; |
20 | extern void UART_Init (void); |
20 | extern void UART_Init (void); |
21 | extern void uart_putchar (char c); |
21 | extern void uart_putchar (char c); |
22 | //extern void boot_program_page (uint32_t page, uint8_t *buf); |
22 | //extern void boot_program_page (uint32_t page, uint8_t *buf); |
23 | extern void DatenUebertragung(void); |
23 | extern void DatenUebertragung(void); |
24 | extern void Uart1Init(void); |
24 | extern void Uart1Init(void); |
25 | extern void BearbeiteRxDaten(void); |
25 | extern void BearbeiteRxDaten(void); |
26 | extern unsigned char MotorTest[16]; |
26 | extern unsigned char MotorTest[16]; |
27 | struct str_DebugOut |
27 | struct str_DebugOut |
28 | { |
28 | { |
29 | unsigned char Status[2]; |
29 | unsigned char Status[2]; |
30 | signed int Analog[32]; // Debugwerte |
30 | signed int Analog[32]; // Debugwerte |
31 | }; |
31 | }; |
32 | 32 | ||
33 | extern struct str_DebugOut DebugOut; |
33 | extern struct str_DebugOut DebugOut; |
34 | 34 | ||
35 | struct str_WinkelOut |
35 | struct str_WinkelOut |
36 | { |
36 | { |
37 | signed int Winkel[2]; |
37 | signed int Winkel[2]; |
38 | unsigned char UserParameter[2]; |
38 | unsigned char UserParameter[2]; |
39 | unsigned char CalcState; |
39 | unsigned char CalcState; |
40 | unsigned char Orientation; |
40 | unsigned char Orientation; |
41 | }; |
41 | }; |
42 | extern struct str_WinkelOut WinkelOut; |
42 | extern struct str_WinkelOut WinkelOut; |
43 | 43 | ||
44 | struct str_Data3D |
44 | struct str_Data3D |
45 | { |
45 | { |
46 | signed int Winkel[3]; // nick, roll, compass in 0,1° |
46 | signed int Winkel[3]; // nick, roll, compass in 0,1° |
47 | signed char Centroid[3]; |
47 | signed char Centroid[3]; |
48 | signed char reserve[5]; |
48 | signed char reserve[5]; |
49 | }; |
49 | }; |
50 | extern struct str_Data3D Data3D; |
50 | extern struct str_Data3D Data3D; |
51 | 51 | ||
52 | struct str_ExternControl |
52 | struct str_ExternControl |
53 | { |
53 | { |
54 | unsigned char Digital[2]; |
54 | unsigned char Digital[2]; |
55 | unsigned char RemoteTasten; |
55 | unsigned char RemoteTasten; |
56 | signed char Nick; |
56 | signed char Nick; |
57 | signed char Roll; |
57 | signed char Roll; |
58 | signed char Gier; |
58 | signed char Gier; |
59 | unsigned char Gas; |
59 | unsigned char Gas; |
60 | signed char Hight; |
60 | signed char Hight; |
61 | unsigned char free; |
61 | unsigned char free; |
62 | unsigned char Frame; |
62 | unsigned char Frame; |
63 | unsigned char Config; |
63 | unsigned char Config; |
64 | }; |
64 | }; |
65 | extern struct str_ExternControl ExternControl; |
65 | extern struct str_ExternControl ExternControl; |
66 | 66 | ||
67 | // FC hardware errors |
67 | // FC hardware errors |
68 | 68 | ||
69 | // bitmask for UART_VersionInfo_t.HardwareError[0] |
69 | // bitmask for UART_VersionInfo_t.HardwareError[0] |
70 | #define FC_ERROR0_GYRO_NICK 0x01 |
70 | #define FC_ERROR0_GYRO_NICK 0x01 |
71 | #define FC_ERROR0_GYRO_ROLL 0x02 |
71 | #define FC_ERROR0_GYRO_ROLL 0x02 |
72 | #define FC_ERROR0_GYRO_YAW 0x04 |
72 | #define FC_ERROR0_GYRO_YAW 0x04 |
73 | #define FC_ERROR0_ACC_NICK 0x08 |
73 | #define FC_ERROR0_ACC_NICK 0x08 |
74 | #define FC_ERROR0_ACC_ROLL 0x10 |
74 | #define FC_ERROR0_ACC_ROLL 0x10 |
75 | #define FC_ERROR0_ACC_TOP 0x20 |
75 | #define FC_ERROR0_ACC_TOP 0x20 |
76 | #define FC_ERROR0_PRESSURE 0x40 |
76 | #define FC_ERROR0_PRESSURE 0x40 |
77 | #define FC_ERROR0_CAREFREE 0x80 |
77 | #define FC_ERROR0_CAREFREE 0x80 |
78 | // bitmask for UART_VersionInfo_t.HardwareError[1] |
78 | // bitmask for UART_VersionInfo_t.HardwareError[1] |
79 | #define FC_ERROR1_I2C 0x01 |
79 | #define FC_ERROR1_I2C 0x01 |
80 | #define FC_ERROR1_BL_MISSING 0x02 |
80 | #define FC_ERROR1_BL_MISSING 0x02 |
81 | #define FC_ERROR1_SPI_RX 0x04 |
81 | #define FC_ERROR1_SPI_RX 0x04 |
82 | #define FC_ERROR1_PPM 0x08 |
82 | #define FC_ERROR1_PPM 0x08 |
83 | #define FC_ERROR1_MIXER 0x10 |
83 | #define FC_ERROR1_MIXER 0x10 |
84 | #define FC_ERROR1_RES1 0x20 |
84 | #define FC_ERROR1_RES1 0x20 |
85 | #define FC_ERROR1_RES2 0x40 |
85 | #define FC_ERROR1_RES2 0x40 |
86 | #define FC_ERROR1_RES3 0x80 |
86 | #define FC_ERROR1_RES3 0x80 |
- | 87 | ||
- | 88 | ||
- | 89 | // for FlightCtrl |
|
- | 90 | //VersionInfo.Flags |
|
- | 91 | #define FC_VERSION_FLAG_NC_PRESENT 0x01 |
|
- | 92 | // for NaviCtrl |
|
- | 93 | #define NC_VERSION_FLAG_MK3MAG_PRESENT 0x01 |
|
87 | 94 | ||
88 | struct str_VersionInfo |
95 | struct str_VersionInfo |
89 | { |
96 | { |
90 | unsigned char SWMajor; |
97 | unsigned char SWMajor; |
91 | unsigned char SWMinor; |
98 | unsigned char SWMinor; |
92 | unsigned char ProtoMajor; |
99 | unsigned char ProtoMajor; |
93 | unsigned char ProtoMinor; |
100 | unsigned char reserved1; |
94 | unsigned char SWPatch; |
101 | unsigned char SWPatch; |
95 | unsigned char HardwareError[5]; |
102 | unsigned char HardwareError[2]; |
- | 103 | unsigned char HWMajor; |
|
- | 104 | unsigned char reserved2; |
|
- | 105 | unsigned char Flags; |
|
96 | }; |
106 | }; |
97 | 107 | ||
98 | extern struct str_VersionInfo VersionInfo; |
108 | extern struct str_VersionInfo VersionInfo; |
99 | 109 | ||
100 | //#define USART0_BAUD 9600 |
110 | //#define USART0_BAUD 9600 |
101 | //#define USART0_BAUD 14400 |
111 | //#define USART0_BAUD 14400 |
102 | //#define USART0_BAUD 28800 |
112 | //#define USART0_BAUD 28800 |
103 | //#define USART0_BAUD 38400 |
113 | //#define USART0_BAUD 38400 |
104 | #define USART0_BAUD 57600 |
114 | #define USART0_BAUD 57600 |
105 | 115 | ||
106 | 116 | ||
107 | #endif //_UART_H |
117 | #endif //_UART_H |
108 | 118 |