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