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