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