Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
438 Nick666 1
#ifndef _UART_H
2
 #define _UART_H
3
 
4
#define MAX_SENDE_BUFF     150
5
#define MAX_EMPFANGS_BUFF  150
6
 
7
 
8
void BearbeiteRxDaten(void);
9
 
10
extern unsigned char DebugGetAnforderung;
11
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF];
12
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF];
13
extern unsigned volatile char UebertragungAbgeschlossen;
14
extern unsigned volatile char PC_DebugTimeout;
15
extern unsigned volatile char NeueKoordinateEmpfangen;
16
extern unsigned char MeineSlaveAdresse;
17
extern unsigned char PcZugriff;
18
extern int Debug_Timer;
19
extern void UART_Init (void);
20
extern int uart_putchar (char c);
21
extern void boot_program_page (uint32_t page, uint8_t *buf);
22
extern void DatenUebertragung(void);
23
extern void DecodeNMEA(void);
24
extern void BearbeiteRxDaten(void);
25
extern unsigned char MotorTest[4];
26
struct str_DebugOut
27
{
28
 unsigned char Digital[2];
29
 unsigned int Analog[32];    // Debugwerte
30
};
31
 
32
extern struct str_DebugOut    DebugOut;
33
 
34
struct str_Debug
35
{
36
 unsigned char Digital[2];
37
 unsigned char RemoteTasten;
38
 unsigned int Analog[4];
39
};
40
extern struct str_Debug       DebugIn;
41
 
42
struct str_VersionInfo
43
{
44
  unsigned char Hauptversion;
45
  unsigned char Nebenversion;
46
  unsigned char PCKompatibel;
47
  unsigned char Rserved[7];
48
};  
49
extern struct str_VersionInfo VersionInfo;
50
 
51
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
52
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle      
53
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle      
54
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle      
55
//#define BAUD_RATE 38400               //Baud Rate für die Serielle Schnittstelle      
56
#define BAUD_RATE 57600         //Baud Rate für die Serielle Schnittstelle      
57
 
58
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
59
#if defined (__AVR_ATmega128__)
60
#       define USR UCSR0A
61
#       define UCR UCSR0B
62
#       define UDR UDR0
63
#       define UBRR UBRR0L
64
#       define EICR EICRB
65
#endif
66
 
67
#if defined (__AVR_ATmega32__)
68
#       define USR UCSRA
69
#       define UCR UCSRB
70
#       define UBRR UBRRL
71
#       define EICR EICRB
72
#   define INT_VEC_RX  SIG_UART_RECV
73
#   define INT_VEC_TX  SIG_UART_TRANS
74
#endif
75
 
76
#if defined (__AVR_ATmega644__)
77
#       define USR  UCSR0A
78
#       define UCR  UCSR0B
79
#       define UDR  UDR0
80
#       define UBRR UBRR0L
81
#       define EICR EICR0B
82
#   define TXEN TXEN0
83
#   define RXEN RXEN0
84
#   define RXCIE RXCIE0
85
#   define TXCIE TXCIE0
86
#   define U2X  U2X0
87
#   define UCSRB UCSR0B
88
#   define UDRE UDRE0
89
#   define INT_VEC_RX  SIG_USART_RECV
90
#   define INT_VEC_TX  SIG_USART_TRANS
91
#endif
92
 
93
 
94
#endif //_UART_H