Rev 1438 | Rev 1444 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1438 | Rev 1441 | ||
---|---|---|---|
1 | #ifndef _UART_H |
1 | #ifndef _UART_H |
2 | #define _UART_H |
2 | #define _UART_H |
3 | - | ||
4 | #define MAX_SENDE_BUFF 150 |
- | |
- | 3 | ||
5 | #define MAX_EMPFANGS_BUFF 150 |
4 | |
6 | 5 | ||
7 | void BearbeiteRxDaten(void); |
6 | void BearbeiteRxDaten(void); |
8 | 7 | ||
9 | extern unsigned char DebugGetAnforderung; |
8 | extern unsigned char DebugGetAnforderung; |
10 | extern unsigned volatile char TxdBuffer[]; |
- | |
11 | extern unsigned volatile char RxdBuffer[]; |
- | |
- | 9 | ||
12 | extern unsigned volatile char UebertragungAbgeschlossen; |
10 | extern unsigned volatile char UebertragungAbgeschlossen; |
13 | extern unsigned volatile char PC_DebugTimeout; |
11 | extern unsigned volatile char PC_DebugTimeout; |
14 | extern unsigned volatile char NeueKoordinateEmpfangen; |
12 | extern unsigned volatile char NeueKoordinateEmpfangen; |
15 | extern unsigned volatile char PC_MotortestActive; |
13 | extern unsigned volatile char PC_MotortestActive; |
16 | extern unsigned char MeineSlaveAdresse; |
14 | extern unsigned char MeineSlaveAdresse; |
17 | extern unsigned char PcZugriff; |
15 | extern unsigned char PcZugriff; |
18 | extern unsigned char RemotePollDisplayLine; |
16 | extern unsigned char RemotePollDisplayLine; |
19 | extern int Debug_Timer,Kompass_Timer; |
17 | extern int Debug_Timer,Kompass_Timer; |
20 | extern void UART_Init (void); |
18 | extern void UART_Init (void); |
21 | extern int uart_putchar (char c); |
19 | extern int uart_putchar (char c); |
22 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
20 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
23 | extern void DatenUebertragung(void); |
21 | extern void DatenUebertragung(void); |
24 | extern void Uart1Init(void); |
22 | extern void Uart1Init(void); |
25 | extern void BearbeiteRxDaten(void); |
23 | extern void BearbeiteRxDaten(void); |
26 | extern unsigned char MotorTest[16]; |
24 | extern unsigned char MotorTest[16]; |
27 | struct str_DebugOut |
25 | struct str_DebugOut |
28 | { |
26 | { |
29 | unsigned char Digital[2]; |
27 | unsigned char Digital[2]; |
30 | signed int Analog[32]; // Debugwerte |
28 | signed int Analog[32]; // Debugwerte |
31 | }; |
29 | }; |
32 | 30 | ||
33 | extern struct str_DebugOut DebugOut; |
31 | extern struct str_DebugOut DebugOut; |
34 | 32 | ||
35 | struct str_WinkelOut |
33 | struct str_WinkelOut |
36 | { |
34 | { |
37 | signed int Winkel[2]; |
35 | signed int Winkel[2]; |
38 | unsigned char UserParameter[2]; |
36 | unsigned char UserParameter[2]; |
39 | unsigned char CalcState; |
37 | unsigned char CalcState; |
40 | unsigned char Orientation; |
38 | unsigned char Orientation; |
41 | }; |
39 | }; |
42 | extern struct str_WinkelOut WinkelOut; |
40 | extern struct str_WinkelOut WinkelOut; |
43 | 41 | ||
44 | struct str_Data3D |
42 | struct str_Data3D |
45 | { |
43 | { |
46 | signed int Winkel[3]; // nick, roll, compass in 0,1° |
44 | signed int Winkel[3]; // nick, roll, compass in 0,1° |
47 | signed char reserve[8]; |
45 | signed char reserve[8]; |
48 | }; |
46 | }; |
49 | extern struct str_Data3D Data3D; |
47 | extern struct str_Data3D Data3D; |
50 | 48 | ||
51 | struct str_ExternControl |
49 | struct str_ExternControl |
52 | { |
50 | { |
53 | unsigned char Digital[2]; |
51 | unsigned char Digital[2]; |
54 | unsigned char RemoteTasten; |
52 | unsigned char RemoteTasten; |
55 | signed char Nick; |
53 | signed char Nick; |
56 | signed char Roll; |
54 | signed char Roll; |
57 | signed char Gier; |
55 | signed char Gier; |
58 | unsigned char Gas; |
56 | unsigned char Gas; |
59 | signed char Hight; |
57 | signed char Hight; |
60 | unsigned char free; |
58 | unsigned char free; |
61 | unsigned char Frame; |
59 | unsigned char Frame; |
62 | unsigned char Config; |
60 | unsigned char Config; |
63 | }; |
61 | }; |
64 | extern struct str_ExternControl ExternControl; |
62 | extern struct str_ExternControl ExternControl; |
65 | 63 | ||
66 | struct str_VersionInfo |
64 | struct str_VersionInfo |
67 | { |
65 | { |
68 | unsigned char SWMajor; |
66 | unsigned char SWMajor; |
69 | unsigned char SWMinor; |
67 | unsigned char SWMinor; |
70 | unsigned char ProtoMajor; |
68 | unsigned char ProtoMajor; |
71 | unsigned char ProtoMinor; |
69 | unsigned char ProtoMinor; |
72 | unsigned char SWPatch; |
70 | unsigned char SWPatch; |
73 | unsigned char Reserved[5]; |
71 | unsigned char Reserved[5]; |
74 | }; |
72 | }; |
75 | extern struct str_VersionInfo VersionInfo; |
73 | extern struct str_VersionInfo VersionInfo; |
76 | 74 | ||
77 | //Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
75 | //Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
78 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
76 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
79 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
77 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
80 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
78 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
81 | //#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
79 | //#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
82 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
80 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
83 | 81 | ||
84 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
82 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
85 | #if defined (__AVR_ATmega128__) |
83 | #if defined (__AVR_ATmega128__) |
86 | # define USR UCSR0A |
84 | # define USR UCSR0A |
87 | # define UCR UCSR0B |
85 | # define UCR UCSR0B |
88 | # define UDR UDR0 |
86 | # define UDR UDR0 |
89 | # define UBRR UBRR0L |
87 | # define UBRR UBRR0L |
90 | # define EICR EICRB |
88 | # define EICR EICRB |
91 | #endif |
89 | #endif |
92 | 90 | ||
93 | #if defined (__AVR_ATmega32__) |
91 | #if defined (__AVR_ATmega32__) |
94 | # define USR UCSRA |
92 | # define USR UCSRA |
95 | # define UCR UCSRB |
93 | # define UCR UCSRB |
96 | # define UBRR UBRRL |
94 | # define UBRR UBRRL |
97 | # define EICR EICRB |
95 | # define EICR EICRB |
98 | # define INT_VEC_RX SIG_UART_RECV |
96 | # define INT_VEC_RX SIG_UART_RECV |
99 | # define INT_VEC_TX SIG_UART_TRANS |
97 | # define INT_VEC_TX SIG_UART_TRANS |
100 | #endif |
98 | #endif |
101 | 99 | ||
102 | #if defined (__AVR_ATmega644__) |
100 | #if defined (__AVR_ATmega644__) |
103 | # define USR UCSR0A |
101 | # define USR UCSR0A |
104 | # define UCR UCSR0B |
102 | # define UCR UCSR0B |
105 | # define UDR UDR0 |
103 | # define UDR UDR0 |
106 | # define UBRR UBRR0L |
104 | # define UBRR UBRR0L |
107 | # define EICR EICR0B |
105 | # define EICR EICR0B |
108 | # define TXEN TXEN0 |
106 | # define TXEN TXEN0 |
109 | # define RXEN RXEN0 |
107 | # define RXEN RXEN0 |
110 | # define RXCIE RXCIE0 |
108 | # define RXCIE RXCIE0 |
111 | # define TXCIE TXCIE0 |
109 | # define TXCIE TXCIE0 |
112 | # define U2X U2X0 |
110 | # define U2X U2X0 |
113 | # define UCSRB UCSR0B |
111 | # define UCSRB UCSR0B |
114 | # define UDRE UDRE0 |
112 | # define UDRE UDRE0 |
115 | # define INT_VEC_RX SIG_USART_RECV |
113 | # define INT_VEC_RX SIG_USART_RECV |
116 | # define INT_VEC_TX SIG_USART_TRANS |
114 | # define INT_VEC_TX SIG_USART_TRANS |
117 | #endif |
115 | #endif |
118 | 116 | ||
119 | #if defined (__AVR_ATmega644P__) |
117 | #if defined (__AVR_ATmega644P__) |
120 | # define USR UCSR0A |
118 | # define USR UCSR0A |
121 | # define UCR UCSR0B |
119 | # define UCR UCSR0B |
122 | # define UDR UDR0 |
120 | # define UDR UDR0 |
123 | # define UBRR UBRR0L |
121 | # define UBRR UBRR0L |
124 | # define EICR EICR0B |
122 | # define EICR EICR0B |
125 | # define TXEN TXEN0 |
123 | # define TXEN TXEN0 |
126 | # define RXEN RXEN0 |
124 | # define RXEN RXEN0 |
127 | # define RXCIE RXCIE0 |
125 | # define RXCIE RXCIE0 |
128 | # define TXCIE TXCIE0 |
126 | # define TXCIE TXCIE0 |
129 | # define U2X U2X0 |
127 | # define U2X U2X0 |
130 | # define UCSRB UCSR0B |
128 | # define UCSRB UCSR0B |
131 | # define UDRE UDRE0 |
129 | # define UDRE UDRE0 |
132 | # define INT_VEC_RX SIG_USART_RECV |
130 | # define INT_VEC_RX SIG_USART_RECV |
133 | # define INT_VEC_TX SIG_USART_TRANS |
131 | # define INT_VEC_TX SIG_USART_TRANS |
134 | #endif |
132 | #endif |
135 | 133 | ||
136 | #endif //_UART_H |
134 | #endif //_UART_H |
137 | 135 |