Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
90 gunterl 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
void BearbeiteRxDaten(void);
13
 
14
extern unsigned char DebugGetAnforderung;
15
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
16
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
17
extern unsigned volatile char UebertragungAbgeschlossen;
18
extern unsigned volatile char PC_DebugTimeout;
19
extern unsigned volatile char NeueKoordinateEmpfangen;
20
extern unsigned char MeineSlaveAdresse;
21
extern unsigned char PcZugriff;
22
extern unsigned char RemotePollDisplayLine;
23
extern int Debug_Timer;
24
extern void UART_Init (void);
25
extern int uart_putchar (char c);
26
extern void boot_program_page (uint32_t page, uint8_t *buf);
27
extern void DatenUebertragung(void);
28
extern void DecodeNMEA(void);
29
extern void BearbeiteRxDaten(void);
30
extern unsigned char MotorTest[4];
31
extern unsigned char DubWiseKeys[3];
32
struct str_DebugOut
33
{
34
 unsigned char Digital[2];
35
 unsigned int Analog[32];    // Debugwerte
36
};
37
 
38
extern struct str_DebugOut    DebugOut;
39
 
40
struct str_Debug
41
{
42
 unsigned char Digital[2];
43
 unsigned char RemoteTasten;
44
 unsigned int Analog[4];
45
};
46
extern struct str_Debug       DebugIn;
47
 
48
struct str_VersionInfo
49
{
50
  unsigned char Hauptversion;
51
  unsigned char Nebenversion;
52
  unsigned char PCKompatibel;
53
  unsigned char Rserved[7];
54
};  
55
extern struct str_VersionInfo VersionInfo;
56
 
57
struct str_ControlIn
58
{
59
  int roll;
60
  int nick;
61
  int gier;
62
  int gas;
63
};
64
extern struct str_ControlIn ControlIn;
65
 
66
struct str_ControlOut
67
{
68
  unsigned char errorcode;
69
};
70
extern struct str_ControlOut ControlOut;
71
 
72
#define ControlError_ok                 0x00;
73
#define ControlError_ignore             0x01;
74
 
75
//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 14400               //Baud Rate für die Serielle Schnittstelle      
78
//#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 57600         //Baud Rate für die Serielle Schnittstelle      
81
 
82
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
83
#if defined (__AVR_ATmega128__)
84
#       define USR UCSR0A
85
#       define UCR UCSR0B
86
#       define UDR UDR0
87
#       define UBRR UBRR0L
88
#       define EICR EICRB
89
#endif
90
 
91
#if defined (__AVR_ATmega32__)
92
#       define USR UCSRA
93
#       define UCR UCSRB
94
#       define UBRR UBRRL
95
#       define EICR EICRB
96
#   define INT_VEC_RX  SIG_UART_RECV
97
#   define INT_VEC_TX  SIG_UART_TRANS
98
#endif
99
 
100
#if defined (__AVR_ATmega644__)
101
#       define USR  UCSR0A
102
#       define UCR  UCSR0B
103
#       define UDR  UDR0
104
#       define UBRR UBRR0L
105
#       define EICR EICR0B
106
#   define TXEN TXEN0
107
#   define RXEN RXEN0
108
#   define RXCIE RXCIE0
109
#   define TXCIE TXCIE0
110
#   define U2X  U2X0
111
#   define UCSRB UCSR0B
112
#   define UDRE UDRE0
113
#   define INT_VEC_RX  SIG_USART_RECV
114
#   define INT_VEC_TX  SIG_USART_TRANS
115
#endif
116
 
117
#if defined (__AVR_ATmega644P__)
118
#       define USR  UCSR0A
119
#       define UCR  UCSR0B
120
#       define UDR  UDR0
121
#       define UBRR UBRR0L
122
#       define EICR EICR0B
123
#   define TXEN TXEN0
124
#   define RXEN RXEN0
125
#   define RXCIE RXCIE0
126
#   define TXCIE TXCIE0
127
#   define U2X  U2X0
128
#   define UCSRB UCSR0B
129
#   define UDRE UDRE0
130
 
131
#       define USR1  UCSR1A
132
#       define UCR1  UCSR1B
133
 
134
 
135
 
136
#   define INT_VEC_RX0  SIG_USART_RECV
137
#   define INT_VEC_TX0  SIG_USART_TRANS
138
#   define INT_VEC_RX1  SIG_USART1_RECV
139
#   define INT_VEC_TX1  SIG_USART1_TRANS
140
 
141
#endif
142
 
143
#endif //_UART_H