Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1234 ligi 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 volatile char PC_MotortestActive;
16
extern unsigned char MeineSlaveAdresse;
17
extern unsigned char PcZugriff;
18
extern unsigned char RemotePollDisplayLine;
19
extern int Debug_Timer,Kompass_Timer;
20
extern void UART_Init (void);
21
extern int uart_putchar (char c);
22
extern void boot_program_page (uint32_t page, uint8_t *buf);
23
extern void DatenUebertragung(void);
24
extern void Uart1Init(void);
25
extern void BearbeiteRxDaten(void);
26
extern unsigned char MotorTest[16];
27
struct str_DebugOut
28
{
29
 unsigned char Digital[2];
30
 signed int Analog[32];    // Debugwerte
31
};
32
 
33
extern struct str_DebugOut    DebugOut;
34
 
35
struct str_WinkelOut
36
{
37
   signed int  Winkel[2];
38
 unsigned char UserParameter[2];
39
 unsigned char CalcState;
40
 unsigned char Orientation;
41
};
42
extern struct str_WinkelOut  WinkelOut;
43
 
44
struct str_Data3D
45
{
46
   signed int  Winkel[3]; // nick, roll, compass in 0,1°
47
   signed char reserve[8];
48
};
49
extern struct str_Data3D Data3D;
50
 
51
struct str_ExternControl
52
{
53
 unsigned char Digital[2];
54
 unsigned char RemoteTasten;
55
 signed char   Nick;
56
 signed char   Roll;
57
 signed char   Gier;
58
 unsigned char Gas;
59
 signed char   Hight;
60
 unsigned char free;
61
 unsigned char Frame;
62
 unsigned char Config;
63
};
64
extern struct str_ExternControl   ExternControl;
65
 
66
 
67
struct str_ExternEvent
68
{
69
  unsigned char key;
70
  unsigned char values[4];
71
};
72
 
73
extern struct str_ExternEvent ExternEvent;
74
 
75
 
76
struct str_VersionInfo
77
{
78
  unsigned char SWMajor;
79
  unsigned char SWMinor;
80
  unsigned char ProtoMajor;
81
  unsigned char ProtoMinor;
82
  unsigned char SWPatch;
83
  unsigned char Reserved[5];
84
};
85
extern struct str_VersionInfo VersionInfo;
86
 
87
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud
88
//#define BAUD_RATE 9600                //Baud Rate für die Serielle Schnittstelle
89
//#define BAUD_RATE 14400               //Baud Rate für die Serielle Schnittstelle
90
//#define BAUD_RATE 28800               //Baud Rate für die Serielle Schnittstelle
91
//#define BAUD_RATE 38400               //Baud Rate für die Serielle Schnittstelle
92
#define BAUD_RATE 57600         //Baud Rate für die Serielle Schnittstelle
93
 
94
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird
95
#if defined (__AVR_ATmega128__)
96
#       define USR UCSR0A
97
#       define UCR UCSR0B
98
#       define UDR UDR0
99
#       define UBRR UBRR0L
100
#       define EICR EICRB
101
#endif
102
 
103
#if defined (__AVR_ATmega32__)
104
#       define USR UCSRA
105
#       define UCR UCSRB
106
#       define UBRR UBRRL
107
#       define EICR EICRB
108
#   define INT_VEC_RX  SIG_UART_RECV
109
#   define INT_VEC_TX  SIG_UART_TRANS
110
#endif
111
 
112
#if defined (__AVR_ATmega644__)
113
#       define USR  UCSR0A
114
#       define UCR  UCSR0B
115
#       define UDR  UDR0
116
#       define UBRR UBRR0L
117
#       define EICR EICR0B
118
#   define TXEN TXEN0
119
#   define RXEN RXEN0
120
#   define RXCIE RXCIE0
121
#   define TXCIE TXCIE0
122
#   define U2X  U2X0
123
#   define UCSRB UCSR0B
124
#   define UDRE UDRE0
125
#   define INT_VEC_RX  SIG_USART_RECV
126
#   define INT_VEC_TX  SIG_USART_TRANS
127
#endif
128
 
129
#if defined (__AVR_ATmega644P__)
130
# define USR  UCSR0A
131
# define UCR  UCSR0B
132
# define UDR  UDR0
133
# define UBRR UBRR0L
134
# define EICR EICR0B
135
#   define TXEN TXEN0
136
#   define RXEN RXEN0
137
#   define RXCIE RXCIE0
138
#   define TXCIE TXCIE0
139
#   define U2X  U2X0
140
#   define UCSRB UCSR0B
141
#   define UDRE UDRE0
142
#   define INT_VEC_RX  SIG_USART_RECV
143
#   define INT_VEC_TX  SIG_USART_TRANS
144
#endif
145
 
146
#endif //_UART_H