Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
308 | osiair | 1 | #ifndef _UART_H |
2 | #define _UART_H |
||
3 | |||
4 | #define MAX_SENDE_BUFF 150 |
||
5 | #define MAX_EMPFANGS_BUFF 150 |
||
6 | |||
7 | void BearbeiteRxDaten(void); |
||
8 | |||
9 | extern unsigned char DebugGetAnforderung; |
||
10 | extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
||
11 | extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
||
12 | extern unsigned volatile char UebertragungAbgeschlossen; |
||
13 | extern unsigned volatile char PC_DebugTimeout; |
||
14 | extern unsigned volatile char NeueKoordinateEmpfangen; |
||
15 | extern unsigned char MeineSlaveAdresse; |
||
16 | extern unsigned char PcZugriff; |
||
17 | extern int Debug_Timer; |
||
18 | extern void UART_Init (void); |
||
19 | extern int uart_putchar (char c); |
||
20 | extern void boot_program_page (uint32_t page, uint8_t *buf); |
||
21 | extern void DatenUebertragung(void); |
||
22 | extern void DecodeNMEA(void); |
||
23 | extern unsigned char MotorTest[4]; |
||
24 | struct str_DebugOut |
||
25 | { |
||
26 | unsigned char Digital[13]; |
||
27 | unsigned int AnzahlZyklen; |
||
28 | unsigned int Zeit; |
||
29 | unsigned char Sekunden; |
||
30 | unsigned int Analog[16]; // Debugwerte |
||
31 | }; |
||
32 | |||
33 | extern struct str_DebugOut DebugOut; |
||
34 | |||
35 | #define _B1(bit) (1 << (bit)) |
||
36 | #define _B0(bit) (0 << (bit)) |
||
37 | |||
38 | typedef struct |
||
39 | { |
||
40 | long x; // in cm (+ = north) |
||
41 | long y; // in cm (+ = east) |
||
42 | long z; // in cm |
||
43 | long vx; |
||
44 | long vy; |
||
45 | long vz; |
||
46 | long northing; |
||
47 | long easting; |
||
48 | long altitude; |
||
49 | long velNorth; |
||
50 | long velEast; |
||
51 | uint8_t newData; // status of data: 0 = invlid; 1 = valid |
||
52 | uint8_t GPSFix; |
||
53 | uint8_t noSV; // number of sats |
||
54 | } gpsInfo_t; |
||
55 | |||
56 | |||
57 | extern gpsInfo_t lockedPos; // stored position to fly to |
||
58 | extern gpsInfo_t actualPos; // measured position (last gps record) |
||
59 | |||
60 | extern void GPSscanData (void); |
||
61 | extern void GPSupdate(void); |
||
62 | extern void GPSsaveTarget (uint8_t mode); |
||
63 | |||
64 | struct str_Debug |
||
65 | { |
||
66 | unsigned char Digital[2]; |
||
67 | unsigned char RemoteTasten; |
||
68 | unsigned int Analog[4]; |
||
69 | }; |
||
70 | extern struct str_Debug DebugIn; |
||
71 | |||
72 | struct str_VersionInfo |
||
73 | { |
||
74 | unsigned char Hauptversion; |
||
75 | unsigned char Nebenversion; |
||
76 | unsigned char PCKompatibel; |
||
77 | unsigned char Rserved[7]; |
||
78 | }; |
||
79 | extern struct str_VersionInfo VersionInfo; |
||
80 | |||
81 | //Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
||
82 | //#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
||
83 | //#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
||
84 | //#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
||
85 | //#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
||
86 | #define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
||
87 | |||
88 | //Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
||
89 | #if defined (__AVR_ATmega128__) |
||
90 | # define USR UCSR0A |
||
91 | # define UCR UCSR0B |
||
92 | # define UDR UDR0 |
||
93 | # define UBRR UBRR0L |
||
94 | # define EICR EICRB |
||
95 | #endif |
||
96 | |||
97 | #if defined (__AVR_ATmega32__) |
||
98 | # define USR UCSRA |
||
99 | # define UCR UCSRB |
||
100 | # define UBRR UBRRL |
||
101 | # define EICR EICRB |
||
102 | # define INT_VEC_RX SIG_UART_RECV |
||
103 | # define INT_VEC_TX SIG_UART_TRANS |
||
104 | #endif |
||
105 | |||
106 | #if defined (__AVR_ATmega644__) |
||
107 | # define USR UCSR0A |
||
108 | # define UCR UCSR0B |
||
109 | # define UDR UDR0 |
||
110 | # define UBRR UBRR0L |
||
111 | # define EICR EICR0B |
||
112 | # define TXEN TXEN0 |
||
113 | # define RXEN RXEN0 |
||
114 | # define RXCIE RXCIE0 |
||
115 | # define TXCIE TXCIE0 |
||
116 | # define U2X U2X0 |
||
117 | # define UCSRB UCSR0B |
||
118 | # define UDRE UDRE0 |
||
119 | # define INT_VEC_RX SIG_USART_RECV |
||
120 | # define INT_VEC_TX SIG_USART_TRANS |
||
121 | #endif |
||
122 | |||
123 | |||
124 | #endif //_UART_H |