Subversion Repositories FlightCtrl

Rev

Rev 499 | Rev 693 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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