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