Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1112 thjac 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 unsigned char RemotePollDisplayLine;
18
extern int Debug_Timer,Kompass_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
 signed int Analog[32];    // Debugwerte
30
};
31
 
32
extern struct str_DebugOut    DebugOut;
33
 
34
struct str_WinkelOut
35
{
36
   signed int  Winkel[2];
37
 unsigned char UserParameter[2];
38
 unsigned char CalcState;
39
 unsigned char Orientation;
40
};
41
extern struct str_WinkelOut  WinkelOut;
42
 
43
struct str_ExternControl
44
{
45
 unsigned char Digital[2];
46
 unsigned char RemoteTasten;
47
 signed char   Nick;
48
 signed char   Roll;
49
 signed char   Gier;
50
 unsigned char Gas;
51
 signed char   Hight;
52
 unsigned char free;
53
 unsigned char Frame;
54
 unsigned char Config;
55
};
56
extern struct str_ExternControl   ExternControl;
57
 
58
struct str_VersionInfo
59
{
60
  unsigned char SWMajor;
61
  unsigned char SWMinor;
62
  unsigned char ProtoMajor;
63
  unsigned char ProtoMinor;
64
  unsigned char SWPatch;
65
  unsigned char Reserved[5];
66
};
67
extern struct str_VersionInfo VersionInfo;
68
 
69
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
70
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle
71
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle
72
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle
73
//#define BAUD_RATE 38400               //Baud Rate für die Serielle Schnittstelle
74
#define BAUD_RATE 57600         //Baud Rate für die Serielle Schnittstelle
75
 
76
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
77
#if defined (__AVR_ATmega128__)
78
#       define USR UCSR0A
79
#       define UCR UCSR0B
80
#       define UDR UDR0
81
#       define UBRR UBRR0L
82
#       define EICR EICRB
83
#endif
84
 
85
#if defined (__AVR_ATmega32__)
86
#       define USR UCSRA
87
#       define UCR UCSRB
88
#       define UBRR UBRRL
89
#       define EICR EICRB
90
#   define INT_VEC_RX  SIG_UART_RECV
91
#   define INT_VEC_TX  SIG_UART_TRANS
92
#endif
93
 
94
#if defined (__AVR_ATmega644__)
95
#       define USR  UCSR0A
96
#       define UCR  UCSR0B
97
#       define UDR  UDR0
98
#       define UBRR UBRR0L
99
#       define EICR EICR0B
100
#   define TXEN TXEN0
101
#   define RXEN RXEN0
102
#   define RXCIE RXCIE0
103
#   define TXCIE TXCIE0
104
#   define U2X  U2X0
105
#   define UCSRB UCSR0B
106
#   define UDRE UDRE0
107
#   define INT_VEC_RX  SIG_USART_RECV
108
#   define INT_VEC_TX  SIG_USART_TRANS
109
#endif
110
 
111
 
112
#endif //_UART_H